#! /bin/csh -f # # (somewhat linux centric) example self-contained install script for Gadget and all the needed # companion libraries on a single processor machine; # you probably want to edit this file, or use the commandline parameters, # to make it work for you. See an example below. # Of course it's quite possible that some, or all, of the needed libraries already # exist on your system. In that case, this script may not be as useful for you, # or just replace the particular library with a silly value, e.g. gsl=0 # # For gadget, see http://www.mpa-garching.mpg.de/gadget/ # For NEMO suport, see http://www.astro.umd.edu/nemo/ # notably gadgetsnap and snapgadget # # some of the packages (gsl and lam) take quite a while to compile, so be patient # if your system did not come with it. # # Example usage: # # gadget.install download=1 prefix=$HOME/opt gsl=gsl-1.6.tar.gz # # would download all packages in the current working directory, install # the binaries/libraries at $HOME/opt, but use gsl V1.6 instead of the # default 1.4 version. On an AMD64/3200 (a fairly fast machine in 2005) # this command takes about xx minutes, of which 35 minutes is the galaxy # benchmark and 1 minute of download time. Total space needed was xxx MB, # which includes xxx MB for the benchmark. # # The original CVS version of this script can be found in $NEMO/src/scripts # but has been written to be NEMO agnostic. Using manybody= a MANYBODY install # can be facilitated (http://www.manybody.org) # It was also used at PITP-2009 # # Notes: lam-7.1.4 doesn't work well with gcc 4.3.0 (no bool type?), hence the update # # # $Id: gadget.install,v 1.22 2009/06/07 18:13:36 pteuben Exp $ set fftw_base=http://www.fftw.org/ set gsl_base=ftp://ftp.gnu.org/gnu/gsl/ set hdf_base=ftp://ftp.ncsa.uiuc.edu/HDF/HDF5/current/src/ set lam_base=http://www.lam-mpi.org/download/files/ set gadget_base=http://www.mpa-garching.mpg.de/gadget/ set fftw=fftw-2.1.5.tar.gz set gsl=gsl-1.12.tar.gz set hdf=hdf5-1.8.3.tar.gz set lam=lam-7.1.4.tar.gz set lam=lam-7.1.5b1.tar.gz set gadget=gadget-2.0.4.tar.gz set prefix=`pwd`/opt set manybody=0 set help=0 set bench=1 set download=0 set curl=1 if ($#argv == 1) then # be nice to those who expect -h or --help if (X$1 == X-h) goto help if (X$1 == X-help) goto help if (X$1 == X--help) goto help endif foreach _arg ($*) set $_arg end if ($help) goto help # force symlinks? (useful for MANYBODY) if ($manybody != 0) then ln -s $manybody/lam/$lam ln -s $manybody/gsl/$gsl ln -s $manybody/fftw/$fftw ln -s $manybody/hdf/$hdf ln -s $manybody/gadget/$gadget endif # alternatively download them on-the-fly, no tar files are saved if ($download) then if ($curl) then set cmd=(curl) else set cmd=(wget -O -) endif $cmd $fftw_base/$fftw | tar zxf - $cmd $gsl_base/$gsl | tar zxf - $cmd $hdf_base/$hdf | tar zxf - $cmd $lam_base/$lam | tar zxf - $cmd $gadget_base/$gadget | tar zxf - endif # set rc=$prefix/gadget_start.csh mkdir -p $prefix echo "# automatically created by $0, careful with editing" > $rc echo "# date: `date`" >> $rc echo "# args: $*" >> $rc # lam (gcc 4.3.0 and up don't know bool - need newer LAM) if (-e $lam) tar zxf $lam set dir=`basename $lam .tar.gz` if (-e $dir) then pushd $dir ./configure --prefix=$prefix make make install popd # the new mpicc better be in the path now echo 'set prefix='$prefix >> $rc echo 'set path=($prefix/bin $path) ' >> $rc echo 'rehash' >> $rc source $rc echo "$lam `date`" >> $prefix/installed.log else echo WARNING: No $lam or $dir endif # gsl if (-e $gsl) tar zxf $gsl set dir=`basename $gsl .tar.gz` if (-e $dir) then pushd $dir ./configure --prefix=$prefix make make install popd echo "$gsl `date`" >> $prefix/installed.log else echo WARNING: No $gsl or $dir endif # fftw, still needs V2, V3 doesn't work if (-e $fftw) tar zxf $fftw set dir=`basename $fftw .tar.gz` if (-e $dir) then pushd $dir ./configure --enable-mpi --enable-type-prefix --prefix=$prefix make make install make clean ./configure --enable-mpi --enable-type-prefix --prefix=$prefix --enable-float make make install popd echo "$fftw `date`" >> $prefix/installed.log else echo WARNING: No $fftw or $dir endif # hdf5 if (-e $hdf) tar zxf $hdf set dir=`basename $hdf .tar.gz` if (-e $dir) then pushd $dir ./configure --prefix=$prefix make make install popd echo "$hdf `date`" >> $prefix/installed.log else echo WARNING: No $hdf or $dir endif # make sure prefix/bin exists, if any of the above were not used if (! -d $prefix/bin) mkdir $prefix/bin # gadget, for all standard problems if (-e $gadget) tar zxf $gadget set dir=`basename $gadget .tar.gz | sed s/g/G/` if (-e $dir) then pushd $dir/Gadget2 foreach problem (cluster galaxy gassphere lcdm_gas) make -f parameterfiles/$problem.Makefile clean make -f parameterfiles/$problem.Makefile \ CC=mpicc OPTIMIZE="-O3 -Wall" \ GSL_INCL= GSL_LIBS= \ FFTW_INCL=-I$prefix/include FFTW_LIBS=-L$prefix/lib \ MPICHLIB= \ HDF5INCL=-I$prefix HDF5LIB="-lhdf5 -lz" cp Gadget2 $prefix/bin/Gadget2.$problem end popd echo "$gadget `date`" >> $prefix/installed.log else echo WARNING: No $gadget or $dir set bench=0 endif # galaxy: one of the gadget benchmark's if ($bench) then set dir=`basename $gadget .tar.gz | sed s/g/G/` pushd $dir if (! -e galaxy) mkdir galaxy echo ' if ($?LD_LIBRARY_PATH) then' >> $rc echo ' setenv LD_LIBRARY_PATH $prefix/lib:$LD_LIBRARY_PATH ' >> $rc echo ' else' >> $rc echo ' setenv LD_LIBRARY_PATH $prefix/lib' >> $rc echo ' endif' >> $rc echo 'lamboot' >> $rc source $rc time Gadget2.galaxy Gadget2/parameterfiles/galaxy.param >& galaxy.log lamwipe # "standard benchmark on single processor : 60000 particles 2019 steps" # --------------------------------------------------------------------------------------- # time mpirun -np 1 Gadget2/Gadget2 Gadget2/parameterfiles/galaxy.param >& galaxy.log # time mpirun -np 2 Gadget2.galaxy Gadget2/parameterfiles/galaxy.param >& galaxy.log # AMD64/3200: 2126.093u 2.983s 35:29.48 99.9% # 3294.859u 7.763s 55:10.38 99.7% ??? # np=1 0.000u 0.000s 55:04.35 0.0% # np=2 0.000u 0.002s 36:44.69 0.0% # np=4 0.000u 0.002s 39:18.13 0.0% # AMD Opteron 246/2000 2160.138u 2.687s 36:02.81 100.0% # P4/3300 desktop: about 1h18m/2 = 78/2 = 2340" ? # P4/1600 laptop: about 4h35m 16508" # P4/64/3000 3292.062u 7.109s 55:05.93 99.7% # G5/1600 4263.6u 51.5s 1:19:07.64 90.8% # P3/3200 dualEMT64 (gh2006 cluster) 51:12.84 # T7300 (2.0GHz) [T61p] 3393.587u 250.692s 1:02:57.11 96.4% # np=2 0.000u 0.004s 39:08.47 # Q6600 (2.4GHz) 2485.531u 0.604s 41:27.54 99.9% # i7/940 (2.93 GHz) 1453.172u 0.365s 24:13.58 99.9% # np=2 0.000u 0.001s 15:48.74 0.0% # np=4 0.002u 0.000s 9:39.38 0.0% # np=6 0.001u 0.004s 9:16.66 0.0% # np=8 0.000u 0.002s 7:49.30 0.0% # --------------------------------------------------------------------------------------- endif exit 0 # # - add LIBDIR to the `LD_LIBRARY_PATH' environment variable # during execution # - add LIBDIR to the `LD_RUN_PATH' environment variable # during linking/manybody_pkg # - use the `-Wl,--rpath -Wl,LIBDIR' linker flag # - have your system administrator add LIBDIR to `/etc/ld.so.conf' # help: echo "Ancillary software:" echo " URL for downloads current version" echo "HDF5: http://hdf.ncsa.uiuc.edu/HDF5 hdf=$hdf" echo "GSL: http://www.gnu.org/software/gsl gsl=$gsl" echo "LAM: http://www.lam-mpi.org/ lam=$lam" echo "FFTW: http://www.fftw.org/ fftw=$fftw" echo "GADGET http://www.mpa-garching.mpg.de/gadget/ gadget=$gadget" echo "" echo "help=0|1 provide this help" echo "bench=0|1 also run galaxy benchmark at the end [$bench]" echo "download=0|1 download? [$download]" echo "curl=0|1 download using curl (1) or wget (0) ? [$curl]" echo "manybody= set MANYBODY directory to create symlinks from if no download" echo "prefix= set prefix where to install all ancillary software [$prefix]"