build.sh 4.52 KB
Newer Older
1 2 3 4 5 6
#! /bin/bash

# Make a directory in /tmp/OpenFPM_pdata

echo "Directory: $1"
echo "Machine: $2"
incardon's avatar
incardon committed
7
echo "Branch name: $5"
8

incardon's avatar
incardon committed
9

incardon's avatar
incardon committed
10 11 12 13 14 15
if [ x"$5" == x"" ]; then
  branch=$(git ls-remote --heads origin | grep $(git rev-parse HEAD) | cut -d / -f 3)
else
  branch=$5
fi

incardon's avatar
incardon committed
16 17 18 19 20 21 22
#### If you have a dep_dir file change the branch name to the dep_dir

dep_dir=$(cat dep_dir)
if [ x"$dep_dir" != x"" ]; then
  set -- "${@:1:4}" "$dep_dir"
fi

23 24 25 26 27 28 29
mkdir src/config
mkdir openfpm_numerics/src/config


if [ "$2" == "gin" ]
then
 echo "Compiling on gin\n"
incardon's avatar
incardon committed
30

incardon's avatar
incardon committed
31 32
 source "$HOME/.bashrc"

incardon's avatar
incardon committed
33 34
 ## Check if MPI folder exist if not copy MPICH

incardon's avatar
incardon committed
35
 if [ ! -d $HOME/$branch/MPI ]; then
incardon's avatar
incardon committed
36
   echo "COPY MPICH"
incardon's avatar
incardon committed
37 38
   cp -R $HOME/MPI $HOME/$branch/MPI
   echo 2 > $HOME/$branch/MPI/version
incardon's avatar
incardon committed
39 40
 fi

incardon's avatar
incardon committed
41
 ### Activate MPI and binutils ###
incardon's avatar
incardon committed
42

incardon's avatar
incardon committed
43
 export PATH="$PATH:$HOME/$branch/MPI/bin"
incardon's avatar
incardon committed
44
 export PATH="/usr/local/binutils/bin/:$PATH"
incardon's avatar
incardon committed
45

incardon's avatar
incardon committed
46
 mkdir $HOME/$branch
incardon's avatar
incardon committed
47
 if [ x"$4" == x"full" ]; then
incardon's avatar
incardon committed
48
  CC=gcc-4.9.2 CXX=g++-4.9.2 FC=gfortran-4.9.2 F77=gfortran-4.9.2 ./install -i $HOME/$branch  -s -c "--prefix=/home/jenkins/openfpm_install"
incardon's avatar
incardon committed
49
  echo "Moving environment variable"
incardon's avatar
incardon committed
50 51
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
  source $HOME/openfpm_vars_$branch
incardon's avatar
incardon committed
52
 elif [ x"$3" == x"numerics" ]; then
incardon's avatar
incardon committed
53 54
  branch=$(git ls-remote --heads origin | grep $(git rev-parse HEAD) | cut -d / -f 3)
  CC=gcc-4.9.2 CXX=g++-4.9.2 FC=gfortran-4.9.2 F77=gfortran-4.9.2 ./install -i $HOME/$branch  -m -s -c "--prefix=/home/jenkins/openfpm_install"
incardon's avatar
incardon committed
55
  echo "Moving environment variable"
incardon's avatar
incardon committed
56 57
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
  source $HOME/openfpm_vars_$branch
58
  make $3
incardon's avatar
incardon committed
59
 else
incardon's avatar
incardon committed
60
  CC=gcc-4.9.2 CXX=g++-4.9.2 FC=gfortran-4.9.2 F77=gfortran-4.9.2 ./install -i $HOME/$branch  -m -s -c "--prefix=/home/jenkins/openfpm_install --no-recursion"
incardon's avatar
incardon committed
61
  echo "Moving environment variables"
incardon's avatar
incardon committed
62 63
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
  source $HOME/openfpm_vars_$branch
incardon's avatar
incardon committed
64
  make $3
incardon's avatar
incardon committed
65
 fi
66

67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
 if [ $? -ne 0 ]; then
   curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\"  , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
   exit 1 ;
 fi


 if [ $? -ne 0 ]; then
   curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\"  , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
   exit 1 ; 
 fi

elif [ "$2" == "taurus" ]
then
 echo "Compiling on taurus"

 source /etc/profile
 echo "$PATH"
incardon's avatar
incardon committed
84 85
 module load gcc/7.1.0
 module load openmpi/3.0.0-gnu7.1
86 87 88
 
 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/incard/PARMETIS/lib:/home/incard/METIS/lib:/home/incard/HDF5/lib"

incardon's avatar
incardon committed
89 90 91 92
 mkdir /scratch/p_ppm/$branch
 ./install -m -i "/scratch/p_ppm/$branch" -s -c"CXX=mpic++ --no-recursion"
 mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
 source $HOME/openfpm_vars_$branch
incardon's avatar
incardon committed
93
 make $3
94 95 96 97 98 99 100 101


 if [ $? -ne 0 ]; then
   curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\"  , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
   exit 1 ; 
 fi
else
 echo "Compiling general"
incardon's avatar
incardon committed
102

103
 source ~/.bashrc
104 105 106 107 108 109 110
 
 installation_dir=""
 if [ x"$2" == x"sbalzarini-mac-15" ]; then
  installation_dir="--prefix=/Users/jenkins/openfpm_install"
 else
  installation_dir="--prefix=/home/jenkins/openfpm_install"
 fi
incardon's avatar
incardon committed
111

incardon's avatar
incardon committed
112
 mkdir $HOME/$branch
incardon's avatar
incardon committed
113
 if [ x"$4" == x"full" ]; then
114
  ./install -i $HOME/$branch  -s -c "$installation_dir"
incardon's avatar
incardon committed
115 116
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
  source $HOME/openfpm_vars_$branch
incardon's avatar
incardon committed
117
 elif [ x"$3" == x"numerics" ]; then
incardon's avatar
incardon committed
118
  branch=$(git ls-remote --heads origin | grep $(git rev-parse HEAD) | cut -d / -f 3)
119
  ./install -i $HOME/$branch  -m -s -c "$installation_dir"
incardon's avatar
incardon committed
120
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
incardon's avatar
incardon committed
121
  source $HOME/openfpm_vars_$branch
122
  make $3
incardon's avatar
incardon committed
123
 else
124
  ./install -i $HOME/$branch -m -s -c "$installation_dir --no-recursion"
incardon's avatar
incardon committed
125 126
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
  source $HOME/openfpm_vars_$branch
incardon's avatar
incardon committed
127
  make $3
incardon's avatar
incardon committed
128
 fi
129 130 131 132 133 134 135 136 137

 if [ $? -ne 0 ]; then
   curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\"  , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
   exit 1 ;
 fi

fi