Skip to content

Commit

Permalink
Use thrust random engine instead of stl in device code.
Browse files Browse the repository at this point in the history
  • Loading branch information
alliepiper authored and neon60 committed Nov 20, 2020
1 parent 8ad2436 commit d3713fb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/benchmark/bench.cu
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
#include <thrust/version.h>

#if THRUST_CPP_DIALECT >= 2011
#include <thrust/random.h>
#include <thrust/shuffle.h>

#include <random>
#endif

Expand Down Expand Up @@ -720,7 +722,6 @@ template <typename Container, typename TrialKind = regular_trial>
struct shuffle_trial_base : trial_base<TrialKind>
{
Container input;
std::default_random_engine g;

void setup(uint64_t elements)
{
Expand Down Expand Up @@ -934,6 +935,7 @@ struct shuffle_tester

struct std_trial : shuffle_trial_base<std::vector<T>, baseline_trial>
{
std::default_random_engine g;
void operator()()
{
std::shuffle(this->input.begin(), this->input.end(), this->g);
Expand All @@ -942,6 +944,7 @@ struct shuffle_tester

struct thrust_trial : shuffle_trial_base<thrust::device_vector<T> >
{
thrust::default_random_engine g;
void operator()()
{
thrust::shuffle(this->input.begin(), this->input.end(), this->g);
Expand Down

0 comments on commit d3713fb

Please sign in to comment.