Compilation
Compiling with the Non-MPI version of SPRNG
SPRNG 4.0 consists of one library for six random number generators. The library libsprng.a generates streams from the Combine Multiple Recursive Generator, the 48 bit Linear Congruential Generator, the 64 bit Linear Congruential Generator, the modified Lagged Fibonacci Generator, the multiplicative Lagged Fibbonacci Generator, and the Prime Modulus Linear Congruential Generator. In SPRNG versioin 4.0 implementation, the user can generate streams only from all six generators in one program.In order to use a library, the programmer needs to link the code to the desired library. This is generally done by using the following linking option: -Llibdir -llib where libdir is the path to the SPRNG library, and liblib.a is the SPRNG library from which the user desires to generate random numbers. We have provided examples for compilation on different platforms.
If the size of a pointer is 8 bytes, then either the macro SPRNG_POINTER=8 should be defined before including the header file, or this should be done through a compiler option (typically -DSPRNG_POINTER=8). Please take a look at the make.PLAT file of your platform for the correct setting.
In order to compile programs, the user must also indicate the location of the SPRNG header files. This is generally done by passing the -Isrcdir option to the compiler, where srcdir is the path to the SPRNG SRC directory.
The compilation syntax may therefore be one of the following on most compilers:
CC -Isrcdir filename.c -Llibdir -llib
F77 -Isrcdir filename.F -Llibdir -llibwhere CC is the C++ compiler and F77 is the FORTRAN compiler. FORTRAN users may also wish to read the note on preprocessor directives.
We have also provided examples for compilation on different platforms.
Compiling with the MPI version of SPRNG
If the MPI version of SPRNG has been installed, then the user will have to link to the MPI libraries too, in addition to the SPRNG libraries mentioned above. Thus the following syntax for the compilation may be used on most compilers:CC -Isrcdir filename.cpp -Llibdir -llib -Lmpidir -lmpilib
F77 -Isrcdir filename.F -Llibdir -llib -Lmpidir -lmpilibwhere mpidir is the path to the MPI library and libmpilib.a is the name of the MPI library. The MPI library must be linked after the SPRNG library. We have provided examples for compilation on different platforms.