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

# Make a directory in /tmp/OpenFPM_pdata

echo "Directory: $1"
echo "Machine: $2"
7
8
9
echo "make target: $3"
echo "project calling: $4"
echo "compilation type: $5"
Pietro Incardona's avatar
Pietro Incardona committed
10
echo "Branch name: $6"
11

Pietro Incardona's avatar
Pietro Incardona committed
12
echo "AAAAAAA $2"
Pietro Incardona's avatar
Pietro Incardona committed
13
14
15
16
if [ x"$2" == x"ubuntu,"  ]; then
	echo "UBUNTU"
fi

Pietro Incardona's avatar
Pietro Incardona committed
17
if [ x"$6" == x"" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
18
19
  branch=$(git ls-remote --heads origin | grep $(git rev-parse HEAD) | cut -d / -f 3)
else
Pietro Incardona's avatar
Pietro Incardona committed
20
  branch=$6
Pietro Incardona's avatar
Pietro Incardona committed
21
22
fi

Pietro Incardona's avatar
Latest    
Pietro Incardona committed
23
24
25
26
#### 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
27
  branch=$dep_dir
Pietro Incardona's avatar
Latest    
Pietro Incardona committed
28
29
fi

30
31
32
33
34
35
mkdir src/config
mkdir openfpm_numerics/src/config

if [ "$2" == "gin" ]
then
 echo "Compiling on gin\n"
Pietro Incardona's avatar
Pietro Incardona committed
36

Pietro Incardona's avatar
Pietro Incardona committed
37
38
 source "$HOME/.bashrc"

Pietro Incardona's avatar
Pietro Incardona committed
39
40
 ## Check if MPI folder exist if not copy MPICH

Pietro Incardona's avatar
Pietro Incardona committed
41
 if [ ! -d $HOME/$branch/MPI ]; then
Pietro Incardona's avatar
Pietro Incardona committed
42
   echo "COPY MPICH"
Pietro Incardona's avatar
Pietro Incardona committed
43
44
   cp -R $HOME/MPI $HOME/$branch/MPI
   echo 2 > $HOME/$branch/MPI/version
Pietro Incardona's avatar
Pietro Incardona committed
45
46
 fi

Pietro Incardona's avatar
Pietro Incardona committed
47
 ### Activate MPI and binutils ###
Pietro Incardona's avatar
Pietro Incardona committed
48

Pietro Incardona's avatar
Pietro Incardona committed
49
 export PATH="$PATH:$HOME/$branch/MPI/bin"
Pietro Incardona's avatar
Pietro Incardona committed
50
 export PATH="/usr/local/binutils/bin/:$PATH"
Pietro Incardona's avatar
Pietro Incardona committed
51

Pietro Incardona's avatar
Pietro Incardona committed
52
 mkdir $HOME/$branch
53
 if [ x"$5" == x"full" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
54
  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
55
  echo "Moving environment variable"
Pietro Incardona's avatar
Pietro Incardona committed
56
57
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
  source $HOME/openfpm_vars_$branch
58
 elif [ x"$4" == x"numerics" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
59
60
  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
61
  echo "Moving environment variable"
Pietro Incardona's avatar
Pietro Incardona committed
62
63
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
  source $HOME/openfpm_vars_$branch
64
  make -j 12
Pietro Incardona's avatar
Pietro Incardona committed
65
 else
Pietro Incardona's avatar
Pietro Incardona committed
66
  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
67
  echo "Moving environment variables"
Pietro Incardona's avatar
Pietro Incardona committed
68
69
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
  source $HOME/openfpm_vars_$branch
70
  make -j 12
Pietro Incardona's avatar
Pietro Incardona committed
71
 fi
72

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
 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"
90
91
 module load gcc/7.1.0
 module load openmpi/3.0.0-gnu7.1
92
93
94
 
 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
95
96
97
98
 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
99
 make -j 24
100
101
102
103
104
105
106
107


 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"
Pietro Incardona's avatar
Pietro Incardona committed
108

109
 source ~/.bashrc
110
111
112
113
114
 
 installation_dir=""
 if [ x"$2" == x"sbalzarini-mac-15" ]; then
  installation_dir="--prefix=/Users/jenkins/openfpm_install"
 else
Pietro Incardona's avatar
Pietro Incardona committed
115
  installation_dir="--prefix=$HOME/openfpm_install/$branch"
116
 fi
Pietro Incardona's avatar
Pietro Incardona committed
117

Pietro Incardona's avatar
Pietro Incardona committed
118
119
 # force ssh to not use HostKey verification
 echo "StrictHostKeyChecking=no" > $HOME/.ssh/config
Pietro Incardona's avatar
Pietro Incardona committed
120
 chmod 600 $HOME/.ssh/config
Pietro Incardona's avatar
Pietro Incardona committed
121

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

 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