## Introduction

SPRNG is a set of libraries for scalable and portable pseudorandom number generation, and has been developed keeping in mind the requirements of users involved in parallel Monte Carlo simulations.Monte Carlo calculations consume a large fraction of all supercomputing cycles. The accuracy of these computations is critically influenced by the quality of the random number generators used. While the issue of random number generation in sequential calculations has been well studied, albeit on less powerful computers, there has been comparatively less work done in the context of parallel Monte Carlo applications. SPRNG seeks to fill this gap by implementing parallel random number generators that satisfy the requirements given below.

## Desiderata for parallel random number generators

Users generally desire the following from any parallel random number generator:

- Quality:

- Provide ``high quality'' pseudorandom numbers in a computationally inexpensive and scalable manner.

- Reproducibility:

- Provide totally reproducible
streamsof parallel pseudorandom numbers, independent of the number of processors used in the computation and of the loading produced by sharing of the parallel computer.

- Locality:

- Allow for the creation of unique pseudorandom number streams on a parallel machine with minimal interprocessor communication.

- Portability:

- Should be portable between serial and parallel platforms and must be available on the most commonly used workstations and supercomputers.

SPRNG provides pseudorandom number generators that satisfy the above requirements.

## Generators implemented in SPRNG

With the above goals in mind, SPRNG provides user-friendly interfaces for parallel FORTRAN and C programs which enables the user to easily obtain sufficiently uncorrelated pseudorandom number streams on different processors, with minimal inter-processor communication. Furthermore, the user can generate random numbers from more than one stream on each processor.The generators implemented in SPRNG are (i) two versions of Linear Congruential with Prime Addend and (ii) modified Additive Lagged Fibonacci (iii) Multiplicative Lagged Fibonacci (iv) Combined Multiple Recursive Generator (v) Prime Modulus Linear Congruential Generator.

## SPRNG functionality

SPRNG provides more functionality than just the ability to generate independent streams on different processors. We mention two of these and their applications below. (i) In order to balance the load the user may want to assign the computations involving a particular random number stream to a different process. A user may also want tocheck-pointthe program. SPRNG facilitates these tasks by enabling the user to obtain the state of a stream in amachine independentformat using the functions(un)pack_sprng. (ii) In some branching computations, new generators arespawnedfrom old ones. SPRNG enables the spawning of new streams while ensuring their independence from streams on any of the processors, with minimal inter-processor communication. Further details on the functionality provided by SPRNG is given in the section on SPRNG usage.

## SPRNG features

In order to be accessible to a wide spectrum of supercomputer users, SPRNG has the following features:

- Generators:

- 48 bit Linear Congruential, 64 bit Linear Congruential, modified Additive Lagged Fibonacci, (iii) Multiplicative Lagged Fibonacci, Combined Multiple Recursive, and Prime Modulus Linear Congruential(iii) generators are implemented

- Languages:

- C and FORTRAN interfaces are available. SPRNG is also callable from C++.

- Message Passing:

- Support is available for programs using MPI for message passing. Support for PVM may be added in later versions. However, PVM programs can still use the current version.

- Test Suite:

- A test suite with statistical tests and tests based on physical models (ex ISING model) is now provided. This can easily be used to test new generators.

- Platforms:

- SPRNG has been ported to CRAY T3E, HP/Convex Exemplar, IBM SP2, SGI-CRAY Origin 2000 and SGI Power Challenge parallel computers. It has also been ported to HP and SUN workstations, and also to PCs running Linux.

- Extensibility:

- SPRNG is easy to extend, and new parallel generators can easily be developed to support SPRNG features.