From 5b80d11f249793dfa5658acbacfb1e36c8f2d94c Mon Sep 17 00:00:00 2001 From: Chris Maffeo <cmaffeo2@illinois.edu> Date: Wed, 28 Aug 2024 15:55:56 -0500 Subject: [PATCH] Use ::cuda::std:numeric_limits in device Vector3 code --- src/Types/Vector3.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Types/Vector3.h b/src/Types/Vector3.h index 70eba08..b7cc265 100644 --- a/src/Types/Vector3.h +++ b/src/Types/Vector3.h @@ -9,6 +9,15 @@ #include <type_traits> // for std::common_type<T,U> #include <sstream> +#ifdef __CUDA_ARCH__ +#include <cuda/std/limits> +template<typename T> +using numeric_limits = ::cuda::std::numeric_limits<T>; +#else +template<typename T> +using numeric_limits = ::std::numeric_limits<T>; +#endif + /** * 3D vector utility class with common operations implemented on CPU and GPU. * @@ -217,8 +226,8 @@ public: } // Numeric limits - HOST DEVICE static inline T highest() { return std::numeric_limits<T>::max(); } - HOST DEVICE static inline T lowest() { return std::numeric_limits<T>::lowest(); } + HOST DEVICE static inline T highest() { return numeric_limits<T>::max(); } + HOST DEVICE static inline T lowest() { return numeric_limits<T>::lowest(); } // String HOST DEVICE inline void print() const { -- GitLab