diff --git a/dlib/CMakeLists.txt b/dlib/CMakeLists.txt index 0da187531..38ff302e8 100644 --- a/dlib/CMakeLists.txt +++ b/dlib/CMakeLists.txt @@ -633,14 +633,6 @@ if (NOT TARGET dlib) endif() endif() - if (CUDA_VERSION VERSION_LESS 10.3) - # To avoid this error from nvcc: - # error: calling a constexpr __host__ function("log1p") from a __device__ function("cuda_log1pexp") - # is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. - # which is a bug in nvcc in this version of cuda. - list(APPEND FLAGS_FOR_NVCC "--expt-relaxed-constexpr") - endif() - set(CUDA_HOST_COMPILATION_CPP ON) # Note that we add __STRICT_ANSI__ to avoid freaking out nvcc with gcc specific # magic in the standard C++ header files (since nvcc uses gcc headers on diff --git a/dlib/cuda/cuda_dlib.cu b/dlib/cuda/cuda_dlib.cu index b4a34024f..9d0a6cf24 100644 --- a/dlib/cuda/cuda_dlib.cu +++ b/dlib/cuda/cuda_dlib.cu @@ -1759,9 +1759,9 @@ namespace dlib if (x <= -18) return std::exp(x); else if (-18 < x && x <= 9) - return std::log1p(std::exp(x)); + return std::log1pf(std::exp(x)); else if (9 < x && x <= 16) - return x + std::exp(-x); + return x + expf(-x); else return x; }