Skip to content

Commit

Permalink
Validate CMake version for CUDA on clang
Browse files Browse the repository at this point in the history
  • Loading branch information
tom91136 committed Apr 16, 2024
1 parent cf5ad17 commit fdba8f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/ci-test-compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,13 @@ build_clang() {
echo "Skipping RAJA models due to CMake version requirement"
fi

run_build $name "${CLANG_CXX:?}" cuda "$cxx -DCMAKE_CUDA_COMPILER=${CLANG_CXX:?} -DCUDA_ARCH=$NV_ARCH -DCUDA_CLANG_DRIVER=ON"
run_build $name "${CLANG_CXX:?}" cuda "$cxx -DCMAKE_CUDA_COMPILER=${CLANG_CXX:?} -DCUDA_ARCH=$NV_ARCH -DCUDA_CLANG_DRIVER=ON -DMEM=MANAGED"
run_build $name "${CLANG_CXX:?}" cuda "$cxx -DCMAKE_CUDA_COMPILER=${CLANG_CXX:?} -DCUDA_ARCH=$NV_ARCH -DCUDA_CLANG_DRIVER=ON -DMEM=PAGEFAULT"
if check_cmake_ver "3.18.0"; then
run_build $name "${CLANG_CXX:?}" cuda "$cxx -DCMAKE_CUDA_COMPILER=${CLANG_CXX:?} -DCUDA_ARCH=$NV_ARCH -DCUDA_CLANG_DRIVER=ON"
run_build $name "${CLANG_CXX:?}" cuda "$cxx -DCMAKE_CUDA_COMPILER=${CLANG_CXX:?} -DCUDA_ARCH=$NV_ARCH -DCUDA_CLANG_DRIVER=ON -DMEM=MANAGED"
run_build $name "${CLANG_CXX:?}" cuda "$cxx -DCMAKE_CUDA_COMPILER=${CLANG_CXX:?} -DCUDA_ARCH=$NV_ARCH -DCUDA_CLANG_DRIVER=ON -DMEM=PAGEFAULT"
else
echo "Skipping CUDA on clang models due to CMake version requirement"
fi

run_build $name "${CLANG_CXX:?}" cuda "$cxx -DCMAKE_CUDA_COMPILER=${NVHPC_NVCC:?} -DCUDA_ARCH=$NV_ARCH"
run_build $name "${CLANG_CXX:?}" cuda "$cxx -DCMAKE_CUDA_COMPILER=${NVHPC_NVCC:?} -DCUDA_ARCH=$NV_ARCH -DMEM=MANAGED"
Expand Down
3 changes: 3 additions & 0 deletions src/cuda/model.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ macro(setup)
register_definitions(${MEM})

if (CUDA_CLANG_DRIVER)
if (CMAKE_VERSION VERSION_LESS "3.18.0")
message(FATAL_ERROR "Using clang driver for CUDA is only supported for CMake >= 3.18")
endif ()
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -std=c++17 --cuda-gpu-arch=${CUDA_ARCH} ${CUDA_EXTRA_FLAGS}")
else ()
# add -forward-unknown-to-host-compiler for compatibility reasons
Expand Down

0 comments on commit fdba8f0

Please sign in to comment.