build.sh 6.64 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
11
workspace=$1
hostname=$(hostname)
target=$3
comp_type=$4
branch=$5

echo "Directory: $workspace"
Pietro Incardona's avatar
Pietro Incardona committed
12
echo "Machine: $hostname"
Pietro Incardona's avatar
Pietro Incardona committed
13
14
15
echo "make target: $target"
echo "compilation type: $comp_type"
echo "Branch name: $branch"
16

17
if [ x"$hostname" == x"cifarm-centos-node.mpi-cbg.de"  ]; then
Pietro Incardona's avatar
Pietro Incardona committed
18
	#we retest PETSC installation
Pietro Incardona's avatar
Pietro Incardona committed
19
	./install_MPI_mpich.sh $HOME/openfpm_dependencies/openfpm_pdata/$branch/ 4
Pietro Incardona's avatar
Pietro Incardona committed
20
	echo 4 > $HOME/openfpm_dependencies/openfpm_pdata/$branch/MPI/version
21
fi
22

Pietro Incardona's avatar
Pietro Incardona committed
23
if [ x"$hostname" == x"cifarm-mac-node.mpi-cbg.de"  ]; then
Pietro Incardona's avatar
Pietro Incardona committed
24
25
26
	export PATH="/usr/local/bin:$PATH"
fi

Pietro Incardona's avatar
Pietro Incardona committed
27

