Open fwyzard opened 3 months ago
Maybe you need to set CUDA_CUDART
. I have only a system where the cuda driver is installed and there all is fine and compiles.
I only need to call cmake ../alpaka -DBUILD_TESTING=ON -Dalpaka_ACC_GPU_CUDA_ENABLE='ON'
all other flags for CUDA is derived automatically.
On the system we set CMAKE_PREFIX_PATH=<CUDA_PATH>:$CMAKE_PREFIX_PATH
How does alpaka use CMake to find CUDA ? Does it use FindCUDAToolkit ? Or some other way ?
OK, after some testing, it looks like setting CMAKE_PREFIX_PATH
or passing -DCUDAToolkit_ROOT='...' -DCMAKE_CUDA_COMPILER='.../bin/nvcc'
are equivalent.
What seems to break the hostOnlyAPITest
is passing -Dalpaka_DISABLE_VENDOR_RNG='ON'
.
This seems to fix the issue:
diff --git a/cmake/alpakaCommon.cmake b/cmake/alpakaCommon.cmake
index ebaad1b9a80..d4155db366e 100644
--- a/cmake/alpakaCommon.cmake
+++ b/cmake/alpakaCommon.cmake
@@ -542,9 +542,11 @@ if(alpaka_ACC_GPU_CUDA_ENABLE)
endif()
endif()
+ target_link_libraries(alpaka INTERFACE CUDA::cudart)
+
if(NOT alpaka_DISABLE_VENDOR_RNG)
# Use cuRAND random number generators
- target_link_libraries(alpaka INTERFACE CUDA::cudart CUDA::curand)
+ target_link_libraries(alpaka INTERFACE CUDA::curand)
endif()
else()
message(FATAL_ERROR "Optional alpaka dependency CUDA could not be found!")
Fixed by #2329.
How does alpaka use CMake to find CUDA ? Does it use FindCUDAToolkit ? Or some other way ?
We use native CMake CUDA language support.
I've building the alpaka tests with gcc 13 (tested also 12) and CUDA 12.5 (tested also 12.4) on Ubuntu 22.04, with
hostOnlyAPITest
fails to link withCMake tries to link only
/usr/local/cuda-12.5/targets/x86_64-linux/lib/stubs/libcuda.so
, while it should like-L/usr/local/cuda-12.5/targets/x86_64-linux/lib -L/usr/local/cuda-12.5/targets/x86_64-linux/lib/stubs -lcudart -lcuda
.It does work if I change the linker script by hand.
Am I passing the wrong flags to CMake ? Or ?