build.sh 6.88 KB
Newer Older
1
2
3
4
#! /bin/bash

# Make a directory in /tmp/OpenFPM_pdata

Pietro Incardona's avatar
Pietro Incardona committed
5
6
7
8
9
10
workspace=$1
hostname=$(hostname)
target=$3
comp_type=$4
branch=$5

Pietro Incardona's avatar
Pietro Incardona committed
11
if [ x"$branch" == x"" ]; then
Pietro Incardona's avatar
Retry    
Pietro Incardona committed
12
  echo "Getting branch from git"
Pietro Incardona's avatar
Pietro Incardona committed
13
14
15
  branch=$(git ls-remote --heads origin | grep $(git rev-parse HEAD) | cut -d / -f 3)
fi

Pietro Incardona's avatar
Pietro Incardona committed
16
echo "Directory: $workspace"
Pietro Incardona's avatar
Pietro Incardona committed
17
echo "Machine: $hostname"
Pietro Incardona's avatar
Pietro Incardona committed
18
19
20
echo "make target: $target"
echo "compilation type: $comp_type"
echo "Branch name: $branch"
21

Pietro Incardona's avatar
Pietro Incardona committed
22

23
24
if [ x"$hostname" == x"cifarm-centos-node.mpi-cbg.de"  ]; then 
	./install_MPI_mpich.sh $HOME/openfpm_dependencies/openfpm_pdata/$branch/ 4
Pietro Incardona's avatar
Pietro Incardona committed
25
	echo 4 > $HOME/openfpm_dependencies/openfpm_pdata/$branch/MPI/version
26
fi
27

Pietro Incardona's avatar
Pietro Incardona committed
28
if [ x"$hostname" == x"cifarm-ubuntu-node.mpi-cbg.de"  ]; then
Pietro Incardona's avatar
Re-run    
Pietro Incardona committed
29
30
#	rm -rf $HOME/openfpm_dependencies/openfpm_pdata/$branch/
	echo "Continue"
Pietro Incardona's avatar
Pietro Incardona committed
31
32
fi

Pietro Incardona's avatar
Pietro Incardona committed
33
if [ x"$hostname" == x"cifarm-mac-node.mpi-cbg.de"  ]; then
Pietro Incardona's avatar
Pietro Incardona committed
34
	export PATH="/usr/local/bin:$PATH"
Pietro Incardona's avatar
Re-run    
Pietro Incardona committed
35
36
#	rm -rf $HOME/openfpm_dependencies/openfpm_pdata/$branch/
	echo "Continue"
Pietro Incardona's avatar
Pietro Incardona committed
37
38
fi

Pietro Incardona's avatar
Latest    
Pietro Incardona committed
39
40
41
42
#### 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
Pietro Incardona's avatar
Pietro Incardona committed
43
  branch=$dep_dir
Pietro Incardona's avatar
Latest    
Pietro Incardona committed
44
45
fi

46
47
48
mkdir src/config
mkdir openfpm_numerics/src/config

Pietro Incardona's avatar
Pietro Incardona committed
49
if [ "$hostname" == "gin" ]
50
51
then
 echo "Compiling on gin\n"
Pietro Incardona's avatar
Pietro Incardona committed
52

Pietro Incardona's avatar
Pietro Incardona committed
53
54
 source "$HOME/.bashrc"

Pietro Incardona's avatar
Pietro Incardona committed
55
56
 ## Check if MPI folder exist if not copy MPICH

Pietro Incardona's avatar
Pietro Incardona committed
57
 if [ ! -d $HOME/$branch/MPI ]; then
Pietro Incardona's avatar
Pietro Incardona committed
58
   echo "COPY MPICH"
Pietro Incardona's avatar
Pietro Incardona committed
59
60
   cp -R $HOME/MPI $HOME/$branch/MPI
   echo 2 > $HOME/$branch/MPI/version
Pietro Incardona's avatar
Pietro Incardona committed
61
62
 fi

Pietro Incardona's avatar
Pietro Incardona committed
63
 ### Activate MPI and binutils ###
Pietro Incardona's avatar
Pietro Incardona committed
64

Pietro Incardona's avatar
Pietro Incardona committed
65
 export PATH="$PATH:$HOME/$branch/MPI/bin"
Pietro Incardona's avatar
Pietro Incardona committed
66
 export PATH="/usr/local/binutils/bin/:$PATH"
Pietro Incardona's avatar
Pietro Incardona committed
67

Pietro Incardona's avatar
Pietro Incardona committed
68
 mkdir $HOME/$branch
