Full error output: cuda-glibc-2.41-cmake-errors.txt · GitHub
These trigonometric functions are new additions to Glibc’s math headers: https://www.phoronix.com/news/Glibc-2.41-More-C23
Full error output: cuda-glibc-2.41-cmake-errors.txt · GitHub
These trigonometric functions are new additions to Glibc’s math headers: https://www.phoronix.com/news/Glibc-2.41-More-C23
glibc 2.41 is not supported for any version of CUDA at the moment. (e.g. CUDA 12.8)
For the record, this naive patch fixes my problem on Gentoo ~amd64 (where downgrading glibc is not possible):
diff '--color=auto' -ur builds.orig/cuda_nvcc/targets/x86_64-linux/include/crt/math_functions.h builds/cuda_nvcc/targets/x86_64-linux/include/crt/math_functions.h
--- a/builds.orig/cuda_nvcc/targets/x86_64-linux/include/crt/math_functions.h 2024-08-23 00:25:39.000000000 +0200
+++ b/builds/cuda_nvcc/targets/x86_64-linux/include/crt/math_functions.h 2025-02-17 01:19:44.270292640 +0100
@@ -2547,7 +2547,7 @@
*
* \note_accuracy_double
*/
-extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double sinpi(double x);
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double sinpi(double x) noexcept (true);
/**
* \ingroup CUDA_MATH_SINGLE
* \brief Calculate the sine of the input argument
@@ -2570,7 +2570,7 @@
*
* \note_accuracy_single
*/
-extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float sinpif(float x);
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float sinpif(float x) noexcept (true);
/**
* \ingroup CUDA_MATH_DOUBLE
* \brief Calculate the cosine of the input argument
@@ -2592,7 +2592,7 @@
*
* \note_accuracy_double
*/
-extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double cospi(double x);
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double cospi(double x) noexcept (true);
/**
* \ingroup CUDA_MATH_SINGLE
* \brief Calculate the cosine of the input argument
@@ -2614,7 +2614,7 @@
*
* \note_accuracy_single
*/
-extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float cospif(float x);
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float cospif(float x) noexcept (true);
/**
* \ingroup CUDA_MATH_DOUBLE
* \brief Calculate the sine and cosine of the first input argument
Tested with both CUDA 12.6.1 and 12.8.0 .
The patch from stefan works for me. Looks like CUDAs headers have a literal bug, where the extern definition doesn’t match the actual function definition. His patch just makes them match. NVIDIA should probably make this change official in every architecture variant of math_functions.h.
Hello,
I confirm the problem with Ubuntu 25.04! The compilation of my program fails as soon as the cmake. After modifying /usr/local/cuda-12.8/targets/x86_64-linux/include/crt/math_functions.h everything works again!
I found this post right after after asking the same question on StackOverflow (and right after hitting the same problem on my machine). I adapted the patch slightly - changing the a/ and b/ parts not to assume the same directory structure. Also gave you credit.
I work with Fedora 42, clang 18.1.8, CUDA 12.8. For me, I needed to add some noexcepts to math_functions.hpp as well for CUDA compilation to work.
This worked for me too on Fedora 42 , nvcc version Build cuda_12.9.r12.9/compiler.35813241_0
The workarounds involved
Installing the Fedora 41 version of the CUDA toolkit (this mostly worked)
Install the gcc14 “sudo dnf5 install gcc14 gcc14-c++”
Edit the file
/usr/local/cuda-12.9/targets/x86_64-linux/include/crt/math_functions.h as described in the patch, which is essentially adding “noexcept (true)” for those specific files
Set “export NVCC_CCBIN=/usr/bin/g+±14” before running cmake
Hope this helps
i ran this: sudo cmake .. -DGMX_GPU=CUDA -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g+±11 -DGMX_BUILD_OWN=ON -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda
– The C compiler identification is GNU 11.5.0
– The CXX compiler identification is GNU 11.5.0
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: /usr/bin/gcc-11 - skipped
– Detecting C compile features – Detecting C compile features - done
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: /usr/bin/g+±11 - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– Found Python3: /usr/bin/python3 (found suitable version “3.12.3”, minimum required is “3.9”) found components: Interpreter Development Development.Module Development.Embed
– Selected GPU FFT library - cuFFT
– Found OpenMP_C: -fopenmp (found version “4.5”)
– Found OpenMP_CXX: -fopenmp (found version “4.5”)
– Found OpenMP: TRUE (found version “4.5”) – Performing Test
CFLAGS_WARN_NO_MISSING_FIELD_INITIALIZERS – Performing Test
CFLAGS_WARN_NO_MISSING_FIELD_INITIALIZERS - Success – Performing Test
CFLAGS_EXCESS_PREC – Performing Test CFLAGS_EXCESS_PREC - Success
– Performing Test CFLAGS_COPT – Performing Test CFLAGS_COPT - Success
– Performing Test CFLAGS_NOINLINE – Performing Test CFLAGS_NOINLINE - Success
– Performing Test CXXFLAGS_WARN_NO_MISSING_FIELD_INITIALIZERS
– Performing Test CXXFLAGS_WARN_NO_MISSING_FIELD_INITIALIZERS - Success
– Performing Test CXXFLAGS_EXCESS_PREC
– Performing Test CXXFLAGS_EXCESS_PREC - Success
– Performing Test CXXFLAGS_COPT – Performing Test CXXFLAGS_COPT - Success
– Performing Test CXXFLAGS_NOINLINE
– Performing Test CXXFLAGS_NOINLINE - Success
– Looking for include file unistd.h
– Looking for include file unistd.h - found
– Looking for include file pwd.h
– Looking for include file pwd.h - found
– Looking for include file dirent.h – Looking for include file dirent.h - found – Looking for include file time.h – Looking for include file time.h - found – Looking for include file sys/time.h – Looking for include file sys/time.h - found – Looking for include file io.h – Looking for include file io.h - not found – Looking for include file sched.h – Looking for include file sched.h - found – Looking for include file xmmintrin.h – Looking for include file xmmintrin.h - found – Looking for gettimeofday – Looking for gettimeofday - found – Looking for sysconf – Looking for sysconf - found – Looking for nice – Looking for nice - found – Looking for fsync – Looking for fsync - found – Looking for _fileno – Looking for _fileno - not found – Looking for fileno – Looking for fileno - found – Looking for _commit – Looking for _commit - not found – Looking for sigaction – Looking for sigaction - found – Performing Test HAVE_BUILTIN_CLZ – Performing Test HAVE_BUILTIN_CLZ - Success – Performing Test HAVE_BUILTIN_CLZLL – Performing Test HAVE_BUILTIN_CLZLL - Success – Looking for clock_gettime in rt – Looking for clock_gettime in rt - found – Looking for feenableexcept in m – Looking for feenableexcept in m - found – Looking for fedisableexcept in m – Looking for fedisableexcept in m - found – Checking for sched.h GNU affinity API – Performing Test sched_affinity_compile – Performing Test sched_affinity_compile - Success – Looking for include file mm_malloc.h – Looking for include file mm_malloc.h - found – Looking for include file malloc.h – Looking for include file malloc.h - found – Checking for _mm_malloc() – Checking for _mm_malloc() - supported – Looking for posix_memalign – Looking for posix_memalign - found – Looking for memalign – Looking for memalign - not found – Torch not found. Neural network potential support will be disabled. – Using default binary suffix: “” – Using default library suffix: “” – Performing Test CMAKE_HAVE_LIBC_PTHREAD – Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success – Found Threads: TRUE – Looking for C++ include pthread.h – Looking for C++ include pthread.h - found – Performing Test TEST_ATOMICS – Performing Test TEST_ATOMICS - Success – Atomic operations found – Performing Test PTHREAD_SETAFFINITY – Performing Test PTHREAD_SETAFFINITY - Success – Detecting best SIMD instructions for this CPU – Checking for GCC x86 inline asm – Checking for GCC x86 inline asm - supported – Detected build CPU features - aes apic avx avx2 avx512f avx512cd avx512bw avx512vl avx512secondFMA clfsh cmov cx8 cx16 f16c fma htt intel lahf mmx msr nonstop_tsc pcid pclmuldq pdcm pdpe1gb popcnt pse rdrnd rdtscp sha sse2 sse3 sse4.1 sse4.2 ssse3 tdt x2apic
– Detected build CPU brand - 11th Gen Intel(R) Core™ i7-11850H @ 2.50GHz
– Performing Test C_march_skylake_avx512_FLAG_ACCEPTED
– Performing Test C_march_skylake_avx512_FLAG_ACCEPTED - Success
– Performing Test C_march_skylake_avx512_COMPILE_WORKS
– Performing Test C_march_skylake_avx512_COMPILE_WORKS - Success
– Performing Test CXX_march_skylake_avx512_FLAG_ACCEPTED
– Performing Test CXX_march_skylake_avx512_FLAG_ACCEPTED - Success
– Performing Test CXX_march_skylake_avx512_COMPILE_WORKS
– Performing Test CXX_march_skylake_avx512_COMPILE_WORKS - Success
– This is an Intel CPU with only 1 AVX-512 FMA unit, so AVX2 will be faster. – Detected best SIMD instructions for this CPU - AVX2_256 – Performing Test C_mavx2_mfma_FLAG_ACCEPTED
– Performing Test C_mavx2_mfma_FLAG_ACCEPTED - Success
– Performing Test C_mavx2_mfma_COMPILE_WORKS
– Performing Test C_mavx2_mfma_COMPILE_WORKS - Success
– Performing Test CXX_mavx2_mfma_FLAG_ACCEPTED
– Performing Test CXX_mavx2_mfma_FLAG_ACCEPTED - Success – Performing Test CXX_mavx2_mfma_COMPILE_WORKS
– Performing Test CXX_mavx2_mfma_COMPILE_WORKS - Success – Enabling 256-bit AVX2 SIMD instructions using CXX flags: -mavx2 -mfma
– Performing Test _Wno_unused_command_line_argument_FLAG_ACCEPTED
– Performing Test _Wno_unused_command_line_argument_FLAG_ACCEPTED - Success
– Performing Test _callconv___vectorcall – Performing Test _callconv___vectorcall - Failed
– Performing Test _callconv___regcall – Performing Test _callconv___regcall - Failed
– Performing Test callconv – Performing Test callconv - Success
CMake Error at /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find CUDAToolkit: Found unsuitable version “12.0.140”, but required is at least “12.1” (found /usr/include) Call Stack (most recent call first): /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:598 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake-3.28/Modules/FindCUDAToolkit.cmake:1009 (find_package_handle_standard_args) cmake/gmxManageCuda.cmake:45 (find_package) CMakeLists.txt:726 (include)
Please how can I solve this Cmake error
When I ran nvidia-smi, it showed 12.8. So I installed the CUDAToolKit-12.8 but it is not showing when I run the cmake command
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2025 NVIDIA Corporation
Built on Fri_Feb_21_20:23:50_PST_2025
Cuda compilation tools, release 12.8, V12.8.93
Build cuda_12.8.r12.8/compiler.35583870_0
This works. Thanks!