Skip to content

[oneMath][RNG] Add PCG64 DXSM generator to Device API #621

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

iMartyan
Copy link
Contributor

The PCG is a family of random number generators based on linear congruential generator (LCG). The algorithm applies permutation function to improve statistical properties of LCG.
PCG64 DXSM uses double xorshift multiply output function and has a period of 2^128.
Added new page for the engine, modified bibliography and engines overview.

@iMartyan iMartyan force-pushed the dev/imartyan/rng_pcg64_device branch from 66c8015 to b861466 Compare April 22, 2025 16:04
@iMartyan
Copy link
Contributor Author

Formulas:
image

Copy link
Contributor

@andreyfe1 andreyfe1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

- Description
* - `pcg64_dxsm()`_
- Default constructor
* - `pcg64_dxsm(std::uint64_t seed, std::uint64_t offset = 0)`_
Copy link
Contributor

@aelizaro aelizaro Apr 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a question about constructors: how big pcg64_dxsm state is? Two questions:

  1. whether initial seed should be 32 or 64 bits (other oneMKL engines may have different once)
  2. do we need initializer_list versions at all? (e.g. mcg59 https://github.com/uxlfoundation/oneAPI-spec/blob/main/source/elements/oneMath/source/domains/rng/device_api/device-rng-mcg59.rst has only 64-bit uint state, thus it doesn't need to have extra constructors).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The state of the engine has 128 bits. This way initializer_list is needed to fully occupy the state. Same applies to offset as period is 2^128.
About the seed, I suggest to keep it 64 bits, as it will populate half of the state.

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

Successfully merging this pull request may close these issues.

3 participants