Author Topic: CUDA for generation of random floats (REAL4)  (Read 571 times)

AW

  • Member
  • *****
  • Posts: 2388
  • Let's Make ASM Great Again!
CUDA for generation of random floats (REAL4)
« on: June 22, 2019, 01:55:38 AM »
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.

Code: [Select]
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

  • Member
  • ****
  • Posts: 926
  • watch Chebyshev on the backside of the Moon
Re: CUDA for generation of random floats (REAL4)
« Reply #1 on: June 22, 2019, 03:53:00 AM »
I dont have CUDA hardware :sad:
Quote from Flashdance
Nick  :  When you give up your dream, you die
*wears a flameproof asbestos suit*
Gone serverside programming p:  :D

Raistlin

  • Member
  • ****
  • Posts: 502
Re: CUDA for generation of random floats (REAL4)
« Reply #2 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:
Are you pondering what I'm pondering? It's time to take over the world ! - let's use ASSEMBLY...

AW

  • Member
  • *****
  • Posts: 2388
  • Let's Make ASM Great Again!
Re: CUDA for generation of random floats (REAL4)
« Reply #3 on: June 22, 2019, 04:18:46 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:

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.
« Last Edit: June 22, 2019, 01:48:46 PM by AW »

daydreamer

  • Member
  • ****
  • Posts: 926
  • watch Chebyshev on the backside of the Moon
Re: CUDA for generation of random floats (REAL4)
« Reply #4 on: June 22, 2019, 03:00:35 PM »
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?
Quote from Flashdance
Nick  :  When you give up your dream, you die
*wears a flameproof asbestos suit*
Gone serverside programming p:  :D

AW

  • Member
  • *****
  • Posts: 2388
  • Let's Make ASM Great Again!
Re: CUDA for generation of random floats (REAL4)
« Reply #5 on: June 22, 2019, 03:01:47 PM »
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

  • Member
  • ****
  • Posts: 590
Re: CUDA for generation of random floats (REAL4)
« Reply #6 on: June 23, 2019, 09:27:36 PM »
Hi AW! Thanks for the cool example!