lammps/lammps

[BUG] Kokkos CMake config deprecated

clairekope opened this issue · 7 comments

Summary

I'm trying to use EasyBuild to compile LAMMPS+Kokkos for use on Grace Hopper GPUs but am seeing an error with the CMake configuration.

LAMMPS Version and Platform

LAMMPS 21Nov23 (the feature pre-release) on a Grace Hopper node running Ubuntu 22.04.3. I'm testing the installation inside a Singularity container forked from the EESSI collaboration due to constraints at my center; this image is Gentoo 2.13.

I'm using the pre-release build because of issues with Kokkos libraries when compiling the stable release 2Aug23 (solution suggested by this forum post)

Expected Behavior

EasyBuild should be able to build LAMMPS and any dependencies.

Actual Behavior

From the EasyBuild log:

-- KOKKOS: Enabling CUDA LAMBDA function support
CMake Error at /tmp/eessi-build.cu5MI8uuFJ/easybuild/build/LAMMPS/21Nov2023/foss-2021b-kokkos-CUDA-12.1.1/lammps-patch_21Nov2023/lib/kokkos/cmake/kokkos_pick_cxx_std.cmake:11 (MESSAGE):
  Setting the variable Kokkos_CXX_STANDARD in configuration is deprecated -
  set CMAKE_CXX_STANDARD directly instead

Steps to Reproduce

Issue occurs during build.
I've attached the EasyBuild config file. I've run it with eb --robot --cuda-compute-capabilities=9.0 LAMMPS-21Nov2023-foss-2021b-kokkos-CUDA-12.1.1.txt (changed from the .eb suffix for GitHub harmony)

Further Information, Files, and Links

LAMMPS-21Nov2023-foss-2021b-kokkos-CUDA-12.1.1.txt

The issue appears to be coming from this line in the attached LAMMPS-21Nov2023-foss-2021b-kokkos-CUDA-12.1.1.txtconfig file:

configopts = "-DKokkos_CXX_STANDARD=17 "

As stated in the error message, this is now deprecated by Kokkos (see kokkos/kokkos#5293). Can you try deleting this line out of your config file and see if it works? Alternatively you could change that line to -DCMAKE_CXX_STANDARD=17, but we already set CMAKE_CXX_STANDARD, see https://github.com/lammps/lammps/blob/develop/cmake/CMakeLists.txt#L148-L150 so I think it would be redundant.

A colleague more familiar with EasyBuild pointed out the same thing. Both changing the line to configopts = "-DCMAKE_CXX_STANDARD=17 " and commenting it out now returns me to the same issue I had with version 2Aug23: undefined types and built-ins in the GCC 11.2.0 library file arm_neon.h. Should we be using a newer GCC version?

@clairekope I recommend trying the newest version of gcc as I haven't had any issues compiling LAMMPS+Kokkos with, for ex, gcc 12. If it's available, you could also try using a new version clang++ as your host compiler via modifying the top of [lammps]/lib/kokkos/bin/nvcc_wrapper... but I'll admit I haven't tried that myself.

I've never used EasyBuild, so I can't comment on any possible further issues related to that...

I appreciate the suggestions!

@clairekope another thing to try if gcc 12 still fails is updating to the latest version of Kokkos, past v4.2 bundled in LAMMPS to the pre-release develop branch: https://github.com/kokkos/kokkos/tree/develop. Grace Hopper is fairly new so it is possible some of the latest changes in the Kokkos library could help too. One way to do this is:

cd [lammps]/lib
rm -rf kokkos
git clone https://github.com/kokkos/kokkos.git
git checkout develop

You may also be able to specify the path to an external Kokkos download in CMake instead but I haven't tried it.

@clairekope FYI we made a new LAMMPS feature release yesterday (7 Feb 2024).

The last few discussion items suggest that this is not really a LAMMPS issue but rather something external (compiler, kokkos, OR, easybuild). This means that from the LAMMPS side we cannot do anything about it and thus this issue can be closed.

Please advise.

I agree; this is definitely a problem with something external and this issue can be closed. Thank you all for your advice!