Pietro Incardona's avatar
Pietro Incardona committed
69
 if [ x"$comp_type" == x"full" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
70
  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"
Pietro Incardona's avatar
Pietro Incardona committed
71
  echo "Moving environment variable"
Pietro Incardona's avatar
Pietro Incardona committed
72
73
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
  source $HOME/openfpm_vars_$branch
Pietro Incardona's avatar
Pietro Incardona committed
74
 elif [ x"$comp_type" == x"numerics" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
75
76
  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"
Pietro Incardona's avatar
Pietro Incardona committed
77
  echo "Moving environment variable"
Pietro Incardona's avatar
Pietro Incardona committed
78
79
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
  source $HOME/openfpm_vars_$branch
80
  make -j 12
Pietro Incardona's avatar
Pietro Incardona committed
81
 else
Pietro Incardona's avatar
Pietro Incardona committed
82
  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"
Pietro Incardona's avatar
Pietro Incardona committed
83
  echo "Moving environment variables"
Pietro Incardona's avatar
Pietro Incardona committed
84
85
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
  source $HOME/openfpm_vars_$branch
86
  make -j 12
Pietro Incardona's avatar
Pietro Incardona committed
87
 fi
88

89
 if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
90
   curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\"  , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$hostname failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
91
92
93
94
95
   exit 1 ;
 fi


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

Pietro Incardona's avatar
Pietro Incardona committed
100
elif [ "$hostname" == "taurus" ]
101
102
103
104
105
then
 echo "Compiling on taurus"

 source /etc/profile
 echo "$PATH"
106
107
 module load gcc/7.1.0
 module load openmpi/3.0.0-gnu7.1
108
109
110
 
 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/incard/PARMETIS/lib:/home/incard/METIS/lib:/home/incard/HDF5/lib"

Pietro Incardona's avatar
Pietro Incardona committed
111
112
113
114
 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
115
 make -j 24
116
117
118


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

125
 source ~/.bashrc
126
127
 
 installation_dir=""
Pietro Incardona's avatar
Pietro Incardona committed
128
 if [ x"$hostname" == x"sbalzarini-mac-15" ]; then
129
130
  installation_dir="--prefix=/Users/jenkins/openfpm_install"
 else
Pietro Incardona's avatar
Pietro Incardona committed
131
  installation_dir="--prefix=$HOME/openfpm_install/$branch"
132
 fi
Pietro Incardona's avatar
Pietro Incardona committed
133

Pietro Incardona's avatar
Pietro Incardona committed
134
135
 # force ssh to not use HostKey verification
 echo "StrictHostKeyChecking=no" > $HOME/.ssh/config
Pietro Incardona's avatar
Pietro Incardona committed
136
 chmod 600 $HOME/.ssh/config
Pietro Incardona's avatar
Pietro Incardona committed
137

138
 mkdir $HOME/openfpm_dependencies/openfpm_pdata/$branch
Pietro Incardona's avatar
Pietro Incardona committed
139
 if [ x"$comp_type" == x"full" ]; then
140
  echo "Installing with: ./install -i $HOME/openfpm_dependencies/openfpm_pdata/$branch  -s -c \"$installation_dir\"  "
Pietro Incardona's avatar
Pietro Incardona committed
141
  ./install -i $HOME/openfpm_dependencies/openfpm_pdata/$branch  -s -c "$installation_dir"
142
  make install
Pietro Incardona's avatar
Pietro Incardona committed
143
  if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
144
    curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\"  , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$hostname failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
Pietro Incardona's avatar
Pietro Incardona committed
145
146
    exit 1 ;
  fi
Pietro Incardona's avatar
Pietro Incardona committed
147
148
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
  source $HOME/openfpm_vars_$branch
Pietro Incardona's avatar
Pietro Incardona committed
149
 elif [ x"$comp_type" == x"numerics" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
150
  ./install -i $HOME/openfpm_dependencies/openfpm_pdata/$branch  -m -s -c "$installation_dir"
151

Pietro Incardona's avatar
Pietro Incardona committed
152
  if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
153
    curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\"  , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$hostname failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
Pietro Incardona's avatar
Pietro Incardona committed
154
155
    exit 1 ;
  fi
Pietro Incardona's avatar
Pietro Incardona committed
156
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
Pietro Incardona's avatar
Pietro Incardona committed
157
  source $HOME/openfpm_vars_$branch
Pietro Incardona's avatar
Pietro Incardona committed
158
  make VERBOSE=1  -j 8
Pietro Incardona's avatar
Pietro Incardona committed
159
 else
Pietro Incardona's avatar
Pietro Incardona committed
160
  echo "Installing with: ./install -i $HOME/openfpm_dependencies/openfpm_pdata/$branch -m -s -c \"$installation_dir --no-recursion\""
161
  ./install -i $HOME/openfpm_dependencies/openfpm_pdata/$branch -m -s -c "$installation_dir"
162

Pietro Incardona's avatar
Pietro Incardona committed
163
  if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
164
    curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\"  , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$hostname failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
Pietro Incardona's avatar
Pietro Incardona committed
165
166
    exit 1 ;
  fi
Pietro Incardona's avatar
Pietro Incardona committed
167
168
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
  source $HOME/openfpm_vars_$branch
Pietro Incardona's avatar
Pietro Incardona committed
169
170
171
172
173

  echo "------------- DEBUGGING ------------------"
  echo "$PATH"
  echo "-------------------------------------------"
  make VERBOSE=1 -j 8
Pietro Incardona's avatar
Pietro Incardona committed
174
 fi
175
176

 if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
177
   curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\"  , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$hostname failed to complete the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
178
179
180
181
182
183
   exit 1 ;
 fi

fi