>

Users Guide:Installation: Makefiles


SPRNG Makefiles

The following information may help you port SPRNG to your machine.

Platform dependent compilation

There is a file included in the SPRNG distribution called make.CHOICES which sets the platform for compilation. Once this file is properly edited, the user can build the SPRNG libraries by simply using the make command.

The make.CHOICES file looks like this:

 
#PLAT = CONVEX 
PLAT = SGI 
#PLAT = SP2 
#PLAT = T3E 

If users wish to build SPRNG on the HP/Convex Exemplar, then they should comment out the line specifying the SGI and uncomment the line specifying the CONVEX as follows:

 
PLAT = CONVEX 
#PLAT = SGI 
#PLAT = SP2 
#PLAT = T3E 

Then, the make command will build the libraries using the compiler options set in the file SRC/make.CONVEX The user may wish to edit this file if a different compiler or different compiler options are wanted.

Variables in the Make.PLAT

We shall next describe the different variables defined in the make.platform files. The makefile includes information from this file in order to determine the values of certain variables. We take as an example platform the make.SGI for use in an SGI Power Challenge. The relevant portion of the file is as follows:

 
AR = ar 
ARFLAGS = cr 
#If your system does not have ranlib, then replace next statement with  
#RANLIB = echo 
RANLIB = ranlib 
CC = cc 
CLD = $(CC) 
F77 = f77 
F77LD = $(F77) 
FFXN = -DAdd_ 
# 64 bit compilation 
# 
# To use MPI, set the MPIDIR to location of mpi library, and MPILIB  
# to name of mpi library. Remove # signs from beginning of next 3 lines. 
# Also, if the previous compilation was without MPI, type: make realclean 
# before compiling for mpi. 
# 
MPIDEF = -DSPRNG_MPI #Only if you plan to use MPI 
MPIDIR = -L/usr/lib64 
MPILIB = -lmpi 
# 
CFLAGS = -O2 -D$(PLAT) $(MPIDEF) -D_LONG_LONG -align64 -64   
CLDFLAGS =  -align64 -64 # 64 bit compilation 
FFLAGS = -O2 -align64   $(MPIDEF)  -DPOINTER_SIZE=8 -D_LONG_LONG -64  #64 bit compilation 
F77LDFLAGS =  -align64 -64 # 64 bit compilation 
CPP = gcc -E -P   $(MPIDEF)  -DPOINTER_SIZE=8 -D_LONG_LONG # 64 bit compilation 
INLINEOPT = -INLINE:must=get_rn_int,get_rn_dbl,get_rn_flt,get_rn_int_simple,get_rn_flt_simple,get_rn_dbl_simple 

Descriptions of variables

AR is the command to archive the library.

ARFLAGS is the flag to the archiver. Here we create the library or replace the object files already archived.

RANLIB is essentially used to generate the table of contents to the library. You can set this to "echo" if ranlib is not available on your machine.

CC and CLD are the C compiler and loader respectively.

F77 and F77LD are the FORTRAN77 compiler and loader respectively. If they are not avaiable, then set them to 'echo'.

FFXN is needed for the following reason. SPRNG is written in C. FORTRAN wrappers are also available, which provide an interface to FORTRAN users. These wrappers are actually C functions. When a FORTRAN user calls a wrapper function fxn, FORTRAN compilers often change the name to something else, for example fxn_. Thus the wrappers should also have their function names modified the same way. The flag FFXN ensures that the correct modification is made to the wrapper function names during SPRNG installation. You can ignore FFXN if you do not wish to get a FORTRAN interface, and have set F77 to "echo".

CFLAGS and CLDFLAGS are the flags to the C compiler and loader respectively.

FFLAGS and F77LDFLAGS are the flags to the FORTRAN77 compiler and loader respectively.

CPP is provided for the sake of those FORTRAN compilers which are not capable of calling the C preprocessor. SPRNG executables and example programs in FORTRAN have names of the form filename.F, and involve preprocessing directives. If some compiler cannot accept such a file, then we preprocess the file using the command:

CPP filename.F

The resulting file is called either filename.f or filename.i. In the latter case, the user should move it to a file called filename.f by issuing the following command:

mv filename.i filename.f

filename.f can be processed by the user's FORTRAN compiler. You can ignore this if your FORTRAN compiler can invoke the preprocessor itself, or if you do not wish to compile FORTRAN programs.

MPIDEF should be set to -DSPRNG_MPI if the user is installing the MPI version of SPRNG. This line should be commented out, by appending a # sign, or removed otherwise. This flag causes a macro called SPRNG_MPI to be defined in the SPRNG code, which enables calls to MPI functions.

MPIDIR indicates the path to the MPI library.

MPILIB indicates the name of the MPI library.

Note: MPIDEF, MPIDIR and MPILIB should be commented out or removed if the user does not wish to install the MPI version of SPRNG.

Users may wish to use the above variables and flags in compiling their programs too. However, the flags -DSPRNG_MPI and -D_LONG_LONG, and the variables MPIDEF and FFXN are needed only during the SPRNG installation. Users can take a look at the Makefile in the EXAMPLES directory in order to see some compilation flags that they might wish to use.

The flag -DPOINTERSIZE=8 indicates that the size of the pointer is 8 bytes. The default value assumed by SPRNG is 4 bytes. You must set this to the 8 if your machine has 8-bit pointers.

INLINEOPT gives compiler options to inline certain functions, in order to improve efficiency. You can ignore this if you are not that concerned about efficiency.

Porting SPRNG to new machines

Please set the PLAT variable in make.CHOICES to GENERIC and edit the make.GENERIC to suit your system, after reading the explanations above. Little Endian machines may need the option: -DLittleEndian added to CFLAGS. In order to optimize the performance, please try the following: (i) Add -D_LONG_LONG to CFLAGS and/or(ii) Add -DGENERIC to CFLAGS. If checksprng passes, then SPRNG is installed correctly. If not, please remove whichever option caused SPRNG to fail and recompile.
[Quick 
Start] [User's 
Guide] [Reference 
Manual] [Quick 
Reference]