build_vcluster.sh 3.18 KB
Newer Older
incardon's avatar
incardon committed
1 2 3 4
#! /bin/bash

# Make a directory in /tmp/OpenFPM_data

incardon's avatar
incardon committed
5 6 7
echo "Directory: $1"
echo "Machine: $2"

incardon's avatar
incardon committed
8 9 10 11 12 13 14
mkdir /tmp/openfpm_vcluster
mv * .[^.]* /tmp/openfpm_vcluster
mv /tmp/openfpm_vcluster OpenFPM_vcluster

mkdir OpenFPM_vcluster/src/config

git clone git@ppmcore.mpi-cbg.de:incardon/openfpm_devices.git OpenFPM_devices
incardon's avatar
incardon committed
15
git clone git@ppmcore.mpi-cbg.de:incardon/openfpm_data.git OpenFPM_data
incardon's avatar
incardon committed
16 17 18

cd "$1/OpenFPM_vcluster"

incardon's avatar
incardon committed
19
if [ "$2" == "gin" ]
incardon's avatar
incardon committed
20
then
incardon's avatar
incardon committed
21 22 23
 echo "Compiling on gin\n"
 module load gcc/4.9.2
 module load openmpi/1.8.1
incardon's avatar
incardon committed
24
elif [ "$2" == "wetcluster" ]
incardon's avatar
incardon committed
25 26 27 28 29
then
 echo "Compiling on wetcluster"

## produce the module path

incardon's avatar
incardon committed
30
 export MODULEPATH="/sw/apps/modules/modulefiles:$MODULEPATH"
incardon's avatar
incardon committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44

 script="module load gcc/4.9.2\n 
module load openmpi/1.8.1\n
module load boost/1.54.0\n
compile_options='--with-boost=/sw/apps/boost/1.54.0/'\n
\n
sh ./autogen.sh\n
sh ./configure \"\$compile_options\"  CXX=mpic++\n
make\n
if [ \"\$?\" = "0" ]; then exit 1 ; fi\n
exit(0)\n"

 echo $script | sed -r 's/\\n/\n/g' > compile_script

incardon's avatar
incardon committed
45
 bsub -o output_compile.%J -K -n 1 -J compile sh ./compile_script
incardon's avatar
incardon committed
46

47
## Run on the cluster
incardon's avatar
incardon committed
48
 bsub -o output_run2.%J -K -n 2 "module load openmpi/1.8.1 ; module load gcc/4.9.2;  mpirun -np 2 ./src/vcluster"
incardon's avatar
incardon committed
49
 if [ $? -ne 0 ]; then exit 1 ; fi
incardon's avatar
incardon committed
50
 bsub -o output_run4.%J -K -n 4 "module load openmpi/1.8.1 ; module load gcc/4.9.2;  mpirun -np 4 ./src/vcluster"
incardon's avatar
incardon committed
51
 if [ $? -ne 0 ]; then exit 1 ; fi
incardon's avatar
incardon committed
52
 bsub -o output_run8.%J -K -n 8 "module load openmpi/1.8.1 ; module load gcc/4.9.2;  mpirun -np 8 ./src/vcluster"
incardon's avatar
incardon committed
53
 if [ $? -ne 0 ]; then exit 1 ; fi
incardon's avatar
incardon committed
54 55 56 57 58 59 60 61
 bsub -o output_run16.%J -K -n 16 "module load openmpi/1.8.1 ; module load gcc/4.9.2;  mpirun -np 16 ./src/vcluster"
 if [ $? -ne 0 ]; then exit 1 ; fi
 bsub -o output_run32.%J -K -n 32 "module load openmpi/1.8.1 ; module load gcc/4.9.2;  mpirun -np 32 ./src/vcluster"
 if [ $? -ne 0 ]; then exit 1 ; fi
 bsub -o output_run32.%J -K -n 64 "module load openmpi/1.8.1 ; module load gcc/4.9.2;  mpirun -np 64 ./src/vcluster"
 if [ $? -ne 0 ]; then exit 1 ; fi
 bsub -o output_run32.%J -K -n 128 "module load openmpi/1.8.1 ; module load gcc/4.9.2;  mpirun -np 128 ./src/vcluster"
 if [ $? -ne 0 ]; then exit 1 ; fi
incardon's avatar
incardon committed
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
elif [ "$2" == "taurus" ]
then
 echo "Compiling on taurus"

 module load openmpi gcc/4.8.0
 module load openmpi/1.8.3
 module load boost/1.55.0-gnu4.8

 sh ./autogen.sh
 sh ./configure  CXX=mpic++
 make

 script="#!/bin/bash\n
\n
module load openmpi/1.8.5\n
ulimit -l unlimited\n
ulimit -s unlimited\n
/sw/taurus/libraries/openmpi/1.8.5/bin/mpirun -np 16 src/vcluster\n"

 echo $script | sed -r 's/\\n/\n/g' > run_script
 chmod a+x run_script

 srun --nodes=1 --ntasks-per-node=16 --time=04:00:00 --mem-per-cpu=1900 --partition=sandy run_script
 srun --nodes=2 --ntasks-per-node=16 --time=04:00:00 --mem-per-cpu=1900 --partition=sandy run_script
 srun --nodes=4 --ntasks-per-node=16 --time=04:00:00 --mem-per-cpu=1900 --partition=sandy run_script
 srun --nodes=8 --nstaks-per-node=16 --time=04:00:00 --mem-per-cpu=1900 --partition=sansy run_script
 srun --nodes=16 --nstaks-per-node=16 --time=04:00:00 --mem-per-cpu=1900 --partition=sansy run_script

incardon's avatar
incardon committed
90 91
else
 echo "Compiling general"
incardon's avatar
incardon committed
92
 sh ./autogen.sh\n
incardon's avatar
incardon committed
93
 sh ./configure  CXX=mpic++
incardon's avatar
incardon committed
94 95 96 97 98
 make

 mpirun -np 2 ./src/vcluster
 mpirun -np 4 ./src/vcluster

incardon's avatar
incardon committed
99 100 101
fi