File: data-type-support.rst

package info (click to toggle)
rocrand 6.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 102,860 kB
  • sloc: cpp: 203,022; f90: 2,500; python: 1,417; sh: 359; xml: 212; asm: 90; makefile: 50
file content (497 lines) | stat: -rw-r--r-- 9,408 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
.. meta::
   :description: rocRAND documentation and API reference library
   :keywords: rocRAND, ROCm, API, documentation, cuRAND

.. _data-type-support:

rocRAND data type support
******************************************

Host API
========

Generator types
---------------
 .. list-table:: Supported generators on the host
    :header-rows: 1
    :name: host-supported-generators

    *
      - 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 generation of 64 bit :code:`unsigned long long int` integers, the other generators generate 32 bit :code:`unsigned int` integers.

Seed types
----------

All generators can be seeded with :code:`unsigned long long`, however LFSR113 can additionally be seeded using an :code:`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
""""""""""""""""""""

 .. list-table:: Supported types for uniform distributions on the host
    :header-rows: 1
    :name: host-types-uniform-distribution

    *
      - Type
      - Size of type
      - rocRAND support
      - cuRAND support
    *
      - :code:`unsigned char`
      - 8 bit
      - ✅
      - ❌
    *
      - :code:`unsigned short`
      - 16 bit
      - ✅
      - ❌
    *
      - :code:`unsigned int`
      - 32 bit
      - ✅
      - ✅
    *
      - :code:`unsigned long long`
      - 64 bit [#]_
      - ✅
      - ✅
    *
      - :code:`half`
      - 16 bit
      - ✅
      - ❌
    *
      - :code:`float`
      - 32 bit
      - ✅
      - ✅
    *
      - :code:`double`
      - 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.

Poisson distribution
"""""""""""""""""""""

 .. list-table:: Supported types for the poisson distribution on the host
    :header-rows: 1
    :name: host-types-poisson-distribution

    *
      - Type
      - Size of type
      - rocRAND support
      - cuRAND support
    *
      - :code:`unsigned int`
      - 32 bit
      - ✅
      - ✅

Normal distribution
"""""""""""""""""""""

 .. list-table:: Supported types for normal distributions on the host
    :header-rows: 1
    :name: host-types-normal-distribution

    *
      - Type
      - Size of type
      - rocRAND support
      - cuRAND support
    *
      - :code:`half`
      - 16 bit
      - ✅
      - ❌
    *
      - :code:`float`
      - 32 bit
      - ✅
      - ✅
    *
      - :code:`double`
      - 64 bit
      - ✅
      - ✅

Log-normal distributions
""""""""""""""""""""""""

 .. list-table:: Supported types for log-normal distributions on the host
    :header-rows: 1
    :name: host-types-log-normal-distribution

    *
      - Type
      - Size of type
      - rocRAND support
      - cuRAND support
    *
      - :code:`half`
      - 16 bit
      - ✅
      - ❌
    *
      - :code:`float`
      - 32 bit
      - ✅
      - ✅
    *
      - :code:`double`
      - 64 bit
      - ✅
      - ✅

Device API
==========

Generator types
---------------
 .. list-table:: Supported generators on the device
    :header-rows: 1
    :name: device-supported-generators

    *
      - 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 :code:`unsigned long long`, however LFSR113 can additionally be seeded using an :code:`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
""""""""""""""""""""

 .. list-table:: Supported types for uniform distributions on the device
    :header-rows: 1
    :name: device-types-uniform-distribution

    *
      - Type
      - rocRAND support
      - supported rocRAND generators
      - cuRAND support
    *
      - :code:`unsigned int`
      - ✅
      - all native 32-bit generators
      - ✅
    *
      - :code:`unsigned long long int`
      - ✅
      - all native 64-bit generators
      - ✅
    *
      - :code:`float`
      - ✅
      - all generators
      - ✅
    *
      - :code:`float2`
      - ✅
      - Philox 4x32-10
      - ❌
    *
      - :code:`float4`
      - ✅
      - Philox 4x32-10
      - ✅
    *
      - :code:`double`
      - ✅
      - all generators
      - ✅
    *
      - :code:`double2`
      - ✅
      - Philox 4x32-10
      - ✅
    *
      - :code:`double4`
      - ✅
      - Philox 4x32-10
      - ❌


Normal distribution
""""""""""""""""""""

 .. list-table:: Supported types for normal distributions on the device
    :header-rows: 1
    :name: device-types-normal-distribution

    *
      - Type
      - rocRAND support
      - supported rocRAND generators
      - cuRAND support
    *
      - :code:`float`
      - ✅
      - all generators
      - ✅
    *
      - :code:`float2`
      - ✅
      - Philox 4x32-10, MRG31K3P, MRG32K3A, XORWOW, LFSR113, all ThreeFry generators
      - ✅
    *
      - :code:`float4`
      - ✅
      - Philox 4x32-10
      - ✅
    *
      - :code:`double`
      - ✅
      - all generators
      - ✅
    *
      - :code:`double2`
      - ✅
      - Philox 4x32-10, MRG31K3P, MRG32K3A, XORWOW, LFSR113, all ThreeFry generators
      - ✅
    *
      - :code:`double4`
      - ✅
      - Philox 4x32-10
      - ❌

Log-normal distributions
""""""""""""""""""""""""

 .. list-table:: Supported types for log-normal distributions on the device
    :header-rows: 1
    :name: device-types-log-normal-distribution

    *
      - Type
      - rocRAND support
      - supported rocRAND generators
      - cuRAND support
    *
      - :code:`float`
      - ✅
      - all generators
      - ✅
    *
      - :code:`float2`
      - ✅
      - Philox 4x32-10, MRG31K3P, MRG32K3A, XORWOW, LFSR113, all ThreeFry generators
      - ✅
    *
      - :code:`float4`
      - ✅
      - Philox 4x32-10
      - ✅
    *
      - :code:`double`
      - ✅
      - all generators
      - ✅
    *
      - :code:`double2`
      - ✅
      - Philox 4x32-10, MRG31K3P, MRG32K3A, XORWOW, LFSR113, all ThreeFry generators
      - ✅
    *
      - :code:`double4`
      - ✅
      - Philox 4x32-10
      - ❌

Poisson distributions
"""""""""""""""""""""

 .. list-table:: Supported types for poisson distributions on the device
    :header-rows: 1
    :name: device-types-poisson-distribution

    *
      - Type
      - rocRAND support
      - supported rocRAND generators
      - cuRAND support
    *
      - :code:`unsigned int`
      - ✅
      - Philox 4x32-10, MRG31k3p, MRG32K3A, XORWOW, MTGP32, Sobol32, Scrambled Sobol32, LFSR113, all ThreeFry generators
      - ✅
    *
      - :code:`unsigned long long int`
      - ✅
      - Sobol64, Scrambled sobol64
      - ❌
    *
      - :code:`uint4`
      - ✅
      - Philox 4x32-10
      - ✅

Discrete distributions
""""""""""""""""""""""

 .. list-table:: Supported types for discrete distributions on the device
    :header-rows: 1
    :name: device-types-discrete-distribution

    *
      - Type
      - rocRAND support
      - supported rocRAND generators
      - cuRAND support
    *
      - :code:`unsigned int`
      - ✅
      - all generators
      - ✅
    *
      - :code:`uint4`
      - ✅
      - Philox 4x32-10
      - ✅ - only Philox - 4x32-10

.. rubric:: Footnotes
.. [#] Generation of 64 bit :code:`unsigned long long` integers is only supported by 64 bit generators (Scrambled Sobol 64, Sobol64, Threefry 2x64-20 and Threefry 4x64-20).