This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 757
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests for legacy and per-thread default streams
- Loading branch information
1 parent
0c81f42
commit 7b1306d
Showing
5 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include <unittest/unittest.h> | ||
#include <thrust/execution_policy.h> | ||
#include <thrust/system/cuda/detail/util.h> | ||
|
||
#include <thread> | ||
|
||
void verify_stream() | ||
{ | ||
auto exec = thrust::device; | ||
auto stream = thrust::cuda_cub::stream(exec); | ||
ASSERT_EQUAL(stream, cudaStreamLegacy); | ||
} | ||
|
||
void TestLegacyDefaultStream() | ||
{ | ||
verify_stream(); | ||
|
||
std::thread t(verify_stream); | ||
t.join(); | ||
} | ||
DECLARE_UNITTEST(TestLegacyDefaultStream); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# This test should always use per-thread streams on NVCC. | ||
set_target_properties(${test_target} PROPERTIES | ||
COMPILE_OPTIONS | ||
$<$<AND:$<COMPILE_LANGUAGE:CUDA>,$<CUDA_COMPILER_ID:NVIDIA>>:--default-stream=per-thread> | ||
) | ||
|
||
# NVC++ does not have an equivalent option, and will always | ||
# use the global stream by default. | ||
if (CMAKE_CUDA_COMPILER_ID STREQUAL "Feta") | ||
set_tests_properties(${test_target} PROPERTIES WILL_FAIL ON) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include <unittest/unittest.h> | ||
#include <thrust/execution_policy.h> | ||
#include <thrust/system/cuda/detail/util.h> | ||
|
||
#include <thread> | ||
|
||
void verify_stream() | ||
{ | ||
auto exec = thrust::device; | ||
auto stream = thrust::cuda_cub::stream(exec); | ||
ASSERT_EQUAL(stream, cudaStreamPerThread); | ||
} | ||
|
||
void TestPerThreadDefaultStream() | ||
{ | ||
verify_stream(); | ||
|
||
std::thread t(verify_stream); | ||
t.join(); | ||
} | ||
DECLARE_UNITTEST(TestPerThreadDefaultStream); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CUDACC_FLAGS += --default-stream per-thread |