Cosmological N-Body Simulation
Cosmological N-Body Simulation
Download MPI from https://www.mpich.org/downloads/. Then unzip the file and move to the directory created during the extraction process. Configure the environment for the source file and compiling it, install the build file. The upcoming installation of GSL, FFTW3, HDF5, and Hwloc will follow to the same procedure.
$ wget https://www.mpich.org/static/downloads/4.1.2/mpich-4.1.2.tar.gz
$ tar -xzvf mpich-4.1.2.tar.gz
$ cd mpich-4.1.2
$ ./configure -prefix=/your/directory/lib/mpich/4.1.2
$ make
$ make install
Download GSL from https://www.gnu.org/software/gsl/.
$ wget https://mirror.ibcp.fr/pub/gnu/gsl/gsl-latest.tar.gz
$ tar -xzvf gsl-latest.tar.gz
$ cd gsl-2.7.1
$ ./configure -prefix=/your/directory/lib/gsl/2.7.1
$ make
$ make install
Download FFTW3 from http://www.fftw.org/download.html.
$ wget http://www.fftw.org/fftw-3.3.10.tar.gz
$ tar -xzvf fftw-3.3.10.tar.gz
$ cd fftw-3.3.10
$ ./configure -prefix=/your/directory/lib/fftw/3.3.10 --enable-float --enable-sse && make install
Download HDF5 from https://portal.hdfgroup.org/display/support/Download+HDF5.
$ wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.10/src/hdf5-1.10.10.tar.gz
$ tar -xzvf hdf5-1.10.10.tar.gz
$ cd hdf5-1.10.10
$ ./configure -prefix=/your/directory/lib/hdf5/1.10.10
$ make
$ make install
Download Hwloc from https://www.open-mpi.org/software/hwloc/v2.9/.
$ wget https://download.open-mpi.org/release/hwloc/v2.9/hwloc-2.9.1.tar.gz
$ tar -xzvf hwloc-2.9.1.tar.gz
$ cd hwloc-2.9.1
$ ./configure -prefix=/your/directory/lib/hwloc/2.9.1
$ make
$ make install
Add the environment variables of the previously installed libraries into the bashrc file.
$ vi ~/.bashrc
export GSL=/your/directory/lib/gsl/2.7.1
export FFTW3=/your/directory/lib/fftw/3.3.10
export HDF5=/your/directory/lib/hdf5/1.10.10
export MPICH=/your/directory/lib/mpich/4.1.2
export HWLOC=/your/directory/lib/hwloc/2.9.1
export LD_LIBRARY_PATH=${GSL}/lib:${FFTW3}/lib:${HDF5}/lib:${MPICH}/lib:${HWLOC}/lib:$LD_LIBRARY_PATH
export PATH=${GSL}/bin:${FFTW3}/bin:${HDF5}/bin:${MPICH}/bin:${HWLOC}/bin:$PATH
$ source ~/.bashrc
Clone the GitHub repository provided below code to your local machine.
$ git clone http://gitlab.mpcdf.mpg.de/vrs/gadget4
Copy Template-Config.sh to Config.sh and Template-Makefile.systype to Makefile.systype.
Modify the Makefile.systype.
#SYSTYPE=”hydra”
->
SYSTYPE=”hydra”
Modify the buildsystem/Makefile.path.hydra to suit.
GSL_INCL = -I/u/system/SLES11/soft/gsl/1.16/include
GSL_LIBS = -L/u/system/SLES11/soft/gsl/1.16/lib -Xlinker -R -Xlinker /u/system/SLES11/soft/gsl/1.16/lib
FFTW_INCL = -I/u/system/SLES11/soft/fftw/3.3.4/intel-14.0/mpi.ibm-1.4/include
FFTW_LIBS = -L/u/system/SLES11/soft/fftw/3.3.4/intel-14.0/mpi.ibm-1.4/lib -Xlinker -R -Xlinker /u/system/SLES11/soft/fftw/3.3.4/intel-14.0/mpi.ibm-1.4/lib
HDF5_INCL = -I/u/system/SLES11/soft/hdf5/1.8.14/intel14.0/serial/include
HDF5_LIBS = -L/u/system/SLES11/soft/hdf5/1.8.14/intel14.0/serial/lib -Xlinker -R -Xlinker /u/system/SLES11/soft/hdf5/1.8.14/intel14.0/serial/lib
HWLOC_INCL = -I/u/anbau/hwloc-1.11.2/include
HWLOC_LIBS = -L/u/anbau/hwloc-1.11.2/lib -Xlinker -R -Xlinker /u/anbau/hwloc-1.11.2/lib
->
GSL_INCL = -I${GSL}/include
GSL_LIBS = -L${GSL}/lib
FFTW_INCL = -I${FFTW3}/include
FFTW_LIBS = -L${FFTW3}/lib
HDF5_INCL = -I${HDF5}/include
HDF5_LIBS = -L${HDF5}/lib
HWLOC_INCL = -I${HWLOC}/include
HWLOC_LIBS = -L${HWLOC}/lib
Verify if Gadget4 working properly by simulating the DM-L50-N128 example.
$ make -j8 DIR=examples/DM-L50-N128
$ cd examples/DM-L50-N128
$ mpirun -np 8 ./Gadget4 param.txt
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
make: *** [Makefile:480: Gadget4] Error 1
$ sudo apt-get install zlib1g-dev
The default setting for the Gadget is to utilize only 50% of your computer's RAM. To modify this setting, you can use the following code to control the amount of RAM usage.
$ sudo mount -o remount, size=95% /dev/shm
https://cmake.org/files/
$ wget https://github.com/Kitware/CMake/releases/download/v3.29.2/cmake-3.29.2.tar.gz
https://cmake.org/files/v3.1/cmake-3.1.3.tar.gz
$ tar -xvzf cmake-3.29.2.tar.gz
$ cd cmake-3.29.2
$ ./bootstrap --prefix=/your/directory/lib/cmake/3.29.2
$ make
$ make install
$ echo 'export PATH=/your/directory/lib/cmake/3.29.2/bin:$PATH' >> ~/.bashrc
$ source ~/.bashrc
$ cmake --version
$ git clone https://bitbucket.org/helsinkiextragalacticgroup/ketju-integrator.git
$ cd ketju-integrator
$ cmake /your/directory/ -DPYTHON_EXECUTABLE=/your/directory/python3
$ cmake --build . -- -j8
$ mpirun -np 2 bin/nbody nbody/nbody_sample_ic.txt 1e-3 10 1e-8
$ git clone https://bitbucket.org/helsinkiextragalacticgroup/gadget4-ketju.git
$ cd gadget4-ketju
Follow the progress of gadget4.
After that,
$ vi Makefile
Modify KETJU_INTEGRATOR_DIR ?= ../ketju-integrator
If you've followed this tytorial, you don't need to fix it.
$ make -j8 DIR=examples/KetjuBHs
$ cd examples/KetjuBHs
$ mpirun -np 8 ./Gadget4 param.txt