Skip navigation.
Home

Grafic++ Install with Environment Modules

Grafic++ MPI/C++ code to generate initial conditions for cosmological simulations using multiscale gaussian random fields, based on Edmund Bertschinger's GRAFIC-2 package. Provides a replacement for both grafic1 and grafic2.

Download from sourceforge http://sourceforge.net/projects/grafic/

Extract in a sensible place, change to that directory


cd /usr/local/src/GRAFIC
wget
tar xvf grafic++-1.1.3.tar.gz

Load requisite modules and export FFTW variables (as they won't be found). Seriously, it will drive you nuts if you don't do this.


module load gsl/1.15-gcc
module load fftw/2.1.5-gcc
export FFTW_INC="/usr/local/fftw/2.1.5-gcc/include/"
export FFTW_DIR="/usr/local/fftw/2.1.5-gcc/lib/"

Configure, make, make install


../config
make
make install

Configuration script looks like:


#!/bin/bash
install=$(basename $(pwd) | sed 's%-%/%')
./configure --prefix=/usr/local/$install

Create an environmental module.


cd /usr/local/Modules/modulefiles
ln -s .base 1.1.3

The .base module file looks like this:


#%Module1.0#####################################################################
##
## $name modulefile
##
set ver [lrange [split [ module-info name ] / ] 1 1 ]
set name [lrange [split [ module-info name ] / ] 0 0 ]
set loading [module-info mode load]
set desc [join [read [ open "/usr/local/Modules/modulefiles/$name/.desc" ] ] ]
module-whatis "$desc (v$ver)"
if { $loading && ![ is-loaded gsl/1.15-gcc ] } {
module load gsl/1.15-gcc
}
if { $loading && ![ is-loaded fftw/2.1.5-gcc ] } {
module load fftw/2.1.5-gcc
}
setenv FTW_INC /usr/local/fftw/2.1.5-gcc/include/
setenv FFTW_DIR /usr/local/fftw/2.1.5-gcc/lib/
prepend-path --delim " " CPPFLAGS -I/usr/local/$name/$ver/include
prepend-path --delim " " LDFLAGS -L/usr/local/$name/$ver/lib
prepend-path PATH /usr/local/$name/$ver/bin