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

[BUG] Rmat C++ tests fail with RNG PC generator type #2266

Closed
MatthiasKohl opened this issue May 10, 2022 · 0 comments · Fixed by #2356
Closed

[BUG] Rmat C++ tests fail with RNG PC generator type #2266

MatthiasKohl opened this issue May 10, 2022 · 0 comments · Fixed by #2356
Labels
? - Needs Triage Need team to review and classify bug Something isn't working
Milestone

Comments

@MatthiasKohl
Copy link
Contributor

Describe the bug
Rmat C++ tests fail when using RAFT PC generator type

Steps/Code to reproduce bug
Switch RngState to raft::random::GeneratorType::GenPC here: https://github.com/rapidsai/cugraph/blob/branch-22.06/cpp/src/detail/utility_wrappers.cu#L34

Expected behavior
All unit tests should pass

Environment overview (please complete the following information)

  • Environment location: CI
  • Method of cuGraph install: CI

Environment details
See CI

@MatthiasKohl MatthiasKohl added ? - Needs Triage Need team to review and classify bug Something isn't working labels May 10, 2022
rapids-bot bot pushed a commit to rapidsai/raft that referenced this issue May 26, 2022
RAFT's RNG class provides methods that fill a buffer with random numbers belonging to various probability distribution functions. For example`uniform`, `normal` etc. In this methods, multiple instances of random number generator are used in parallel. Each cuda thread gets it own instance of generator. The instance is initialized with three values `seed`, `subsequence` and `offset`. The  value for `seed` is common for all threads and thread id is used for `subsequence`. The `offset`  is kept `0` for all instances. To fill the buffer, the threads work in grid strided fashion  demonstrated by loop below:

```
  for (size_t i = tid; i < buffer_length; i += total_number_of_threads) {
    buffer[i] = rng.next();
  }
```

Due to grid-striding of loops, consecutive elements in the buffer are `ith` element in consecutive subsequences. For example, 10th and 11th elements in the buffer would be 0th element in 10th and 11th subsequences. In the unit tests for cugraph, this scheme seems to introduce a slight bias in certain cases. Easy fix to the issue is to break the lock step increment of individual subsequences. 

This PR sets different offset value for each subsequence by setting `offset = subsequence`. Note that this change has no effect on the period of the random number generator.

This should fix the cuGraph issue rapidsai/cugraph#2266 for now.

Authors:
  - Vinay Deshpande (https://github.com/vinaydes)

Approvers:
  - Thejaswi. N. S (https://github.com/teju85)

URL: #690
@ChuckHastings ChuckHastings added this to the 22.08 milestone Jun 1, 2022
rapids-bot bot pushed a commit that referenced this issue Jun 21, 2022
With the RAFT changes here: rapidsai/raft#690 we should be able to use the PC generator again.  The PC generator is significantly faster.

Closes #2266

Authors:
  - Chuck Hastings (https://github.com/ChuckHastings)

Approvers:
  - Corey J. Nolet (https://github.com/cjnolet)
  - Seunghwa Kang (https://github.com/seunghwak)

URL: #2356
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
? - Needs Triage Need team to review and classify bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants