Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix auto-detecting GPU architectures #727

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ message(STATUS "RMM: RMM_LOGGING_LEVEL = '${RMM_LOGGING_LEVEL}'")

if(BUILD_TESTS OR BUILD_BENCHMARKS)
# Auto-detect available GPU compute architectures
enable_language(CUDA)
include(${RMM_SOURCE_DIR}/cmake/Modules/SetGPUArchs.cmake)
# Enable the CUDA language after setting CMAKE_CUDA_ARCHITECTURES
enable_language(CUDA)
message(STATUS "RMM: Building benchmarks with GPU Architectures: ${CMAKE_CUDA_ARCHITECTURES}")
endif()

Expand Down
8 changes: 7 additions & 1 deletion cmake/Modules/EvalGPUArchs.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019-2020, NVIDIA CORPORATION.
# Copyright (c) 2019-2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
Expand All @@ -10,6 +10,12 @@
# or implied. See the License for the specific language governing permissions and limitations under
# the License.

# Unset this first in case it's set to <empty_string>
unset(CMAKE_CUDA_ARCHITECTURES CACHE)

# Enable CUDA so we can invoke nvcc
enable_language(CUDA)

# Function uses the CUDA runtime API to query the compute capability of the device, so if a user
# doesn't pass any architecture options to CMake we only build the current architecture
function(evaluate_gpu_archs gpu_archs)
Expand Down
2 changes: 1 addition & 1 deletion cmake/Modules/SetGPUArchs.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# =============================================================================
# Copyright (c) 2020, NVIDIA CORPORATION.
# Copyright (c) 2020-2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
Expand Down