Back
Quside Blog
Monte Carlo and Randomness in Random Number Generator

26 de agosto de 2022
Contact

# How much resource is randomness taking in your Monte Carlo code?

Since their invention during World War II to solve hydrodynamic problems involving atomic bombs, Monte Carlo methods have established themselves in many disciplines. From science and technology to finance and logistics, virtually every field that in one way or another must deal with highly complex problems eventually turns to a Monte Carlo method as a means of solving them.

This fact is mainly due to the incredible versatility of Monte Carlo algorithms. Given that many mathematical problems accept a solution in terms of a Monte Carlo algorithm, these methods often become the only workable solution for complex instances of the problem.

However, their great versatility is often also a double-edged sword. In contrast to more specialized algorithms tailored to solve a given problem, Monte Carlo algorithms typically require more time to find an accurate solution. This fact makes Monte Carlo methods a “last resort” solution for many disciplines, thus being only used when there is no other method with a lower required computational effort that can adapt to the constraints and parameters of the current problem instance.

Surprisingly, in a non-negligible part of the cases, most of this vast computational effort of Monte Carlo simulations comes from the underlying processes of generating sequences of pseudo-random numbers and their subsequent transformation into the probability distribution used in solving the problem. In some cases, these calculations can account for more than 50% of the total simulation time, going up to 90-95% of the whole time in extreme cases.

This fact is often an unexpected revelation for most specialists. After all, they expect that it is the business logic (which is the part that generates the largest added value) the one that consumes the most computational resources. In fact, having the computational resources dedicated to the parts with the highest added value should be the case in any optimized simulation and the goal of any high-performance developer.

We at Quside believe we can help as designers of ultrafast entropy sources based on quantum processes. By adding several additional algorithms and developments on top of our entropy sources, our randomness acceleration platform allows our devices to be used as hardware accelerators for running the most demanding stochastic workloads. These include all the generation and post-processing of the most used distributions in all kinds of Monte Carlo simulations. In this way, the accelerator assumes the load of generating these distributions, freeing the rest of the computational capacity to focus on the business logic and optimizing the effectiveness, efficiency, and economy of the existing computational resources.

In addition, being able to generate probability distributions in such an efficient way increases the speed of sample generation. This speed is fundamental when establishing the accuracy of a Monte Carlo simulation. The low convergence speed of these Monte Carlo algorithms can thus be compensated by the high sampling speed. This compensation allows the Monte Carlo method to stop being a “last resort” method and become a complementary resource for tackling almost any numerical problem.

Additionally, using a high-quality entropy source such as Quside’s guarantees the simulation’s quality and correct results. By integrating it, any potential artifacts that the pseudo-generator may introduce banish since we are using a pure entropy source to perform the simulations.

This advantage is especially relevant in parallel computing environments. The Monte Carlo algorithm is generally extraordinarily easy to run in multiple independent instances, unifying the results of each instance and thus increasing the speed of the method proportionally to the number of simulations run in parallel. However, all the simulations performed must be independent to do this parallelization with mathematical guarantees. In terms of generating distributions, this requires that all the pseudo-generators feeding each simulation are decorrelated to each other, which can only be fully guaranteed if each has an independent entropy source, such as Quside’s.