From 3b0944529011d0c407abda89be5033fa931b124e Mon Sep 17 00:00:00 2001 From: Stephen Xu Date: Thu, 2 Jun 2022 19:36:50 +0100 Subject: [PATCH 1/2] Add defines to manually select CUDA function qualifier. --- glm/detail/setup.hpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index d9ca27dc..7ec71e22 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -424,8 +424,20 @@ // Qualifiers #if (GLM_COMPILER & GLM_COMPILER_CUDA) || (GLM_COMPILER & GLM_COMPILER_HIP) -# define GLM_CUDA_FUNC_DEF __device__ __host__ -# define GLM_CUDA_FUNC_DECL __device__ __host__ +# if defined(GLM_CUDA_FORCE_DEVICE_FUNC) && defined(GLM_CUDA_FORCE_HOST_FUNC) +# error "GLM error: GLM_CUDA_FORCE_DEVICE_FUNC and GLM_CUDA_FORCE_HOST_FUNC should not be defined at the same time, GLM by default generates both device and host code for CUDA compiler." +# endif//defined(GLM_CUDA_FORCE_DEVICE_FUNC) && defined(GLM_CUDA_FORCE_HOST_FUNC) + +# if defined(GLM_CUDA_FORCE_DEVICE_FUNC) +# define GLM_CUDA_FUNC_DEF __device__ +# define GLM_CUDA_FUNC_DECL __device__ +# elif defined(GLM_CUDA_FORCE_HOST_FUNC) +# define GLM_CUDA_FUNC_DEF __host__ +# define GLM_CUDA_FUNC_DECL __host__ +# else +# define GLM_CUDA_FUNC_DEF __device__ __host__ +# define GLM_CUDA_FUNC_DECL __device__ __host__ +# endif//defined(GLM_CUDA_FORCE_XXXX_FUNC) #else # define GLM_CUDA_FUNC_DEF # define GLM_CUDA_FUNC_DECL From e1b2d3d7d55fb7bfb996fd6b96ef71f162590b13 Mon Sep 17 00:00:00 2001 From: Stephen Xu Date: Thu, 2 Jun 2022 21:32:12 +0100 Subject: [PATCH 2/2] Add user instructions. --- glm/detail/setup.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 7ec71e22..5f69a0e2 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -423,6 +423,8 @@ /////////////////////////////////////////////////////////////////////////////////// // Qualifiers +// User defines: GLM_CUDA_FORCE_DEVICE_FUNC, GLM_CUDA_FORCE_HOST_FUNC + #if (GLM_COMPILER & GLM_COMPILER_CUDA) || (GLM_COMPILER & GLM_COMPILER_HIP) # if defined(GLM_CUDA_FORCE_DEVICE_FUNC) && defined(GLM_CUDA_FORCE_HOST_FUNC) # error "GLM error: GLM_CUDA_FORCE_DEVICE_FUNC and GLM_CUDA_FORCE_HOST_FUNC should not be defined at the same time, GLM by default generates both device and host code for CUDA compiler."