Skip to content

Commit 47680ec

Browse files
authored
Only include SetGPUArchs in the top-level CMakeLists.txt (#713)
Fixes an issue seen when building both tests and benchmarks: ``` ###################### # Configuring librmm # ###################### ... -- RMM: Building tests with GPU Architectures: 60-real;70-real;75-real;80 ... -- RMM: Building benchmarks with GPU Architectures: 60-real-real;70-real-real;75-real-real;80 -- Configuring done CMake Error in benchmarks/CMakeLists.txt: Uknown CUDA architecture specifier "real-real". ``` Authors: - Paul Taylor (@trxcllnt) - Keith Kraus (@kkraus14) Approvers: - Jake Hemstad (@jrhemstad) - Keith Kraus (@kkraus14) URL: #713
1 parent 69a7541 commit 47680ec

File tree

4 files changed

+8
-18
lines changed

4 files changed

+8
-18
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ set_property(CACHE RMM_LOGGING_LEVEL PROPERTY STRINGS "TRACE" "DEBUG" "INFO" "WA
8383
"CRITICAL" "OFF")
8484
message(STATUS "RMM: RMM_LOGGING_LEVEL = '${RMM_LOGGING_LEVEL}'")
8585

86+
if(BUILD_TESTS OR BUILD_BENCHMARKS)
87+
# Auto-detect available GPU compute architectures
88+
include(${RMM_SOURCE_DIR}/cmake/Modules/SetGPUArchs.cmake)
89+
message(STATUS "RMM: Building benchmarks with GPU Architectures: ${CMAKE_CUDA_ARCHITECTURES}")
90+
# Only enable the CUDA language after including SetGPUArchs.cmake
91+
enable_language(CUDA)
92+
endif()
93+
8694
# optionally build tests
8795

8896
if(BUILD_TESTS)

benchmarks/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,8 @@ CPMFindPackage(
2121
GIT_SHALLOW TRUE
2222
OPTIONS "BENCHMARK_ENABLE_TESTING OFF" "BENCHMARK_ENABLE_INSTALL OFF")
2323

24-
# Auto-detect available GPU compute architectures
25-
26-
include(${RMM_SOURCE_DIR}/cmake/Modules/SetGPUArchs.cmake)
27-
message(STATUS "RMM: Building benchmarks with GPU Architectures: ${CMAKE_CUDA_ARCHITECTURES}")
28-
2924
# Build options
3025

31-
enable_language(CUDA)
32-
3326
option(DISABLE_DEPRECATION_WARNING "Disable warnings generated from deprecated declarations." OFF)
3427
option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF)
3528

cmake/Modules/SetGPUArchs.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,3 @@ list(SORT CMAKE_CUDA_ARCHITECTURES ORDER ASCENDING)
7272
list(POP_BACK CMAKE_CUDA_ARCHITECTURES latest_arch)
7373
list(TRANSFORM CMAKE_CUDA_ARCHITECTURES APPEND "-real")
7474
list(APPEND CMAKE_CUDA_ARCHITECTURES ${latest_arch})
75-
76-
set(CMAKE_CUDA_ARCHITECTURES
77-
${CMAKE_CUDA_ARCHITECTURES}
78-
PARENT_SCOPE)

tests/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,6 @@ if(GTest_ADDED)
3333
add_library(GTest::gmock_main ALIAS gmock_main)
3434
endif()
3535

36-
# Auto-detect available GPU compute architectures
37-
38-
include(${RMM_SOURCE_DIR}/cmake/Modules/SetGPUArchs.cmake)
39-
message(STATUS "RMM: Building tests with GPU Architectures: ${CMAKE_CUDA_ARCHITECTURES}")
40-
41-
enable_language(CUDA)
42-
4336
# Build options
4437

4538
option(DISABLE_DEPRECATION_WARNING "Disable warnings generated from deprecated declarations." OFF)

0 commit comments

Comments
 (0)