Skip to content

Commit b01af45

Browse files
authored
Set -Wno-deprecated-gpu-targets when compiling for RAPIDS architectures (#776)
Closes #761. Authors: - Bradley Dice (https://github.com/bdice) - Robert Maynard (https://github.com/robertmaynard) Approvers: - Vyas Ramasubramani (https://github.com/vyasr) URL: #776
1 parent 1257016 commit b01af45

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

rapids-cmake/cuda/set_architectures.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ function(rapids_cuda_set_architectures mode)
8585
list(TRANSFORM CMAKE_CUDA_ARCHITECTURES APPEND "-real")
8686
endif()
8787

88+
# CUDA 12.8.0 and later warns when compiling for arch 70. We ignore this warning when compiling
89+
# for RAPIDS architectures.
90+
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL
91+
12.8.0)
92+
string(APPEND CMAKE_CUDA_FLAGS " -Wno-deprecated-gpu-targets")
93+
endif()
94+
8895
# cache the cuda archs.
8996
get_property(cached_value GLOBAL PROPERTY rapids_cuda_architectures)
9097
if(NOT cached_value)
@@ -103,5 +110,6 @@ function(rapids_cuda_set_architectures mode)
103110

104111
# Set as a local variable to maintain comp
105112
set(CMAKE_CUDA_ARCHITECTURES ${CMAKE_CUDA_ARCHITECTURES} PARENT_SCOPE)
113+
set(CMAKE_CUDA_FLAGS ${CMAKE_CUDA_FLAGS} PARENT_SCOPE)
106114

107115
endfunction()

testing/cuda/validate-cuda-native.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#=============================================================================
2-
# Copyright (c) 2021-2024, NVIDIA CORPORATION.
2+
# Copyright (c) 2021-2025, NVIDIA CORPORATION.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -29,3 +29,9 @@ endforeach()
2929
if(NOT DEFINED CACHE{CMAKE_CUDA_ARCHITECTURES} )
3030
message(FATAL_ERROR "rapids_cuda_set_architectures didn't make CMAKE_CUDA_ARCHITECTURES a cache variable")
3131
endif()
32+
33+
if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.8.0 )
34+
if(NOT CMAKE_CUDA_FLAGS MATCHES "Wno-deprecated-gpu-targets")
35+
message(FATAL_ERROR "CMAKE_CUDA_FLAGS should have -Wno-deprecated-gpu-targets")
36+
endif()
37+
endif()

testing/cuda/validate-cuda-rapids.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#=============================================================================
2-
# Copyright (c) 2021-2024, NVIDIA CORPORATION.
2+
# Copyright (c) 2021-2025, NVIDIA CORPORATION.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -48,3 +48,9 @@ list(APPEND CMAKE_CUDA_ARCHITECTURES ${last_value})
4848
if(NOT DEFINED CACHE{CMAKE_CUDA_ARCHITECTURES} )
4949
message(FATAL_ERROR "rapids_cuda_set_architectures didn't make CMAKE_CUDA_ARCHITECTURES a cache variable")
5050
endif()
51+
52+
if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.8.0 )
53+
if(NOT CMAKE_CUDA_FLAGS MATCHES "Wno-deprecated-gpu-targets")
54+
message(FATAL_ERROR "CMAKE_CUDA_FLAGS should have -Wno-deprecated-gpu-targets")
55+
endif()
56+
endif()

0 commit comments

Comments
 (0)