This repository was archived by the owner on Mar 21, 2024. It is now read-only.
File tree 5 files changed +57
-0
lines changed
5 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,14 @@ function(thrust_add_test target_name_var test_name test_src thrust_target)
111
111
if (("OMP" IN_LIST config_systems) OR ("TBB" IN_LIST config_systems))
112
112
set_tests_properties (${test_target} PROPERTIES RUN_SERIAL ON )
113
113
endif ()
114
+
115
+ # Check for per-test script. Script will be included in the current scope
116
+ # to allow custom property modifications.
117
+ get_filename_component (test_cmake_script "${test_src} " NAME_WLE)
118
+ set (test_cmake_script "${CMAKE_CURRENT_LIST_DIR} /${test_cmake_script} .cmake" )
119
+ if (EXISTS "${test_cmake_script} " )
120
+ include ("${test_cmake_script} " )
121
+ endif ()
114
122
endfunction ()
115
123
116
124
file (GLOB test_srcs
Original file line number Diff line number Diff line change
1
+ #include < unittest/unittest.h>
2
+ #include < thrust/execution_policy.h>
3
+ #include < thrust/system/cuda/detail/util.h>
4
+
5
+ #include < thread>
6
+
7
+ void verify_stream ()
8
+ {
9
+ auto exec = thrust::device;
10
+ auto stream = thrust::cuda_cub::stream (exec);
11
+ ASSERT_EQUAL (stream, cudaStreamLegacy);
12
+ }
13
+
14
+ void TestLegacyDefaultStream ()
15
+ {
16
+ verify_stream ();
17
+
18
+ std::thread t (verify_stream);
19
+ t.join ();
20
+ }
21
+ DECLARE_UNITTEST (TestLegacyDefaultStream);
Original file line number Diff line number Diff line change
1
+ # This test should always use per-thread streams on NVCC.
2
+ # NVC++ does not have an equivalent option.
3
+ set_target_properties (${test_target} PROPERTIES
4
+ COMPILE_OPTIONS
5
+ $<$<AND :$<COMPILE_LANGUAGE:CUDA>,$<CUDA_COMPILER_ID:NVIDIA>>:--default-stream=per-thread>
6
+ )
Original file line number Diff line number Diff line change
1
+ #include < unittest/unittest.h>
2
+ #include < thrust/execution_policy.h>
3
+ #include < thrust/system/cuda/detail/util.h>
4
+
5
+ #include < thread>
6
+
7
+ void verify_stream ()
8
+ {
9
+ auto exec = thrust::device;
10
+ auto stream = thrust::cuda_cub::stream (exec);
11
+ ASSERT_EQUAL (stream, cudaStreamPerThread);
12
+ }
13
+
14
+ void TestPerThreadDefaultStream ()
15
+ {
16
+ verify_stream ();
17
+
18
+ std::thread t (verify_stream);
19
+ t.join ();
20
+ }
21
+ DECLARE_UNITTEST (TestPerThreadDefaultStream);
Original file line number Diff line number Diff line change
1
+ CUDACC_FLAGS += --default-stream per-thread
You can’t perform that action at this time.
0 commit comments