==Gadget Compilation Walkthrough==
This page describes how to compile your own [[http://www.mpa-garching.mpg.de/galform/gadget/index.shtml|Gadget]] and libraries at CHPC.
Before doing anything it is recommended that you create an installation directory (e.g installations) on your /export/home/username/ directory. This will help you avoid any super user conflicts. For the rest of this walkthrough I will refer to /export/home/username/installations/ as PATHINSTALL.
*Prerequisites
*[[http://www.gnu.org/software/gsl/|Gnu Scientific Library]] version 1.15 or above.
*[[http://www.fftw.org/download.html|Fast Fourier Transform in the West]] version 2.1.5 is required for Gadget2. Do not use a later version.
*[[http://www.hdfgroup.org/ftp/lib-external/
szip/2.1/src/szip-2.1.tar.gz|SZIP]] version 2.1 or above.
*[[http://www.hdfgroup.org/ftp/HDF5/prev-releases/|HDF5]] version 1.6 is required. Do not use a later version here.
*First, add these lines in your startup file .profile:
. /etc/profile.d/modules.sh
module load sunstudio
module load clustertools
These lines will help you to load openmpi and other tools that are required to compile and run Gadget. It is also recommended to add them to your job script.
*Compile GSL by following these steps:
*./configure --prefix=/PATHINSTALL
*make
*make install
*Compile FFTW-2.1.5 by following these steps:
*./configure --prefix=/PATHINSTALL --enable-type-prefix --enable-mpi
*make
*make install
*make clean
*./configure --prefix=/PATHINSTALL --enable-float --enable-type-prefix --enable-mpi
*make
*make install
**Note that only FFTW-2.xx can be used because version 3.xx does not work with Gadget2.**
*Compile HDF5 by following these steps:
First build SZIP by following these steps
*./configure --prefix=/PATHINSTALL --enable-shared=no --enable-static=yes
*make
*make install
After building SZIP build HDF5 by following these steps
*./configure -prefix=/PATHINSTALL
*make
*make install
**Note that you need to use HDF5 version 1.6.x to avoid the latest changes in the HDF5 API.**
*Now compile GADGET by following the following steps:
*Find the Makefile and add the "CHPC" SYSTYPE on the list of SYSTYPEs listed and add this code
ifeq ($(SYSTYPE),"CHPC")
CC = mpicc
OPTIMIZE = -O3
GSL_INCL = -I/PATHINSTALL/include
GSL_LIBS = -L/PATHINSTALL/lib -Wl,"-R /PATHINSTALL/lib"
FFTW_INCL= -I/PATHINSTALL/include
FFTW_LIBS= -L/PATHINSTALL/lib
MPICHLIB =
HDF5INCL = -I/PATHINSTALL/include
HDF5LIB = -L/PATHINSTALL/lib -lhdf5
endif
*make
**GADGET is now compiled and you can test it by using one of the examples that come with Gadget download. You can also download a pdf version of this walkthrough {{mygadgetwalkthrough.pdf | here}}**