rocRAND icon indicating copy to clipboard operation
rocRAND copied to clipboard

Distribution from xorwow

Open pghysels opened this issue 1 year ago • 0 comments

I'm seeing strange results with the test below. I'm using a similar approach in a HIP kernel. Using the index i for the subsequence or the offset would be too slow.

#define FQUALIFIERS
#include <rocrand/rocrand.h>
#include <rocrand/rocrand_xorwow.h>
#include <iostream>

int main() {
  int odd = 0, even = 0;
  for (int i=0; i<1000; i++) {
    rocrand_state_xorwow state;
    rocrand_init(i, 0, 0, &state);
    auto r = rocrand(&state);
    r = rocrand(&state);
    if (r % 2) odd++;
    else even++;
  }
  std::cout << "odd: " << odd << " even: " << even << std::endl;
}

hipcc test_rocrand.cpp -o test_rocrand -I/opt/rocm/include/ ./test_rocrand odd: 750 even: 250

pghysels avatar Sep 25 '24 18:09 pghysels