From b47ab113b482b752aef8201bcaa8a4a75ed59cd4 Mon Sep 17 00:00:00 2001 From: Ian Hinder Date: Wed, 2 May 2012 14:56:10 +0200 Subject: GenericFD: Provide annotation to sgn function for CUDA --- Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Auxiliary') diff --git a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h index 65be7c5..6e3ed2b 100644 --- a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h +++ b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h @@ -57,7 +57,14 @@ extern "C" { (*(CCTK_REAL const*)&((char const*)(var))[cdi*(i)+cdj*(j)+cdk*(k)]) /* Implement the signum function, used for Mathematica's Sign function */ -static inline CCTK_REAL sgn(CCTK_REAL x) + +#ifdef __CUDACC__ +#define KRANC_WHERE __device__ +#else +#define KRANC_WHERE +#endif + +KRANC_WHERE static inline CCTK_REAL sgn(CCTK_REAL x) { return x==(CCTK_REAL)0.0 ? (CCTK_REAL)0.0 : copysign((CCTK_REAL)1.0, x); } -- cgit v1.2.3