forked from NVIDIA/thrust
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle execute_on_stream in binary_search algorithms
The stream information got lost when using the `thrust::reference` API to pass inputs/outputs to/from the device. Fixes NVIDIA#921 Bug 2173437
- Loading branch information
1 parent
d09ba09
commit 9a3cfbf
Showing
3 changed files
with
50 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <unittest/unittest.h> | ||
|
||
#include <thrust/binary_search.h> | ||
#include <thrust/device_vector.h> | ||
#include <thrust/distance.h> | ||
#include <thrust/pair.h> | ||
#include <thrust/sequence.h> | ||
|
||
void TestEqualRangeOnStream() | ||
{ // Regression test for GH issue #921 (nvbug 2173437) | ||
typedef typename thrust::device_vector<int> vector_t; | ||
typedef typename vector_t::iterator iterator_t; | ||
typedef thrust::pair<iterator_t, iterator_t> result_t; | ||
|
||
vector_t input(10); | ||
thrust::sequence(thrust::device, input.begin(), input.end(), 0); | ||
cudaStream_t stream = 0; | ||
result_t result = thrust::equal_range(thrust::cuda::par.on(stream), | ||
input.begin(), input.end(), | ||
5); | ||
|
||
ASSERT_EQUAL(5, thrust::distance(input.begin(), result.first)); | ||
ASSERT_EQUAL(6, thrust::distance(input.begin(), result.second)); | ||
} | ||
DECLARE_UNITTEST(TestEqualRangeOnStream); |
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 += -rdc=true |
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