8 #include <catch2/catch_test_macros.hpp>
15 const int SEED_KEY = 1;
16 const int NUM_STREAMS = 20;
17 const int NUM_SAMPLES = 1000;
20 const int res_size = NUM_SAMPLES * NUM_STREAMS;
23 for (
int i = 0;
i < NUM_STREAMS;
i++) {
28 nrn_pragma_omp(target teams distribute parallel
for map(tofrom: res[0:res_size])
map(to: rand_streams[0:NUM_STREAMS]))
29 nrn_pragma_acc(parallel loop copy(res [0:res_size]) copyin(rand_streams [0:NUM_STREAMS]))
30 for (
int i = 0;
i < NUM_STREAMS;
i++) {
31 for (
int j = 0;
j < NUM_SAMPLES;
j++) {
33 res[
i * NUM_SAMPLES +
j] = val;
39 std::set<double> check_set;
41 for (
int i = 0;
i < NUM_STREAMS * NUM_SAMPLES;
i++) {
43 size_t old_size = check_set.size();
44 check_set.insert(res[
i]);
45 size_t new_size = check_set.size();
47 if (old_size == new_size) {
48 std::cerr <<
"Duplicate found! i = " <<
i <<
", d = " << d << std::endl;
51 REQUIRE(check_set.size() == NUM_SAMPLES * NUM_STREAMS);
nrn_pragma_acc(routine seq) nrn_pragma_omp(declare target) philox4x32_ctr_t coreneuron_random123_philox4x32_helper(coreneuron nrn_pragma_omp(end declare target) namespace coreneuron
Provide a helper function in global namespace that is declared target for OpenMP offloading to functi...
nrnran123_State * nrnran123_newstream()
Construct a new Random123 stream based on the philox4x32 generator.
double nrnran123_dblpick(nrnran123_State *s)
void nrnran123_setseq(nrnran123_State *s, std::uint32_t seq, char which)
Set a Random123 sequence for a sequnece ID and which selector.
static double map(void *v)
THIS FILE IS AUTO GENERATED DONT MODIFY IT.
nrn_pragma_acc(routine seq) int vector_capacity(void *v)
TEST_CASE("random123 smoke test")