Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distribution from xorwow #556

Open
pghysels opened this issue Sep 25, 2024 · 0 comments
Open

Distribution from xorwow #556

pghysels opened this issue Sep 25, 2024 · 0 comments

Comments

@pghysels
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant