[Paper Review] Fast normal random number generators on vector processors
This paper presents optimized vectorized implementations of the Box-Muller and Polar methods for generating fast, high-quality normal random numbers on vector processors like the Fujitsu VP2200/10. It demonstrates that the Polar method, with algorithmic refinements and fast polynomial approximations for trigonometric functions, achieves superior performance—21.9 cycles per normal deviate—outperforming both the standard Box-Muller and other rejection-based methods on this architecture.
We consider pseudo-random number generators suitable for vector processors. In particular, we describe vectorised implementations of the Box-Muller and Polar methods, and show that they give good performance on the Fujitsu VP2200. We also consider some other popular methods, e.g. the Ratio method of Kinderman and Monahan (1977) (as improved by Leva (1992)), and the method of Von Neumann and Forsythe, and show why they are unlikely to be competitive with the Polar method on vector processors.
Motivation & Objective
- To develop efficient, vectorizable normal random number generators suitable for high-performance vector processors.
- To evaluate and compare the performance of classical normal random number generation methods—Box-Muller, Polar, Ratio, and Von Neumann–Forsythe—on vector architectures.
- To minimize computational overhead by replacing expensive transcendental functions with fast polynomial approximations and optimizing rejection logic.
- To demonstrate that simple, old-fashioned methods can outperform complex, optimized serial algorithms when properly vectorized.
Proposed method
- Vectorized implementation of the Box-Muller method using fast inline polynomial approximations for sin and cos functions, reducing reliance on expensive library calls.
- Use of the Polar method (Marsaglia–Bray variant) with rejection sampling in the unit circle to avoid trigonometric functions, replacing them with a single square root and logarithm per pair of deviates.
- Employment of vector gather/scatter operations to efficiently handle rejection loops, enabling high-throughput generation on vector architectures.
- Optimization of transcendental functions (ln, sqrt, sin, cos) via polynomial approximations with absolute error < 10⁻¹⁰, ensuring statistical quality.
- Use of the generalized Fibonacci generator RANU4 for uniform random number generation, with a 2.2-cycle per number cost on the VP2200/10.
- Implementation of the Ratio method and Von Neumann–Forsythe (GRAND) methods for comparison, with analysis of their vectorization inefficiencies due to unbounded iteration and scattered control flow.
Experimental results
Research questions
- RQ1Can classical normal random number generation methods like Box-Muller and Polar be effectively vectorized for high-performance computing?
- RQ2Why do rejection-based methods like the Ratio method and GRAND perform poorly on vector processors despite their efficiency on serial machines?
- RQ3What is the performance trade-off between using expensive transcendental functions (sin, cos, ln) versus increased uniform random number generation and rejection logic in vectorized generators?
- RQ4How do fast polynomial approximations for trigonometric functions impact both performance and statistical quality of the output?
- RQ5What is the optimal vectorized normal random number generator architecture for a vector processor like the Fujitsu VP2200/10?
Key findings
- The vectorized Polar method achieved 21.9 machine cycles per normally distributed random number on the Fujitsu VP2200/10, outperforming the best Box-Muller implementation at 26.3 cycles.
- The use of fast polynomial approximations for sin and cos reduced the cost of trigonometric evaluations, enabling efficient vectorization of the Box-Muller method.
- The Ratio method, despite reducing logarithm evaluations, was outperformed due to high overhead from vector scatter/gather operations and lower output rate (half as many deviates per cycle).
- GRAND and similar iterative rejection methods were found unsuitable for vectorization due to unbounded iteration counts and complex region-based rejection logic, leading to poor performance.
- The Polar method’s rejection step, while requiring 4/π ≈ 1.27 uniform random numbers per deviate on average, proved more efficient overall due to elimination of expensive trigonometric functions.
- Statistical quality was preserved, with approximation errors in transcendental functions kept below 10⁻¹⁰, ensuring undetectable bias in tests using up to 10²⁰ random numbers.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.