ci: Tell CudaOnly.CompileFlags test what specific architecture to use

CUDA 12.8 deprecates architectures below 75.  Presumably a future
version will remove it.  Prepare infrastructure to avoid relying on
hard-coded arch 50 in this test.

This extends commit 63a5460faf (ci: Tell CudaOnly.Architecture test what
specific architecture to use, 2025-04-21).
This commit is contained in:
Robert Maynard authored and Brad King committed 2025-04-23 09:28:13 -04:00
1 parent 26fd56549a
commit 83a0c72a2d
3 files changed
+15 -4

No files matched your search

+1
View File
@@ -7,6 +7,7 @@ endmacro ()
set(CudaOnly.Architecture_BUILD_OPTIONS -DCMake_TEST_CUDA_ARCH=${CMake_TEST_CUDA_ARCH})
add_cuda_test_macro(CudaOnly.Architecture Architecture)
add_cuda_test_macro(CudaOnly.ArchSpecial CudaOnlyArchSpecial)
set(CudaOnly.CompileFlags_BUILD_OPTIONS -DCMake_TEST_CUDA_ARCH=${CMake_TEST_CUDA_ARCH})
add_cuda_test_macro(CudaOnly.CompileFlags CudaOnlyCompileFlags)
add_cuda_test_macro(CudaOnly.EnableStandard CudaOnlyEnableStandard)
add_cuda_test_macro(CudaOnly.ExportPTX CudaOnlyExportPTX)
+9 -2
View File
@@ -1,16 +1,23 @@
cmake_minimum_required(VERSION 3.17)
project(CompileFlags CUDA)
if(CMake_TEST_CUDA_ARCH)
set(arch ${CMake_TEST_CUDA_ARCH})
else()
set(arch 52)
endif()
add_executable(CudaOnlyCompileFlags main.cu)
target_compile_definitions(CudaOnlyCompileFlags PRIVATE EXPECT_CUDA_ARCH=${arch})
# Try passing CUDA architecture flags explicitly.
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
target_compile_options(CudaOnlyCompileFlags PRIVATE
-gencode arch=compute_50,code=compute_50
-gencode arch=compute_${arch},code=compute_${arch}
)
set_property(TARGET CudaOnlyCompileFlags PROPERTY CUDA_ARCHITECTURES)
else()
set_property(TARGET CudaOnlyCompileFlags PROPERTY CUDA_ARCHITECTURES 50-real)
set_property(TARGET CudaOnlyCompileFlags PROPERTY CUDA_ARCHITECTURES ${arch}-real)
endif()
target_compile_options(CudaOnlyCompileFlags PRIVATE -DALWAYS_DEFINE)
+5 -2
View File
@@ -1,6 +1,9 @@
#ifndef EXPECT_CUDA_ARCH
# error "EXPECT_CUDA_ARCH not defined!"
#endif
#ifdef __CUDA_ARCH__
# if __CUDA_ARCH__ != 500
# error "Passed architecture 50, but got something else."
# if __CUDA_ARCH__ != (EXPECT_CUDA_ARCH * 10)
# error "__CUDA_ARCH__ does not match CUDA_ARCHITECTURES"
# endif
#endif