Segfault when building with Kokkos-CUDA


I’m trying to build LAMMPS version 29 Oct 2020 with KOKKOS-CUDA and KOKKOS-OMP, and I get a segfault when compiling:

[  0%] Building CXX object lib/kokkos/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_Core.cpp.o
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/include/g++-v10/chrono: In substitution of 'template<class _Rep, class _Period> template<class _Period2> using __is_harmonic = std::__bool_constant<(std::ratio<((_Period2::num / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::num, _Period::num)) * (_Period::den / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::den, _Period::den))), ((_Period2::den / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::den, _Period::den)) * (_Period::num / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::num, _Period::num)))>::den == 1)> [with _Period2 = _Period2; _Rep = _Rep; _Period = _Period]':
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/include/g++-v10/chrono:473:154:   required from here
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/include/g++-v10/chrono:428:27: internal compiler error: Segmentation fault
428 |  _S_gcd(intmax_t __m, intmax_t __n) noexcept
    |                           ^~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <> for instructions.
make[2]: *** [lib/kokkos/core/src/CMakeFiles/kokkoscore.dir/build.make:95: lib/kokkos/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_Core.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1464: lib/kokkos/core/src/CMakeFiles/kokkoscore.dir/all] Error 2
make: *** [Makefile:149: all] Error 2

I’m using GCC 10.3.0, CUDA toolkit 11.2.67. The CmakeCache file is available in this link: CMakeCache for LAMMPS build with KOKKOS_GPU + KOKKOS-OMP that segfaults · GitHub

The error message says it may be a GCC bug, but I’d like to check if I’m not doing anthing stupid. Was this setup (compuler and nvcc versions) tested? Am I missing anything?


A compiler should not crash under any circumstances, so an internal compiler error is by definition a compiler bug.

Thanks, ALex,

I updated the GCC version in my distribution and reinstalled the CUDA Toolkit and now the build succeeds.