From e6e72d23df1d786ea93f7e4873c5e175f2ec2560 Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Wed, 13 May 2015 09:24:30 +0100 Subject: [PATCH] RNG test --- tests/Grid_rng.cc | 51 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/Grid_rng.cc diff --git a/tests/Grid_rng.cc b/tests/Grid_rng.cc new file mode 100644 index 00000000..97f6c6b7 --- /dev/null +++ b/tests/Grid_rng.cc @@ -0,0 +1,51 @@ +#include +#include + +using namespace std; +using namespace Grid; +using namespace Grid::QCD; + +int main (int argc, char ** argv) +{ + Grid_init(&argc,&argv); + + std::vector latt_size = GridDefaultLatt(); + std::vector simd_layout = GridDefaultSimd(4,vComplexF::Nsimd()); + std::vector mpi_layout = GridDefaultMpi(); + + GridCartesian Grid(latt_size,simd_layout,mpi_layout); + + std::vector seeds({1,2,3,4}); + + GridSerialRNG sRNG; sRNG.SeedRandomDevice(); + GridSerialRNG fsRNG; fsRNG.SeedFixedIntegers(seeds); + + GridParallelRNG pRNG(&Grid); pRNG.SeedRandomDevice(); + GridParallelRNG fpRNG(&Grid); fpRNG.SeedFixedIntegers(seeds); + + SpinMatrix rnd ; + random(sRNG,rnd); + std::cout<<"Random Spin Matrix (random_device)\n"<< rnd<