build.sh 3.94 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
workspace=$1
hostname=$(hostname)
target=$3
comp_type=$4
branch=$5
10
with_gpu=$6
Pietro Incardona's avatar
Pietro Incardona committed
11

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

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

Pietro Incardona's avatar
Pietro Incardona committed
23

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

Pietro Incardona's avatar
Pietro Incardona committed
30
if [ x"$hostname" == x"cifarm-ubuntu-node.mpi-cbg.de"  ]; then
Pietro Incardona's avatar
Re-run    
Pietro Incardona committed
31
#	rm -rf $HOME/openfpm_dependencies/openfpm_pdata/$branch/
Pietro Incardona's avatar
Pietro Incardona committed
32
	echo "Ubuntu node"
Pietro Incardona's avatar
Pietro Incardona committed
33
34
fi

Pietro Incardona's avatar
Pietro Incardona committed
35
if [ x"$hostname" == x"cifarm-mac-node.mpi-cbg.de"  ]; then
Pietro Incardona's avatar
Pietro Incardona committed
36
	echo "Mac node"
Pietro Incardona's avatar
Pietro Incardona committed
37
	export PATH="/usr/local/bin:$PATH"
Pietro Incardona's avatar
Re-run    
Pietro Incardona committed
38
#	rm -rf $HOME/openfpm_dependencies/openfpm_pdata/$branch/
Pietro Incardona's avatar
Pietro Incardona committed
39
40
fi

Pietro Incardona's avatar
Pietro Incardona committed
41
if [ x"$hostname" == x"falcon1" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
42
#       rm -rf $HOME/openfpm_dependencies/openfpm_pdata/$branch/
Pietro Incardona's avatar
Pietro Incardona committed
43
        echo "falcon1 settings"
Pietro Incardona's avatar
Pietro Incardona committed
44
45
46
47
48
	dependency_dir=/projects/ppm/rundeck/openfpm_dependencies/
else
	dependency_dir=$HOME/openfpm_dependencies/openfpm_pdata/$branch
fi

49
50
51
52
53
if [ x"$with_gpu" == x"1" ]; then
	gpu_support=-g
else
	gpu_support=
fi
Pietro Incardona's avatar
Pietro Incardona committed
54

Pietro Incardona's avatar
Latest    
Pietro Incardona committed
55
56
57
58
#### 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
59
  branch=$dep_dir
Pietro Incardona's avatar
Latest    
Pietro Incardona committed
60
61
fi

62
63
64
mkdir src/config
mkdir openfpm_numerics/src/config

65
echo "Compiling general"
Pietro Incardona's avatar
Pietro Incardona committed
66

67
source ~/.bashrc
68
 
Pietro Incardona's avatar
Pietro Incardona committed
69
installation_dir="--prefix=$HOME/openfpm_install/$branch"
Pietro Incardona's avatar
Pietro Incardona committed
70

71
# force ssh to not use HostKey verification
Pietro Incardona's avatar
Pietro Incardona committed
72
73
#echo "StrictHostKeyChecking=no" > $HOME/.ssh/config
#chmod 600 $HOME/.ssh/config
Pietro Incardona's avatar
Pietro Incardona committed
74

75
76
mkdir $HOME/openfpm_dependencies/openfpm_pdata/$branch
if [ x"$comp_type" == x"full" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
77
78
  echo "Installing with: ./install -i $dependency_dir -s -c \"$installation_dir\"  "
  ./install -i $dependency_dir  -s -c "$installation_dir"
79
  make install
Pietro Incardona's avatar
Pietro Incardona committed
80
  if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
81
    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
82
83
    exit 1 ;
  fi
Pietro Incardona's avatar
Pietro Incardona committed
84
85
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
  source $HOME/openfpm_vars_$branch
86
elif [ x"$comp_type" == x"numerics" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
87
  ./install -i $dependency_dir  -m -s -c "$installation_dir"
88

Pietro Incardona's avatar
Pietro Incardona committed
89
  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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
Pietro Incardona's avatar
Pietro Incardona committed
91
92
    exit 1 ;
  fi
Pietro Incardona's avatar
Pietro Incardona committed
93
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
Pietro Incardona's avatar
Pietro Incardona committed
94
  source $HOME/openfpm_vars_$branch
Pietro Incardona's avatar
Pietro Incardona committed
95
  make VERBOSE=1  -j 8
96
else
97
98
  echo "Installing with: ./install $gpu_support  -i $dependency_dir -m -s -c \"$installation_dir --no-recursion\""
  ./install $gpu_support -i $dependency_dir -m -s -c "$installation_dir"
99

Pietro Incardona's avatar
Pietro Incardona committed
100
  if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
101
    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
102
103
    exit 1 ;
  fi
Pietro Incardona's avatar
Pietro Incardona committed
104
105
  mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
  source $HOME/openfpm_vars_$branch
Pietro Incardona's avatar
Pietro Incardona committed
106
107

  make VERBOSE=1 -j 8
108
fi
109

110
if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
111
   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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
112
113
114
   exit 1 ;
fi