build_vcluster.sh 1.65 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
else
 echo "Compiling general"
 sh ./autogen.sh
incardon's avatar
incardon committed
57
 sh ./configure  CXX=mpic++
incardon's avatar
incardon committed
58 59 60 61 62
 make

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

incardon's avatar
incardon committed
63 64 65
fi