exasim-project / NeoFOAM

WIP Prototype of a modern CFD core
19 stars 1 forks source link

fix: neofoam compiles with cuda support and gcc #50

Closed HenningScheufler closed 2 months ago

HenningScheufler commented 2 months ago

The CPM package manger seems not to include the nvcc_wrapper of the kokkos project which is required for the compilation with gcc

This can be resolved by using fetch content instead of CPM (see changed files)

However, changing the compiler to clang by executing following command:

cmake  --preset ninja-kokkos-cuda-all -DCMAKE_C_COMPILER=clang-15 -DCMAKE_CXX_COMPILER=clang++-15

correctly configures the projects but the compilation fails with following error

/usr/bin/clang++-15 -DKOKKOS_DEPENDENCE -I/home/henning/libsAndApps/NeoFOAM/build/ReleaseCudaAll/_deps/kokkos-build/core/src -I/home/henning/libsAndApps/NeoFOAM/build/ReleaseCudaAll/_deps/kokkos-src/core/src -I/home/henning/libsAndApps/NeoFOAM/build/ReleaseCudaAll/_deps/kokkos-build -I/home/henning/libsAndApps/NeoFOAM/build/ReleaseCudaAll/_deps/kokkos-src/core/src/../../tpls/desul/include -isystem /usr/local/cuda/include -O3 -DNDEBUG -x cuda --cuda-gpu-arch=sm_89 -fopenmp=libomp -std=c++20 -MD -MT _deps/kokkos-build/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_hwloc.cpp.o -MF _deps/kokkos-build/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_hwloc.cpp.o.d -o _deps/kokkos-build/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_hwloc.cpp.o -c /home/henning/libsAndApps/NeoFOAM/build/ReleaseCudaAll/_deps/kokkos-src/core/src/impl/Kokkos_hwloc.cpp
clang: warning: CUDA version is newer than the latest supported version 11.5 [-Wunknown-cuda-version]
clang: error: unsupported CUDA gpu architecture: sm_89
greole commented 2 months ago

That is weird. CPM shouldn't change the way how the dependency is handled. Do you have kokkos installed separately somehow and CPM picks it up? What happens if you set CPM_USE_LOCAL_PACKAGES OFF?

greole commented 2 months ago

I think this discussion is related https://github.com/cpm-cmake/CPM.cmake/issues/132

HenningScheufler commented 2 months ago

Can we merge this PR? Improving the build setup can be done later