# Usage of SPRNG on JUWELS

On JUWELS version 1 as well as version 5 of SPRNG is installed for Intel compiler with ParaStationMPI or IntelMPI and for GCC with ParaStationMPI. There are sequential and parallel routines in SPRNG and there is a C as well as a FORTRAN interface. Version 5 is updated without changing the version number, thus we use a snapshot with the date when it was copied from www as versionsuffix.

To load the library you want you have to say

module load intel-para [Intel IntelMPI] [GCC ParaStationMPI]
for version 1.0

module load intel-para [Intel IntelMPI] [GCC ParaStationMPI]
for version 5.0

There are six different libraries in sprng version 1.0, one for each random number generator.
In version 5.0 there is only one library and to choose the type of random number generator an additional variable is given to each routine.

SPRNG is also available with Intel compiler and IntelMPI and with GCC and ParaStationMPI.

## Sequential C User Program

Compiling and linking a program name.c with calls to libcmrg.a from version 1.0 for example looks as follows:

icc name.c -I$SPRNG1_ROOT/include -L$SPRNG1_ROOT/lib -lcmrg
Compiling and linking a program name.c with calls to libsprng.a (version 5.0) looks as follows:

icc name.c -I$SPRNG5_ROOT/include -L$SPRNG5_ROOT/lib -lsprng

Sequential Fortran User Program

As JURECA is a 64-Bit machine remember to use 64-Bit Fortran pointers! SPRNG is compiled with -DPOINTER_SIZE=8 to get the correct pointers in the C source code.
Compiling and linking a program name.f with libcmrg.a from version 1.0 for example looks as follows:

ifort -I$SPRNG1_ROOT/include name.f -L$SPRNG1_ROOT/lib -lcmrg
Compiling and linking a program name.f with libsprng.a (version 5.0) looks as follows:

ifort -I$SPRNG5_ROOT/include name.f -L$SPRNG5_ROOT/lib -lsprng

## MPI-parallel C User Program

Compiling and linking a parallel program name.c with calls to libcmrg.a from version 1.0 for example looks as follows:

mpicc -I$SPRNG1_ROOT/include name.c -L$SPRNG1_ROOT/lib -lcmrg
Compiling and linking a parallel program name.c with calls to libsprng.a (version 5.0) looks as follows:

mpicc -I$SPRNG5_ROOT/include name.c -L$SPRNG5_ROOT/lib -lsprng

## MPI-parallel Fortran User Program

Compiling and linking a parallel program name.f with calls to libcmrg.a from version 1.0 for example looks as follows:

mpif90 -I$SPRNG1_ROOT/include name.f -L$SPRNG1_ROOT/lib -lcmrg
Compiling and linking a parallel program name.f with calls to libsprng.a (version 5.0) looks as follows:

mpif90 -I$SPRNG5_ROOT/include name.f -L$SPRNG5_ROOT/lib -lsprng

## Examples

The directory $SPRNG1_ROOT/EXAMPLES contains examples that illustrate the use of the sequential and the parallel SPRNG software version 1.0 in C and Fortran. To compile and execute the sequential examples, the following commands are sufficient: module load intel-para sprng/1 cp -r$SPRNG1_ROOT/EXAMPLES $HOME cd$HOME/EXAMPLES
make
There is a sample batchseq which shows how to execute all the sequential examples. All the necessary input files are also provided. For more information read the header of the sources of the examples and the file README in EXAMPLES.

To compile the parallel examples, the following commands are sufficient:

cp -r $SPRNG1_ROOT/EXAMPLES$HOME
cd $HOME/EXAMPLES make mpi The directory$SPRNG5_ROOT/EXAMPLES contains examples that illustrate the use of the sequential and the parallel SPRNG software version 5.0 in C and Fortran.
To compile the examples, the following commands are necessary:

cp -r $SPRNG5_ROOT/EXAMPLES$HOME
cd \$HOME/EXAMPLES

Here you now find sequential C++ examples, a directory F77 with sequential F77 examples and a directory mpisprng containing C++ examples for MPI usage and a subdirectory F77 containing F77 examples for MPI usage.
In each directory there is a Makefile. I you say

make

in one of the directories the corresponding examples are compiled and linked. The sequential examples can be executed on the login-nodes, to execute the MPI examples you have to write a batch job and submit it.