Home Ask Login Register

Developers Planet

Your answer is one click away!

Cervo Hillary February 2016

Concurrent Communicating Kernels in CUDA?

Lets say I have a device with 2880 cuda cores.

I want to run a Monte Carlo simulation where:

  • 2000 threads are each running a sample
  • 880 threads are generating random numbers

This is because:

  • I only want 2000 samples therefore the other 880 would be sitting idle
  • I know that generating random numbers can be slow

Therefore I want to make a pool of random numbers that is replenished continuously by the 880 threads which the 2000 sample threads can take when required.

Is this possible? If so, please provide an example.


pszilard February 2016

Strictly speaking what you propose does not even seem to be possible in CUDA and, as others point out, it's surely not a good idea. You may want to pick up a book or an online course first to familiarize with the GPU programming concepts.

More to the point, if you want to dive in straight, here's an MC pi example solved with CUDA, OpenACC and Thrust.

Post Status

Asked in February 2016
Viewed 3,961 times
Voted 5
Answered 1 times


Leave an answer

Quote of the day: live life