build.sh 6.97 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
12
13
14
if [ x"$branch" == x"" ]; then
  branch=$(git ls-remote --heads origin | grep $(git rev-parse HEAD) | cut -d / -f 3)
fi

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

Pietro Incardona's avatar
Pietro Incardona committed
21

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

Pietro Incardona's avatar
Pietro Incardona committed
27
if [ x"$hostname" == x"cifarm-ubuntu-node.mpi-cbg.de"  ]; then
Pietro Incardona's avatar
Pietro Incardona committed
28
29
        ./install_MPI_mpich.sh $HOME/openfpm_dependencies/openfpm_io/$branch/ 4
        echo 4 > $HOME/openfpm_dependencies/openfpm_pdata/$branch/MPI/version
Pietro Incardona's avatar
Pietro Incardona committed
30
31
fi

Pietro Incardona's avatar
Pietro Incardona committed
32
if [ x"$hostname" == x"cifarm-mac-node.mpi-cbg.de"  ]; then
Pietro Incardona's avatar
Pietro Incardona committed
33
	export PATH="/usr/local/bin:$PATH"
Pietro Incardona's avatar
Pietro Incardona committed
34
35
        ./install_MPI_mpich.sh $HOME/openfpm_dependencies/openfpm_io/$branch/ 4
        echo 4 > $HOME/openfpm_dependencies/openfpm_io/$branch/MPI/version
Pietro Incardona's avatar
Pietro Incardona committed
36
37
fi

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

45
46
47
mkdir src/config
mkdir openfpm_numerics/src/config

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

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

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

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

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

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

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

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


 if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
95
   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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
96
97
98
   exit 1 ; 
 fi

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

 source /etc/profile
 echo "$PATH"
105
106
 module load gcc/7.1.0
 module load openmpi/3.0.0-gnu7.1
107
108
109
 
 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
110
111
112
113
 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
114
 make -j 24
115
116
117


 if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
118
   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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
119
120
121
122
   exit 1 ; 
 fi
else
 echo "Compiling general"
Pietro Incardona's avatar
Pietro Incardona committed
123

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

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

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

 if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
170
   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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
171
172
173
174
175
176
   exit 1 ;
 fi

fi