Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Commit b729edb

Browse files
committed
Update how RDC settings are applied to Catch2 utilities.
1 parent 3079077 commit b729edb

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

test/CMakeLists.txt

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@ CPMAddPackage("gh:brunocodutra/[email protected]")
1818

1919
find_package(CUDAToolkit REQUIRED)
2020

21-
# Some tests always build with RDC, so make sure that the sm_XX flags are
22-
# compatible. See note in CubCudaConfig.cmake.
23-
# TODO once we're using CUDA_ARCHITECTURES, we can setup non-rdc fallback
24-
# tests to build for non-rdc arches. But for now, all files in a given directory
25-
# must build with the same `CMAKE_CUDA_FLAGS` due to CMake constraints around
26-
# how CUDA_FLAGS works.
27-
set(CMAKE_CUDA_FLAGS "${CUB_CUDA_FLAGS_BASE} ${CUB_CUDA_FLAGS_RDC}")
28-
2921
# The function below reads the filepath `src`, extracts the %PARAM% comments,
3022
# and fills `labels_var` with a list of `label1_value1.label2_value2...`
3123
# strings, and puts the corresponding `DEFINITION=value1:DEFINITION=value2`
@@ -144,6 +136,11 @@ function(cub_add_test target_name_var test_name test_src cub_target)
144136
set(config_meta_target ${config_prefix}.tests)
145137

146138
if (is_catch2_test)
139+
set(use_rdc_for_catch2_utils OFF)
140+
if (CUB_ENABLE_RDC_TESTS OR CUB_FORCE_RDC)
141+
set(use_rdc_for_catch2_utils ON)
142+
endif()
143+
147144
# Per config helper library:
148145
set(config_c2h_target ${config_prefix}.test.catch2_helper)
149146
if (NOT TARGET ${config_c2h_target})
@@ -162,15 +159,12 @@ function(cub_add_test target_name_var test_name test_src cub_target)
162159
)
163160

164161
cub_clone_target_properties(${config_c2h_target} ${cub_target})
162+
cub_configure_cuda_target(${config_c2h_target} RDC ${use_rdc_for_catch2_utils})
165163
target_link_libraries(${config_c2h_target} PRIVATE CUDA::curand ${cub_target})
166164

167165
if (CUB_IN_THRUST)
168166
thrust_fix_clang_nvcc_build_for(${config_c2h_target})
169167
endif()
170-
171-
if (CUB_ENABLE_TESTS_WITH_RDC)
172-
cub_enable_rdc_for_cuda_target(${config_c2h_target})
173-
endif()
174168
endif() # config_c2h_target
175169

176170
if (CUB_SEPARATE_CATCH2)
@@ -191,6 +185,7 @@ function(cub_add_test target_name_var test_name test_src cub_target)
191185
Catch2::Catch2
192186
)
193187
cub_clone_target_properties(${config_c2run_target} ${cub_target})
188+
cub_configure_cuda_target(${config_c2run_target} RDC ${use_rdc_for_catch2_utils})
194189
add_dependencies(${config_meta_target} ${config_c2run_target})
195190
target_include_directories(${config_c2run_target} PRIVATE
196191
"${CUB_SOURCE_DIR}/test"

test/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ parameter must be `0:1`, with `0` indicating CDP disabled (RDC off) and `1`
3939
indicating CDP enabled (RDC on).
4040

4141
Tests that do not contain a variant labeled `cdp` will only enable RDC if
42-
the CMake variable `CUB_ENABLE_TESTS_WITH_RDC` is true.
42+
the CMake config enables them.
4343

4444
## Example
4545

0 commit comments

Comments
 (0)