Re: [AMBER] compiling Amber24 with gcc 14.2.1/cuda 12.4.1

From: Vlad Cojocaru via AMBER <amber.ambermd.org>
Date: Sun, 30 Mar 2025 13:58:31 +0300

Okay, this seems to be related with an incompatibility between CUDA
(12,4, 12.6, 12.8) and the Glibc 2.41 (which comes on openSUSE
Tumbleweed). The problem seems to be solved with a rather simple patch
(see below).

Modify the function declarations for cospi, sinpi, cospif, and sinpif in
the CUDA installation:
$CUDA_ROOT/targets/x86_64-linux/include/crt/math_functions.h

With this and with python3.11 (pytraj does not build with python3.13)
the updated Amber24 builds correctly on openSUSE Tumbleweed with GCC
13.3.1 and CUDA 12.4.1 (GLIBC 2.41)

Cheers
Vlad


********************** patch **************************
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



On 3/30/25 10:57 AM, Vlad Cojocaru via AMBER wrote:
> Dear David, Dear all,
>
> Thanks a lot for the detailed answer. Yes, sure, I can try to build
> the new PMEMD with gcc 14 and cuda 12.8. Please feel welcome to share
> the code when you feel its ripped (best is to use my current email
> address "vlad.cojocaru.ubbcluj.ro" )
>
> On a different note, you mentioned the incompatibility between GCC 14
> and CUDA 12.4. However, I did manage to install both CUDA 12.4 and
> 12.8 with GCC 14.2.1 with no issues.
>
> Regarding the current installation, I am still struggling, this time
> with cpptraj. Now, I reverted back to gcc 13 with cuda 12.4. However,
> I am running into different issues now (see below). These issues were
> not there when I first installed Amber24 with this compiler and cuda.
> I tried to go into the CPPTRAJ code but did not find any hint
>
> Best wishes
> Vlad
>
>
> [ 15%] Building CXX object
> AmberTools/src/cpptraj/src/CMakeFiles/cpptraj_core.dir/Matrix_3x3.cpp.o
> make[2]: ***
> [AmberTools/src/cpptraj/src/cuda_kernels/CMakeFiles/cpptraj_cuda_routines.dir/build.make:84:
> AmberTools/src/cpptraj/src/cuda_kernels/CMakeFiles/cpptraj_cuda_routines.dir/cpptraj_cuda_routines_generated_kernel_wrappers.cu.o]
> Error 1
> make[2]: *** Waiting for unfinished jobs....
> [ 15%] Building CXX object
> AmberTools/src/cpptraj/src/CMakeFiles/cpptraj_common_obj_cuda.dir/ActionTopWriter.cpp.o
> [ 15%] Building CXX object
> AmberTools/src/cpptraj/src/CMakeFiles/cpptraj_common_obj.dir/Action_Bounds.cpp.o
> /usr/include/bits/mathcalls.h(79): error: exception specification is
> incompatible with that of previous function "cospi" (declared at line
> 5554 of /apps/nvidia/cuda/12.4.1_gnu-13.3.1/include/crt/math_functions.h)
>    extern double cospi (double __x) noexcept (true); extern double
> __cospi (double __x) noexcept (true);
>                                     ^
>
> /usr/include/bits/mathcalls.h(81): error: exception specification is
> incompatible with that of previous function "sinpi" (declared at line
> 5442 of /apps/nvidia/cuda/12.4.1_gnu-13.3.1/include/crt/math_functions.h)
>    extern double sinpi (double __x) noexcept (true); extern double
> __sinpi (double __x) noexcept (true);
>                                     ^
>
> /usr/include/bits/mathcalls.h(79): error: exception specification is
> incompatible with that of previous function "cospif" (declared at line
> 5606 of /apps/nvidia/cuda/12.4.1_gnu-13.3.1/include/crt/math_functions.h)
>    extern float cospif (float __x) noexcept (true); extern float
> __cospif (float __x) noexcept (true);
>                                    ^
>
> /usr/include/bits/mathcalls.h(81): error: exception specification is
> incompatible with that of previous function "sinpif" (declared at line
> 5502 of /apps/nvidia/cuda/12.4.1_gnu-13.3.1/include/crt/math_functions.h)
>    extern float sinpif (float __x) noexcept (true); extern float
> __sinpif (float __x) noexcept (true);
>                                    ^
>
> 4 errors detected in the compilation of
> "/apps/amber/24_tools-24_cuda-12.4.1_openmpi-5.0.3_gnu-13.3.1/AmberTools/src/cpptraj/src/cuda_kernels/GistCudaCalc.cu".
> CMake Error at
> cpptraj_cuda_routines_generated_GistCudaCalc.cu.o.RELEASE.cmake:278
> (message):
>   Error generating file
> /apps/amber/24_tools-24_cuda-12.4.1_openmpi-5.0.3_gnu-13.3.1/build/AmberTools/src/cpptraj/src/cuda_kernels/CMakeFiles/cpptraj_cuda_routines.dir//./cpptraj_cuda_routines_generated_GistCudaCalc.cu.o
>
>
>
> make[2]: ***
> [AmberTools/src/cpptraj/src/cuda_kernels/CMakeFiles/cpptraj_cuda_routines.dir/build.make:91:
> AmberTools/src/cpptraj/src/cuda_kernels/CMakeFiles/cpptraj_cuda_routines.dir/cpptraj_cuda_routines_generated_GistCudaCalc.cu.o]
> Error 1
>
> On 3/29/25 11:54 PM, David A Case wrote:
>> On Sat, Mar 29, 2025, Vlad Cojocaru via AMBER wrote:
>>>
>>> I have now updated the OS on our machines (to latest openSUSE
>>> Tumbleweed snapshot) and I am trying to update the AMBER 24
>>> installation as well. I am using gcc 14.2.1, Cuda 12.4.1, openmpi
>>> 5.0.7.
>>
>>> However I get the error below which is related to "Quick". I tried
>>> to disable Quick (with -DDISABLE_TOOL="quick" in run_cmake) but then
>>> I get some dependency issue for sander (missing libquick). I should
>>> say that I have built Amber 24 successfully with gcc 13.2.1 before.
>>
>> Simplest: install gcc 13.2 and use "alternatives" (or create soft-links,
>> depends on your distro) to have version 13.2 temporarily first in
>> your PATH.
>> Parts of Amber are just not ready for gcc14 (as you have found out.)
>>
>> I think(!) the only part of the current Amber that objects to gcc14
>> is the
>> CUDA part of Quick.  (Based on developer reports--I've not tried this
>> myself.)  But the main "point" of Quick is its GPU capability, and I
>> don't
>> know what is involved in getting gcc14 compatibility.  (It sort of looks
>> like a header failure from the error messages, but I'm really just
>> guessing.)  We'll try to get the Quick problem resolved, and maybe
>> someone
>> on the list will have better knowledge than I have.  But right now, I
>> don't
>> know when that will happen.
>>
>> One thought: coming in the next release: Amber (essentially pmemd)
>> will be
>> fully separated from AmberTools.  For people who mainly want pmemd.cuda,
>> this will allow a much simpler build of that, without exposure to any
>> limitations in the much more complex AmberTools code.
>> If you would like to test this, let me know, and I'll point you to the
>> code, which is now in a near-final release stage.  (This would also
>> help us
>> get testing on gcc14 as well as on OpenSUSE, which is less commonly-used
>> in the US.)  But it's up to you: the straightforward path is to
>> enable an
>> earlier version of the GNU compiler suite; that might prove useful
>> for other
>> software as well.
>>
>> ...thanks for the report....dac
>>
>

-- 
Dr. Vlad Cojocaru (PD, Habil.)
----------------------------------------------
Guest Scientist / Fmr. Project Group Leader
Max Planck Institute for Molecular Biomedicine
Röntgenstrasse 20, 48149 Münster, Germany
----------------------------------------------
Email: vlad.cojocaru.mpi-muenster.mpg.de
http://www.mpi-muenster.mpg.de/43241/cojocaru
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Sun Mar 30 2025 - 04:30:03 PDT
Custom Search