build.sh 6.65 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

Pietro Incardona's avatar
Pietro Incardona committed
17
rm -rf $HOME/openfpm_dependencies/openfpm_pdata/0
Pietro Incardona's avatar
Pietro Incardona committed
18

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

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

Pietro Incardona's avatar
Pietro Incardona committed
28

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

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

40
41
42
mkdir src/config
mkdir openfpm_numerics/src/config

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

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

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

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

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

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

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

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


 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
   exit 1 ; 
 fi

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

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


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

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

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

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