Describe the bug
When compiling with a non-standard Eigen location and GPU kernels, the code does not find Eigen properly
Expected behavior
Find Eigen in non-standard location
Reproduction steps
put eigen somewhere that is not included by default, run cmake with GPU kernel, compile.
Logfile
(openssl-3.2.1) eeitan@powerslurm-login:/gcohenlabstorage/eeitan/src/gw_emanuel_group/green-mbpt/build_gpu_powerslurm-login$ cmake -DCMAKE_BUILD_TYPE=Release -DCUSTOM_KERNEL=GPU_KERNEL -DGREEN_KERNEL_URL="https://github.com/Green-Phys/green-gpu" -DGREEN_CUSTOM_KERNEL_LIB="GREEN::GPU" -DGREEN_CUSTOM_KERNEL_ENUM=GPU -DGREEN_CUSTOM_KERNEL_HEADER="<green/gpu/gpu_factory.h>" -DCMAKE_INSTALL_PREFIX=/gcohenlabstorage/eeitan/src/gw_emanuel_group/green-mbpt/install_gpu -DBLAS_LIBRARIES=/powerapps/src/OpenBlas/lib/libopenblas.so ../.
-- The C compiler identification is GNU 12.1.0
-- The CXX compiler identification is GNU 12.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /powerapps/share/openmpi-4.1.4-gnu/bin/mpicc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /powerapps/share/openmpi-4.1.4-gnu/bin/mpic++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found BLAS: /powerapps/src/OpenBlas/lib/libopenblas.so
INFO Using OpenBLAS
-- Found HDF5: /powerapps/share/rocky8/hdf5-1.14-1.2-gcc/lib/libhdf5.so;/usr/lib64/libz.so;/usr/lib64/libdl.so;/usr/lib64/libm.so (found version "1.14.1-2") found components: C HL
-- Performing Test HAVE_FLAGffile_prefix_mapgcohenlabstorage_eeitan_src_gw_emanuel_group_green_mbpt_build_gpu_powerslurm_logindeps_catch2_src
-- Performing Test HAVE_FLAGffile_prefix_mapgcohenlabstorage_eeitan_src_gw_emanuel_group_green_mbpt_build_gpu_powerslurm_logindeps_catch2_src - Success
INFO Using OpenBLAS
INFO Using OpenBLAS
-- Found MPI_C: /powerapps/share/openmpi-4.1.4-gnu/bin/mpicc (found version "3.1")
-- Found MPI_CXX: /powerapps/share/openmpi-4.1.4-gnu/bin/mpic++ (found version "3.1")
-- Found MPI: TRUE (found version "3.1") found components: C CXX
INFO Using OpenBLAS
Adding kernel GPU_KERNEL https://github.com/Green-Phys/green-gpu
-- Found CUDAToolkit: /powerapps/share/centos7/cuda-12.1/include (found version "12.1.66")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- The CUDA compiler identification is NVIDIA 12.1.66
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /powerapps/share/centos7/cuda-12.1/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- GPU_ARCHS is not defined. Generating CUDA code for default SMs: 70;75;80;86;90
-- Configuring done (62.0s)
-- Generating done (1.5s)
-- Build files have been written to: /gcohenlabstorage/eeitan/src/gw_emanuel_group/green-mbpt/build_gpu_powerslurm-login
(openssl-3.2.1) eeitan@powerslurm-login:/gcohenlabstorage/eeitan/src/gw_emanuel_group/green-mbpt/build_gpu_powerslurm-login$ make -j 1
[ 0%] Building CXX object _deps/green-utils-build/src/CMakeFiles/utils.dir/mpi_utils.cpp.o
[ 1%] Linking CXX static library libutils.a
[ 1%] Built target utils
[ 1%] Building CUDA object _deps/gpu_kernel-build/src/CMakeFiles/accel-lib.dir/cuda_common.cu.o
[ 2%] Building CXX object _deps/gpu_kernel-build/src/CMakeFiles/accel-lib.dir/cuda_check.cpp.o
[ 3%] Building CUDA object _deps/gpu_kernel-build/src/CMakeFiles/accel-lib.dir/cublas_routines_prec.cu.o
[ 3%] Building CUDA object _deps/gpu_kernel-build/src/CMakeFiles/accel-lib.dir/cu_compute_Pq.cu.o
In file included from /gcohenlabstorage/eeitan/src/gw_emanuel_group/green-mbpt/build_gpu_powerslurm-login/_deps/gpu_kernel-src/src/./green/gpu/cugw_qpt.h:29,
from /gcohenlabstorage/eeitan/src/gw_emanuel_group/green-mbpt/build_gpu_powerslurm-login/_deps/gpu_kernel-src/src/cu_compute_Pq.cu:22:
/gcohenlabstorage/eeitan/src/gw_emanuel_group/green-mbpt/build_gpu_powerslurm-login/_deps/gpu_kernel-src/src/./green/gpu/common_defs.h:28:10: fatal error: Eigen/Core: No such file or directory
28 | #include <Eigen/Core>
| ^~~~
compilation terminated.
make[2]: [_deps/gpu_kernel-build/src/CMakeFiles/accel-lib.dir/build.make:121: _deps/gpu_kernel-build/src/CMakeFiles/accel-lib.dir/cu_compute_Pq.cu.o] Error 1
make[1]: [CMakeFiles/Makefile2:1855: _deps/gpu_kernel-build/src/CMakeFiles/accel-lib.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
(openssl-3.2.1) eeitan@powerslurm-login:/gcohenlabstorage/eeitan/src/gw_emanuel_group/green-mbpt/build_gpu_powerslurm-login$
Platform (please complete the following information):
Linux
Additional context
Here is a proposed fix for it: change the CMakeLists.txt in src of GPU kernel sources to:
project(gpu-lib CXX)
find_package(Eigen3 REQUIRED)
add_library(accel-lib cuda_common.cu cuda_check.cpp cublas_routines_prec.cu
cu_compute_Pq.cu cugw_qpt.cucu_routines.cu )
set_property(TARGET accel-lib PROPERTY CUDA_ARCHITECTURES ${GPU_ARCHS}) #also check the same parameters in solvers
target_include_directories(accel-lib PUBLIC .)
target_link_libraries(accel-lib CUDA::cudart CUDA::cuda_driver CUDA::cublas CUDA::cusolver)
target_link_libraries(accel-lib GREEN::UTILS GREEN::NDARRAY)
target_link_libraries(accel-lib Eigen3::Eigen)
Describe the bug When compiling with a non-standard Eigen location and GPU kernels, the code does not find Eigen properly
Expected behavior Find Eigen in non-standard location
Reproduction steps put eigen somewhere that is not included by default, run cmake with GPU kernel, compile.
Logfile
Platform (please complete the following information): Linux
Additional context Here is a proposed fix for it: change the CMakeLists.txt in src of GPU kernel sources to:
project(gpu-lib CXX)
find_package(Eigen3 REQUIRED)
add_library(accel-lib cuda_common.cu cuda_check.cpp cublas_routines_prec.cu cu_compute_Pq.cu cugw_qpt.cu cu_routines.cu ) set_property(TARGET accel-lib PROPERTY CUDA_ARCHITECTURES ${GPU_ARCHS}) #also check the same parameters in solvers target_include_directories(accel-lib PUBLIC .) target_link_libraries(accel-lib CUDA::cudart CUDA::cuda_driver CUDA::cublas CUDA::cusolver) target_link_libraries(accel-lib GREEN::UTILS GREEN::NDARRAY) target_link_libraries(accel-lib Eigen3::Eigen)
add_library(gpu gpu_kernel.cpp hf_gpu_kernel.cpp gw_gpu_kernel.cpp) target_include_directories(gpu PUBLIC .) target_link_libraries(gpu CUDA::cudart CUDA::cuda_driver CUDA::cublas CUDA::cusolver) target_link_libraries(gpu accel-lib) target_link_libraries(gpu GREEN::UTILS GREEN::NDARRAY GREEN::SYMMETRY GREEN::GRIDS GREEN::PARAMS) set_property(TARGET gpu PROPERTY CUDA_ARCHITECTURES ${GPU_ARCHS}) #also check same parameters in accel