mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 03:48:02 +08:00
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:

committed by
Brad King

parent
26fd56549a
commit
83a0c72a2d
@@ -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)
|
||||
|
@@ -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)
|
||||
|
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user