Next: Accessing MPI and MPE
Up: GRASP Installation
Previous: GRASP File Structure
  Contents
GRASP makes use of many of the functions and subroutines from Numerical Recipes in C [1].
The web site http://www.nr.com/
http://www.nr.com/ is a good source of further information.
These functions and subroutines
are available in Fortran, Pascal, Basic, Kernighan and Ritchie (K&R)
C, and ANSI-C versions; you will need the ANSI-C routines. The source
code for these functions (both *.c and *.h files) must be
installed in a directory (for example, /usr/local/recipes/src)
and the compiled object modules (*.o files) must be archived into
a single library file (*.a file). The instructions for this are
included in the distribution of the source code for Numerical
Recipes. In the end, a file called librecipes_c.a must be put
into a directory where it is available to the linker for compilation.
A good place to put this library is in /usr/local/recipes/lib/librecipes_c.a. When you run the command that
installs GRASP, the linker needs to be able to find these libraries.
The file SiteSpecific must then contain the line RECIPES_LIB = /usr/local/recipes/lib near the top of the file.
It is frequently useful, for debugging purposes, to be able to link
with both ``debug" and ``profile" versions of the libraries. For this
reason, we recommend that users actually create three separate
libraries of Numerical Recipes functions:
- /usr/local/recipes/lib/librecipes_c.a:
a library compiled for fast execution, with optimization options (for
example, -O3 or -xO4) turned on during compilation.
- /usr/local/recipes/lib/librecipes_cg.a:
a library compiled for debugging, with the debug option (typically, -g)
turned on during compilation. Note that in order to use a debugger
with this library, and to be able to step ``within" the Numerical
Recipes functions, the debugger must be able to locate the source code
for Numerical Recipes. Thus, after Numerical Recipes is
compiled and installed, its *.c and *.h source files must be left in
their original locations and not deleted or moved.
- /usr/local/recipes/lib/librecipes_cp.a:
a library compiled for profiling, with the profiling option (typically,
-pg or -xpg for ``gprof" or -p for ``prof") turned on during compilation.
One can then easily compile GRASP code with the appropriate library by
setting LRECIPES in SiteSpecific. For example to run code
as rapidly as possible one would set LRECIPES = recipes_c.
However to compile code for debugging it would be preferable to set
LRECIPES = recipes_cg. (Note that rather than recompiling the
entire GRASP package in this way, one can simplify modify the value of
LRECIPES within the desired Makefiles and then recompile
only the code of interest.)
We have encountered one minor problem with the Numerical Recipes
in C routines. Unfortunately the authors of these routines choose to
name one of their routines select(). This name conflicts with a
POSIX name for one of the standard operating system calls. In linking
with certain libraries (for example the MPI/MPE libraries) this can
generate conflicts where the linker attaches the select() call to
the entry point from the wrong library.
Starting with release 1.6.3 of GRASP, the select() routine from
Numerical Recipes is used in GRASP. For this reason, you must
fix this
as follows. Before building the Numerical Recipes libraries, edit
the source files recipes/rofunc.c, recipes/select.c, and recipes/select.c.orig changing each occurence of select( to NRselect(. You will have to do this in (respectively) four places, one
place and one place in these files. Then edit the file include/nr.h
making the same change of select( to NRselect( in one place.
This will elminate the select() routine from the Numerical
Recipes library, replacing it with a routine called NRselect(),
and eliminating any possible naming conflict from the library.
So, to summarize, the routine called select() in the Numerical
Recipes library is used in GRASP, but is called NRselect() there.
Next: Accessing MPI and MPE
Up: GRASP Installation
Previous: GRASP File Structure
  Contents
Bruce Allen
2000-11-19