From 38bf8765bf3a8e17ab10c2991e39d74db2b986fc Mon Sep 17 00:00:00 2001 From: ptaylor Date: Sun, 21 Feb 2021 16:05:34 -0600 Subject: [PATCH 1/3] Only include SetGPUArchs in the top-level CMakeLists.txt --- CMakeLists.txt | 8 ++++++++ benchmarks/CMakeLists.txt | 7 ------- cmake/Modules/SetGPUArchs.cmake | 4 ---- tests/CMakeLists.txt | 7 ------- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc37bd4bc..7050fb259 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,6 +83,14 @@ set_property(CACHE RMM_LOGGING_LEVEL PROPERTY STRINGS "TRACE" "DEBUG" "INFO" "WA "CRITICAL" "OFF") message(STATUS "RMM: RMM_LOGGING_LEVEL = '${RMM_LOGGING_LEVEL}'") +if(BUILD_TESTS OR BUILD_BENCHMARKS) + # Auto-detect available GPU compute architectures + include(${RMM_SOURCE_DIR}/cmake/Modules/SetGPUArchs.cmake) + message(STATUS "RMM: Building benchmarks with GPU Architectures: ${CMAKE_CUDA_ARCHITECTURES}") + # Only enable the CUDA language after including SetGPUArchs.cmake + enable_language(CUDA) +endif() + # optionally build tests if(BUILD_TESTS) diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 33208ea5e..c2f862fcb 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -21,15 +21,8 @@ CPMFindPackage( GIT_SHALLOW TRUE OPTIONS "BENCHMARK_ENABLE_TESTING OFF" "BENCHMARK_ENABLE_INSTALL OFF") -# Auto-detect available GPU compute architectures - -include(${RMM_SOURCE_DIR}/cmake/Modules/SetGPUArchs.cmake) -message(STATUS "RMM: Building benchmarks with GPU Architectures: ${CMAKE_CUDA_ARCHITECTURES}") - # Build options -enable_language(CUDA) - option(DISABLE_DEPRECATION_WARNING "Disable warnings generated from deprecated declarations." OFF) option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF) diff --git a/cmake/Modules/SetGPUArchs.cmake b/cmake/Modules/SetGPUArchs.cmake index 193b3842f..86f92350e 100644 --- a/cmake/Modules/SetGPUArchs.cmake +++ b/cmake/Modules/SetGPUArchs.cmake @@ -72,7 +72,3 @@ list(SORT CMAKE_CUDA_ARCHITECTURES ORDER ASCENDING) list(POP_BACK CMAKE_CUDA_ARCHITECTURES latest_arch) list(TRANSFORM CMAKE_CUDA_ARCHITECTURES APPEND "-real") list(APPEND CMAKE_CUDA_ARCHITECTURES ${latest_arch}) - -set(CMAKE_CUDA_ARCHITECTURES - ${CMAKE_CUDA_ARCHITECTURES} - PARENT_SCOPE) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 841202345..e52eb2dd2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -33,13 +33,6 @@ if(GTest_ADDED) add_library(GTest::gmock_main ALIAS gmock_main) endif() -# Auto-detect available GPU compute architectures - -include(${RMM_SOURCE_DIR}/cmake/Modules/SetGPUArchs.cmake) -message(STATUS "RMM: Building tests with GPU Architectures: ${CMAKE_CUDA_ARCHITECTURES}") - -enable_language(CUDA) - # Build options option(DISABLE_DEPRECATION_WARNING "Disable warnings generated from deprecated declarations." OFF) From eb3a40a69f9cd54b5ae6aef0b5c4593354740547 Mon Sep 17 00:00:00 2001 From: Keith Kraus Date: Sun, 21 Feb 2021 17:35:39 -0500 Subject: [PATCH 2/3] Fix cmake style check --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7050fb259..ab5eaed39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,10 +85,10 @@ message(STATUS "RMM: RMM_LOGGING_LEVEL = '${RMM_LOGGING_LEVEL}'") if(BUILD_TESTS OR BUILD_BENCHMARKS) # Auto-detect available GPU compute architectures - include(${RMM_SOURCE_DIR}/cmake/Modules/SetGPUArchs.cmake) - message(STATUS "RMM: Building benchmarks with GPU Architectures: ${CMAKE_CUDA_ARCHITECTURES}") - # Only enable the CUDA language after including SetGPUArchs.cmake - enable_language(CUDA) + include(${RMM_SOURCE_DIR}/cmake/Modules/SetGPUArchs.cmake) + message(STATUS "RMM: Building benchmarks with GPU Architectures: ${CMAKE_CUDA_ARCHITECTURES}") + # Only enable the CUDA language after including SetGPUArchs.cmake + enable_language(CUDA) endif() # optionally build tests From 839551927967b6f69d97f2432a657005da0b96ea Mon Sep 17 00:00:00 2001 From: Keith Kraus Date: Sun, 21 Feb 2021 17:36:00 -0500 Subject: [PATCH 3/3] one more --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab5eaed39..11a855ff9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,7 +84,7 @@ set_property(CACHE RMM_LOGGING_LEVEL PROPERTY STRINGS "TRACE" "DEBUG" "INFO" "WA message(STATUS "RMM: RMM_LOGGING_LEVEL = '${RMM_LOGGING_LEVEL}'") if(BUILD_TESTS OR BUILD_BENCHMARKS) - # Auto-detect available GPU compute architectures + # Auto-detect available GPU compute architectures include(${RMM_SOURCE_DIR}/cmake/Modules/SetGPUArchs.cmake) message(STATUS "RMM: Building benchmarks with GPU Architectures: ${CMAKE_CUDA_ARCHITECTURES}") # Only enable the CUDA language after including SetGPUArchs.cmake