Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For fixing the cuGraph test failures with PCG (#690)
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
- Loading branch information