News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

CUDA for generation of random floats (REAL4)

Started by aw27, June 22, 2019, 01:55:38 AM

Previous topic - Next topic

aw27

As mentioned in another thread, CUDA has an extensive library for random number generation. I built a very simple example which does not even need preparing a PTX  :skrewy:
Note 1: I am using rdseed to generate a seed, of course it can be replaced by anything else (even a constant number which will allow us to confirm that the cycle will repeat itself).
Note 2: Source is Uasm code.


CUDA has generated 32 floats in the range ]0,1[

Random 1 =      0.373034
Random 2 =      0.774700
Random 3 =      0.534322
Random 4 =      0.176285
Random 5 =      0.009252
Random 6 =      0.991005
Random 7 =      0.133226
Random 8 =      0.946131
Random 9 =      0.593726
Random 10 =     0.999742
Random 11 =     0.563159
Random 12 =     0.800713
Random 13 =     0.361991
Random 14 =     0.391241
Random 15 =     0.926299
Random 16 =     0.062051
Random 17 =     0.441507
Random 18 =     0.705876
Random 19 =     0.198921
Random 20 =     0.637949
Random 21 =     0.877369
Random 22 =     0.086583
Random 23 =     0.341929
Random 24 =     0.388912
Random 25 =     0.398181
Random 26 =     0.864875
Random 27 =     0.156591
Random 28 =     0.113409
Random 29 =     0.289298
Random 30 =     0.459491
Random 31 =     0.048772
Random 32 =     0.080255

<Press any key to Exit>

daydreamer

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

Raistlin

And Vulkan/OpenGL ES 3.1 or up ? There is other stuff besides NVIDIA Cuda
Pretty much the same actually when found....  :skrewy:
Are you pondering what I'm pondering? It's time to take over the world ! - let's use ASSEMBLY...

aw27

#3
Quote from: daydreamer on June 22, 2019, 03:53:00 AM
I dont have CUDA hardware :sad:

I understand and you have my sympathy  :thumbsup:,  but once in a while I do things for people that has hardware less than 5 years old (aka, state of the art )  and bleeding edge graphics card brands (aka NVidia,  :badgrin::biggrin:

Quote from: Raistlin on June 22, 2019, 04:13:17 AM
And Vulkan/OpenGL ES 3.1 or up ? There is other stuff besides NVIDIA Cuda
Pretty much the same actually when found....  :skrewy:

Yes I know, but NVidia rules.  :biggrin:
Actually, OpenCL underperforms significantly CUDA and is more complicated. In case of need, of course, lets go with OpenCL.

daydreamer

Quote from: Raistlin on June 22, 2019, 04:13:17 AM
And Vulkan/OpenGL ES 3.1 or up ? There is other stuff besides NVIDIA Cuda
Pretty much the same actually when found....  :skrewy:
Smartphone can run opengl
but you have to start with make easier apps first
Tried that Rudi?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

aw27

I should add that the NVidia curand.lib in the attachment above is an "import library". So, you will need to install the NVidia SDK version 10 to have access to the paired curand64_10.dll.
In other words, it is difficult to produce an omelette without eggs.  :skrewy:

LiaoMi