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

# Make a directory in /tmp/OpenFPM_pdata

echo "Directory: $1"
Pietro Incardona's avatar
Pietro Incardona committed
6
7
8
echo "OS Type: $2"
echo "OS: $3"
echo "make target: $4"
9
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

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

Pietro Incardona's avatar
Latest    
Pietro Incardona committed
19
20
21
22
#### 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
23
  branch=$dep_dir
Pietro Incardona's avatar
Latest    
Pietro Incardona committed
24
25
fi

26
27
28
29
30
31
mkdir src/config
mkdir openfpm_numerics/src/config

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

Pietro Incardona's avatar
Pietro Incardona committed
33
34
 source "$HOME/.bashrc"

Pietro Incardona's avatar
Pietro Incardona committed
35
36
 ## Check if MPI folder exist if not copy MPICH

Pietro Incardona's avatar
Pietro Incardona committed
37
 if [ ! -d $HOME/$branch/MPI ]; then
Pietro Incardona's avatar
Pietro Incardona committed
38
   echo "COPY MPICH"
Pietro Incardona's avatar
Pietro Incardona committed
39
40
   cp -R $HOME/MPI $HOME/$branch/MPI
   echo 2 > $HOME/$branch/MPI/version
Pietro Incardona's avatar
Pietro Incardona committed
41
42
 fi

Pietro Incardona's avatar
Pietro Incardona committed
43
 ### Activate MPI and binutils ###
Pietro Incardona's avatar
Pietro Incardona committed
44

Pietro Incardona's avatar
Pietro Incardona committed
45
 export PATH="$PATH:$HOME/$branch/MPI/bin"
Pietro Incardona's avatar
Pietro Incardona committed
46
 export PATH="/usr/local/binutils/bin/:$PATH"
Pietro Incardona's avatar
Pietro Incardona committed
47

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

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


 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
104

105
 source ~/.bashrc
106
107
108
109
110
 
 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
111
  installation_dir="--prefix=$HOME/openfpm_install/$branch"
112
 fi
Pietro Incardona's avatar
Pietro Incardona committed
113

Pietro Incardona's avatar
Pietro Incardona committed
114
115
 # force ssh to not use HostKey verification
 echo "StrictHostKeyChecking=no" > $HOME/.ssh/config
Pietro Incardona's avatar
Pietro Incardona committed
116
 chmod 600 $HOME/.ssh/config
Pietro Incardona's avatar
Pietro Incardona committed
117

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

 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