rocRAND data type support#
This topic discusses the various data types supported by rocRAND and provides a comparison with the data type support in NVIDIA CUDA cuRAND.
Host API#
This section covers the data types supported for the host API.
Generator types#
Generator |
rocRAND support |
cuRAND support |
---|---|---|
XORWOW |
✅ |
✅ |
MRG32K3A |
✅ |
✅ |
MTGP32 |
✅ |
✅ |
Philox 4x32-10 |
✅ |
✅ |
MT19937 |
✅ |
✅ |
MRG31K3P |
✅ |
❌ |
LFSR113 |
✅ |
❌ |
ThreeFry 2x32-20 |
✅ |
❌ |
ThreeFry 4x32-20 |
✅ |
❌ |
ThreeFry 2x64-20 |
✅ |
❌ |
ThreeFry 4x64-20 |
✅ |
❌ |
Sobol32 |
✅ |
✅ |
Scrambled Sobol32 |
✅ |
✅ |
Sobol64 |
✅ |
✅ |
Scrambled Sobol64 |
✅ |
✅ |
Only Sobol64, Scrambled Sobol64, ThreeFry 2x64-20, and ThreeFry 4x64-20 support the generation of 64-bit unsigned long long int
integers.
The other generators generate 32-bit unsigned int
integers.
Seed types#
All generators can be seeded with unsigned long long
. However, LFSR113 can also be seeded using a uint4
.
Output types#
The generators produce pseudo-random numbers chosen from a given distribution. The following distributions and corresponding output types are supported for the host API:
Uniform distribution#
Type |
Size of type |
rocRAND support |
cuRAND support |
---|---|---|---|
|
8 bit |
✅ |
❌ |
|
16 bit |
✅ |
❌ |
|
32 bit |
✅ |
✅ |
|
64 bit (see note) |
✅ |
✅ |
|
16 bit |
✅ |
❌ |
|
32 bit |
✅ |
✅ |
|
64 bit |
✅ |
✅ |
Uniform distributions of integral types return a number between 0 and 2^(size in bits) - 1, whereas floating-point types return a number between 0.0 and 1.0, excluding 1.0.
Note
The generation of 64-bit unsigned long long
integers is only supported by 64-bit generators
(Scrambled Sobol 64, Sobol64, Threefry 2x64-20, and Threefry 4x64-20).
Poisson distribution#
Type |
Size of type |
rocRAND support |
cuRAND support |
---|---|---|---|
|
32 bit |
✅ |
✅ |
Normal distribution#
Type |
Size of type |
rocRAND support |
cuRAND support |
---|---|---|---|
|
16 bit |
✅ |
❌ |
|
32 bit |
✅ |
✅ |
|
64 bit |
✅ |
✅ |
Log-normal distributions#
Type |
Size of type |
rocRAND support |
cuRAND support |
---|---|---|---|
|
16 bit |
✅ |
❌ |
|
32 bit |
✅ |
✅ |
|
64 bit |
✅ |
✅ |
Device API#
This section covers the supported data types for the device API.
Generator types#
Generator |
rocRAND support |
cuRAND support |
---|---|---|
XORWOW |
✅ |
✅ |
MRG32K3A |
✅ |
✅ |
MTGP32 |
✅ |
✅ |
Philox 4x32-10 |
✅ |
✅ |
MT19937 |
❌ |
❌ |
MRG31K3P |
✅ |
❌ |
LFSR113 |
✅ |
❌ |
ThreeFry 2x32-20 |
✅ |
❌ |
ThreeFry 4x32-20 |
✅ |
❌ |
ThreeFry 2x64-20 |
✅ |
❌ |
ThreeFry 4x64-20 |
✅ |
❌ |
Sobol32 |
✅ |
✅ |
Scrambled Sobol32 |
✅ |
✅ |
Sobol64 |
✅ |
✅ |
Scrambled Sobol64 |
✅ |
✅ |
Seed types#
All generators can be seeded with unsigned long long
, however LFSR113 can also be seeded using an uint4
.
Output types#
The generators produce pseudo-random numbers chosen from a given distribution. The following distributions and corresponding output types are supported for the device API. However, not all generators support all types.
Uniform distribution#
Type |
rocRAND support |
Supported rocRAND generators |
cuRAND support |
---|---|---|---|
|
✅ |
All native 32-bit generators |
✅ |
|
✅ |
All native 64-bit generators |
✅ |
|
✅ |
All generators |
✅ |
|
✅ |
Philox 4x32-10 |
❌ |
|
✅ |
Philox 4x32-10 |
✅ |
|
✅ |
All generators |
✅ |
|
✅ |
Philox 4x32-10 |
✅ |
|
✅ |
Philox 4x32-10 |
❌ |
Normal distribution#
Type |
rocRAND support |
Supported rocRAND generators |
cuRAND support |
---|---|---|---|
|
✅ |
All generators |
✅ |
|
✅ |
Philox 4x32-10, MRG31K3P, MRG32K3A, XORWOW, LFSR113, all ThreeFry generators |
✅ |
|
✅ |
Philox 4x32-10 |
✅ |
|
✅ |
All generators |
✅ |
|
✅ |
Philox 4x32-10, MRG31K3P, MRG32K3A, XORWOW, LFSR113, all ThreeFry generators |
✅ |
|
✅ |
Philox 4x32-10 |
❌ |
Log-normal distributions#
Type |
rocRAND support |
Supported rocRAND generators |
cuRAND support |
---|---|---|---|
|
✅ |
All generators |
✅ |
|
✅ |
Philox 4x32-10, MRG31K3P, MRG32K3A, XORWOW, LFSR113, all ThreeFry generators |
✅ |
|
✅ |
Philox 4x32-10 |
✅ |
|
✅ |
All generators |
✅ |
|
✅ |
Philox 4x32-10, MRG31K3P, MRG32K3A, XORWOW, LFSR113, all ThreeFry generators |
✅ |
|
✅ |
Philox 4x32-10 |
❌ |
Poisson distributions#
Type |
rocRAND support |
Supported rocRAND generators |
cuRAND support |
---|---|---|---|
|
✅ |
Philox 4x32-10, MRG31k3p, MRG32K3A, XORWOW, MTGP32, Sobol32, Scrambled Sobol32, LFSR113, all ThreeFry generators |
✅ |
|
✅ |
Sobol64, Scrambled Sobol64 |
❌ |
|
✅ |
Philox 4x32-10 |
✅ |
Discrete distributions#
Type |
rocRAND support |
Supported rocRAND generators |
cuRAND support |
---|---|---|---|
|
✅ |
All generators |
✅ |
|
✅ |
Philox 4x32-10 |
✅ - only Philox - 4x32-10 |