mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 13:51:33 -06:00
Tests: Teach CudaOnly.CUBIN to tolerate toolkit not supporting native arch
Since commit 2def6a874b (CUDA: Add support for CUBIN, FATBIN, and
OPTIXIR compilation, 2023-01-27) added this test, it has failed when
executed with a CUDA toolkit that does not support the true native
architecture of the GPU. Detect this case and skip the test.
This commit is contained in:
@@ -1,9 +1,17 @@
|
||||
cmake_minimum_required(VERSION 3.18)
|
||||
unset(ENV{CMAKE_CUDA_ARCHITECTURES_NATIVE_CLAMP}) # CUBIN needs true native arch
|
||||
project(CudaCUBIN LANGUAGES CUDA)
|
||||
|
||||
|
||||
set(CMAKE_CUDA_ARCHITECTURES all-major)
|
||||
|
||||
# CUBIN needs the true native arch to be supported by the CUDA toolkit.
|
||||
set(unavailable_native_archs "${CMAKE_CUDA_ARCHITECTURES_NATIVE}")
|
||||
list(REMOVE_ITEM unavailable_native_archs ${CMAKE_CUDA_ARCHITECTURES_ALL})
|
||||
if(unavailable_native_archs)
|
||||
add_executable(CudaOnlyCUBIN main_no_native_archs.cu)
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_library(CudaCUBIN OBJECT kernelA.cu kernelB.cu kernelC.cu)
|
||||
set_property(TARGET CudaCUBIN PROPERTY CUDA_CUBIN_COMPILATION ON)
|
||||
set_property(TARGET CudaCUBIN PROPERTY CUDA_ARCHITECTURES native)
|
||||
|
||||
4
Tests/CudaOnly/CUBIN/main_no_native_archs.cu
Normal file
4
Tests/CudaOnly/CUBIN/main_no_native_archs.cu
Normal file
@@ -0,0 +1,4 @@
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user