Pietro Incardona's avatar
Pietro Incardona committed
28
if [ x"$branch" == x"" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
29
30
31
  branch=$(git ls-remote --heads origin | grep $(git rev-parse HEAD) | cut -d / -f 3)
fi

Pietro Incardona's avatar
Latest    
Pietro Incardona committed
32
33
34
35
#### 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
36
  branch=$dep_dir
Pietro Incardona's avatar
Latest    
Pietro Incardona committed
37
38
fi

39
40
41
mkdir src/config
mkdir openfpm_numerics/src/config

Pietro Incardona's avatar
Pietro Incardona committed
42
if [ "$hostname" == "gin" ]
43
44
then
 echo "Compiling on gin\n"
Pietro Incardona's avatar
Pietro Incardona committed
45

Pietro Incardona's avatar
Pietro Incardona committed
46
47
 source "$HOME/.bashrc"

Pietro Incardona's avatar
Pietro Incardona committed
48
49
 ## Check if MPI folder exist if not copy MPICH

Pietro Incardona's avatar
Pietro Incardona committed
50
 if [ ! -d $HOME/$branch/MPI ]; then
Pietro Incardona's avatar
Pietro Incardona committed
51
   echo "COPY MPICH"
Pietro Incardona's avatar
Pietro Incardona committed
52
53
   cp -R $HOME/MPI $HOME/$branch/MPI
   echo 2 > $HOME/$branch/MPI/version
Pietro Incardona's avatar
Pietro Incardona committed
54
55
 fi

Pietro Incardona's avatar
Pietro Incardona committed
56
 ### Activate MPI and binutils ###
Pietro Incardona's avatar
Pietro Incardona committed
57

Pietro Incardona's avatar
Pietro Incardona committed
58
 export PATH="$PATH:$HOME/$branch/MPI/bin"
Pietro Incardona's avatar
Pietro Incardona committed
59
 export PATH="/usr/local/binutils/bin/:$PATH"
Pietro Incardona's avatar
Pietro Incardona committed
60

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

82
 if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
83
   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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
84
85
86
87
88
   exit 1 ;
 fi


 if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
89
   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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
90
91
92
   exit 1 ; 
 fi

Pietro Incardona's avatar
Pietro Incardona committed
93
elif [ "$hostname" == "taurus" ]
94
95
96
97
98
then
 echo "Compiling on taurus"

 source /etc/profile
 echo "$PATH"
99
100
 module load gcc/7.1.0
 module load openmpi/3.0.0-gnu7.1
101
102
103
 
 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
104
105
106
107
 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
108
 make -j 24
109
110
111


 if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
112
   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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
113
114
115
116
   exit 1 ; 
 fi
else
 echo "Compiling general"
Pietro Incardona's avatar
Pietro Incardona committed
117

118
 source ~/.bashrc
119
120
 
 installation_dir=""
Pietro Incardona's avatar
Pietro Incardona committed
121
 if [ x"$hostname" == x"sbalzarini-mac-15" ]; then
122
123
  installation_dir="--prefix=/Users/jenkins/openfpm_install"
 else
Pietro Incardona's avatar
Pietro Incardona committed
124
  installation_dir="--prefix=$HOME/openfpm_install/$branch"
125
 fi
Pietro Incardona's avatar
Pietro Incardona committed
126

Pietro Incardona's avatar
Pietro Incardona committed
127
128
 # force ssh to not use HostKey verification
 echo "StrictHostKeyChecking=no" > $HOME/.ssh/config
Pietro Incardona's avatar
Pietro Incardona committed
129
 chmod 600 $HOME/.ssh/config
Pietro Incardona's avatar
Pietro Incardona committed
130

131
 mkdir $HOME/openfpm_dependencies/openfpm_pdata/$branch
Pietro Incardona's avatar
Pietro Incardona committed
132
 if [ x"$comp_type" == x"full" ]; then
133
  echo "Installing with: ./install -i $HOME/openfpm_dependencies/openfpm_pdata/$branch  -s -c \"$installation_dir\"  "
Pietro Incardona's avatar
Pietro Incardona committed
134
  ./install -i $HOME/openfpm_dependencies/openfpm_pdata/$branch  -s -c "$installation_dir"
Pietro Incardona's avatar
Pietro Incardona committed
135
  if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
136
    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
137
138
    exit 1 ;
  fi
Pietro Incardona's avatar
Pietro Incardona committed
139
140
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
  source $HOME/openfpm_vars_$branch
Pietro Incardona's avatar
Pietro Incardona committed
141
 elif [ x"$comp_type" == x"numerics" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
142
  branch=$(git ls-remote --heads origin | grep $(git rev-parse HEAD) | cut -d / -f 3)
Pietro Incardona's avatar
Pietro Incardona committed
143
  ./install -i $HOME/openfpm_dependencies/openfpm_pdata/$branch  -m -s -c "$installation_dir"
Pietro Incardona's avatar
Pietro Incardona committed
144
  if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
145
    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
146
147
    exit 1 ;
  fi
Pietro Incardona's avatar
Pietro Incardona committed
148
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
Pietro Incardona's avatar
Pietro Incardona committed
149
  source $HOME/openfpm_vars_$branch
Pietro Incardona's avatar
Pietro Incardona committed
150
  make VERBOSE=1  -j 8
Pietro Incardona's avatar
Pietro Incardona committed
151
 else
Pietro Incardona's avatar
Pietro Incardona committed
152
  echo "Installing with: ./install -i $HOME/openfpm_dependencies/openfpm_pdata/$branch -m -s -c \"$installation_dir --no-recursion\""
Pietro Incardona's avatar
Pietro Incardona committed
153
  ./install -i $HOME/openfpm_dependencies/openfpm_pdata/$branch -m -s -c "$installation_dir --no-recursion"
Pietro Incardona's avatar
Pietro Incardona committed
154
  if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
155
    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
156
157
    exit 1 ;
  fi
Pietro Incardona's avatar
Pietro Incardona committed
158
  ls $HOME
Pietro Incardona's avatar
Pietro Incardona committed
159
160
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
  source $HOME/openfpm_vars_$branch
Pietro Incardona's avatar
Pietro Incardona committed
161
  make VERBOSE=1  -j 8
Pietro Incardona's avatar
Pietro Incardona committed
162
 fi
163
164

 if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
165
   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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
166
167
168
169
170
171
   exit 1 ;
 fi

fi