Issue in building lammps-7th Aug, 19 with KOKKOS

Hi,

I think there is an issue in the compilation of lammps-7th Aug, 2019 version when building with KOKKOS package.

I am using the following command for building :

cmake -D BUILD_OMP=yes -D LAMMPS_MACHINE=mpi -D PKG_ASPHERE=yes -D PKG_MANYBODY=on -D PKG_USER-COLVARS=on -D PKG_MOLECULE=on -D PKG_KSPACE=on -D PKG_RIGID=on -D PKG_REPLICA=on -D PKG_KOKKOS=on -D KOKKOS_ARCH=“BDW;Pascal61” -D KOKKOS_ENABLE_CUDA=yes -D KOKKOS_ENABLE_OPENMP=yes -D KOKKOS_CXX_COMPILER=/home/madhur.aggarwal/lammps_kokkos_test/lammps-stable/lammps-7Aug19/lib/kokkos/bin/nvcc_wrapper …/cmake

When I run the above command (documentation says value of variable CMAKE_CXX_COMPILER should be specified, but running with that tells me to specify value of KOKKOS_CXX_COMPILER instead), I get the following error :

CMake Error at /home/madhur.aggarwal/lammps_kokkos_test/lammps-stable/lammps-7Aug19/lib/kokkos/cmake/kokkos_functions.cmake:98 (message):

Invalid compiler for CUDA. The compiler must be nvcc_wrapper or Clang, but

compiler ID was GNU

Call Stack (most recent call first):

/home/madhur.aggarwal/lammps_kokkos_test/lammps-stable/lammps-7Aug19/lib/kokkos/CMakeLists.txt:23 (set_kokkos_cxx_compiler)

– Configuring incomplete, errors occurred!

See also “/home/madhur.aggarwal/lammps_kokkos_test/lammps-stable/lammps-7Aug19/build/CMakeFiles/CMakeOutput.log”.

I do not see any error in my CMakeOutput.log file. Some lines at the start of my CMakeOutput.log file look like this:

The system is: Linux - 4.15.0-65-generic - x86_64

Compiling the CXX compiler identification source file “CMakeCXXCompilerId.cpp” succeeded.

Compiler: /usr/bin/c++

Build flags:

Id flags:

The output was:

0

Compilation of the CXX compiler identification source “CMakeCXXCompilerId.cpp” produced “a.out”

The CXX compiler identification is GNU, found in “/home/madhur.aggarwal/lammps_kokkos_test/lammps-stable/lammps-7Aug19/build/CMakeFiles/3.5.1/CompilerIdCXX/a.out”

Also, I have NVIDIA Pascal gen 6.1 GPUs, so I modified kokkos/bin/nvcc_wrapper file to make default_arch=“sm_61”.

Please let me know if anyone has any ideas to solve this issue.

Thanks,
Madhur Aggarwal

For what it’s worth, I put CMAKE_CXX_COMPILER equal to nvcc_wrapper and that way it compiles. I have not read that specific part of the documentation and don’t know if it is correct or outdated, Stan is the authority on compiling Kokkos.

Stan doesn’t use cmake and since the KOKKOS folks are rewriting cmake support for their next release, we won’t put any effort into fixing issues with it. We do test building lammps with cmake on Ubuntu 18.04LTS, if I remember correctly.
The conventional build also is definitely working on supported platforms.
Axel.

You can put CMAKE_CXX_COMPILER equal to nvcc_wrapper as Stefan said, or if you are using OpenMPI, you can set OMPI_CXX equal to nvcc_wrapper and CMAKE_CXX_COMPILER equal to mpicxx.

Stan

FYI, this works fine for me using the latest master version of LAMMPS:

cmake -D BUILD_OMP=yes -D LAMMPS_MACHINE=mpi -D PKG_ASPHERE=yes -D PKG_MANYBODY=on -D PKG_USER-COLVARS=on -D PKG_MOLECULE=on -D PKG_KSPACE=on -D PKG_RIGID=on -D PKG_REPLICA=on -D PKG_KOKKOS=on -D KOKKOS_ARCH=“Power9;Pascal60” -D KOKKOS_ENABLE_CUDA=yes -D KOKKOS_ENABLE_OPENMP=yes -D CMAKE_CXX_COMPILER= /lammps_master/lib/kokkos/bin/nvcc_wrapper …/cmake

Stan