Building LAMMPS for Nvidia GraceHopper nodes

I am trying to build LAMMPS with Kokkos for HOPPER90. However, I am running compilation errors, with nvc as well as with gcc.

With g++13.1.0 I am getting the error:

  extern _Float32 modff32 (_Float32 __x, _Float32 *__iptr) noexcept (true); extern _Float32 __modff32 (_Float32 __x, _Float32 *__iptr) noexcept (true) __attribute__ ((__nonnull__ (2)));
                                                                                                       
Error limit reached.
100 errors detected in the compilation of "/home/gjost/LAMMPS/lammps/lib/kokkos/core/src/impl/Kokkos_CPUDiscovery.cpp".

With nvc++ 23.7.0 I am getting the error:

"/home/gjost/LAMMPS/lammps/lib/kokkos/core/src/../../tpls/desul/include/desul/atomics/CUDA.hpp", line 522: error: function "desul::atomic_fetch_max(long *, long, desul::MemoryOrderRelaxed, desul::MemoryScopeDevice)" has already been defined
  __device__ inline long atomic_fetch_max(long* const dest,
                         ^

"/home/gjost/LAMMPS/lammps/lib/kokkos/core/src/../../tpls/desul/include/desul/atomics/CUDA.hpp", line 529: error: function "desul::atomic_fetch_min(long *, long, desul::MemoryOrderRelaxed, desul::MemoryScopeDevice)" has already been defined
  __device__ inline long atomic_fetch_min(long* const dest,
                         ^

For MPI I am using the OpenMP that comes with nvhpc/23.7.
Is there a recommended compiler/version that I should be using for the LAMMPS GraceHopper build?
I using the following LAMMPS commit:
commit ce756540e8615b6f7c1c1242695172b502834b19

Thanks in advance and greetings, Gabriele

To the best of my knowledge, both the nvidia CUDA compiler (nvcc) and the Nvidia HPC compiler (formerly PGI compiler) need a compatible GCC “underneath” since they masquerade as a GCC compiler to use their header files and then have compatibility “magic” for GCC constructs that they cannot handle. However, those need to be updated with every GCC (major) release.

So I suspect GCC 13 is too new for either compiler.

What CUDA version? It should work with nvcc + gcc. The max GCC version depends on the CUDA version.

Also it looks like that commit is using Kokkos v3.7 instead of 4.1, you definitely want to update to use Kokkos 4 for Hopper

Stan, only saw your response just now. Can you recommend a commit I should be using. I am here:
"'gjost@sj-cg4-01:~/LAMMPS/lammps$ git branch -a

  • stable
    remotes/origin/HEAD → origin/develop
    remotes/origin/compute-fix-variable-outputs
    remotes/origin/coulomb-refactoring
    remotes/origin/develop
    remotes/origin/fix-rigid-enforce2d
    remotes/origin/maintenance
    remotes/origin/nwchem
    remotes/origin/release
    remotes/origin/stable
    remotes/origin/subversion
    remotes/origin/triclinic-neighbor-bug
    gjost@sj-cg4-01:~/LAMMPS/lammps$ git log
    commit ce756540e8615b6f7c1c1242695172b502834b19 (HEAD → stable, tag: stable_2Aug2023_update1, tag: patch_2Aug2023_update1, tag: lammps-gui-v1.2, origin/stable)
    Author: Axel Kohlmeyer [email protected]
    Date: Fri Sep 22 07:51:58 2023 -0400
    ‘’’
    How can I switch to a branch that has Kokkos 4?
    Many thanks and sorry for the late response.
    Gabriele

Also, I tried adding
‘’‘-DKokkos_ENABLE_DESUL_ATOMICS_EXTERNAL=on ‘’’
but that runs into configuration errors.
I think I am using cuda 12.2

Can you try origin/develop? It should be up to date.