Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating random numbers: CPU vs GPU, which currently wins?

I've been working on a physics simulations requiring the generation of a large amount of random numbers (at least 10^13 if you want an idea). I've been using the C++11 implementation of the Mersenne twister. I've also read that GPU implementation of this same algorithm are now a part of Cuda libraries and that GPU can be extremely efficient at this task; but I couldn't find explicit numbers or a benchmark comparison. For example compared to an 8 cores i7, are Nvidia cards of the last generations more performant in generating random numbers? If yes, how much and in which price range?

I'm thinking that my simulation could gain from having a GPU generating a huge pile of random numbers and the CPU doing the rest.

like image 554
Liam Avatar asked Jan 07 '14 11:01

Liam


People also ask

What is the best random number algorithm?

You can think of the seed as a snippet of randomness. However, the Mersenne Twister has since replaced linear congruential generators and is still the most popular PRNG algorithm used today. While pseudorandom numbers aren't random in truth, there are many reasons why they're used.

Is it possible to predict a computer generated random number?

Surprisingly, the general-purpose random number generators that are in most widespread use are easily predicted. (In contrast RNGs used to construct stream ciphers for secure communication are believed to be infeasible to predict, and are known as cryptographically secure).

What are the earliest methods for generating random numbers?

Physical methods The earliest methods for generating random numbers, such as dice, coin flipping and roulette wheels, are still used today, mainly in games and gambling as they tend to be too slow for most applications in statistics and cryptography.

How does a computer generate random numbers?

A true random number generator (TRNG), also known as a hardware random number generator (HRNG), does not use a computer algorithm. Instead, it uses an external unpredictable physical variable such as radioactive decay of isotopes or airwave static to generate random numbers.


1 Answers

Some comparisons can be found here: https://developer.nvidia.com/cuRAND

like image 50
ngimel Avatar answered Oct 10 '22 01:10

ngimel