build.sh 3.56 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
echo "GPU compilation: $with_gpu"
23

Pietro Incardona's avatar
Pietro Incardona committed
24

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

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

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

Pietro Incardona's avatar
Pietro Incardona committed
42
if [ x"$hostname" == x"falcon1" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
43
#       rm -rf $HOME/openfpm_dependencies/openfpm_pdata/$branch/
Pietro Incardona's avatar
Pietro Incardona committed
44
        echo "falcon1 settings"
Pietro Incardona's avatar
Pietro Incardona committed
45
46
47
48
49
50
51
52
	if [ x"$comp_type" == x"intel" ]; then
        	module load parallel_studio_xe/2019u1
        	mkdir $HOME/openfpm_dependencies_intel/openfpm_pdata/$branch
		dependency_dir=/projects/ppm/rundeck/openfpm_dependencies_intel/
	else
        	mkdir $HOME/openfpm_dependencies/openfpm_pdata/$branch
		dependency_dir=/projects/ppm/rundeck/openfpm_dependencies/
	fi
Pietro Incardona's avatar
Pietro Incardona committed
53
54
else
	dependency_dir=$HOME/openfpm_dependencies/openfpm_pdata/$branch
Pietro Incardona's avatar
Pietro Incardona committed
55
	mkdir $HOME/openfpm_dependencies/openfpm_pdata/$branch
Pietro Incardona's avatar
Pietro Incardona committed
56
57
fi

58
59
60
61
62
if [ x"$with_gpu" == x"1" ]; then
	gpu_support=-g
else
	gpu_support=
fi
Pietro Incardona's avatar
Pietro Incardona committed
63

Pietro Incardona's avatar
Latest    
Pietro Incardona committed
64
65
66
67
#### 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
68
  branch=$dep_dir
Pietro Incardona's avatar
Latest    
Pietro Incardona committed
69
70
fi

71
72
73
mkdir src/config
mkdir openfpm_numerics/src/config

74
echo "Compiling general"
Pietro Incardona's avatar
Pietro Incardona committed
75

76
source ~/.bashrc
77
 
Pietro Incardona's avatar
Pietro Incardona committed
78
installation_dir="--prefix=$HOME/openfpm_install/$branch"
Pietro Incardona's avatar
Pietro Incardona committed
79

80
# force ssh to not use HostKey verification
Pietro Incardona's avatar
Pietro Incardona committed
81
82
#echo "StrictHostKeyChecking=no" > $HOME/.ssh/config
#chmod 600 $HOME/.ssh/config
Pietro Incardona's avatar
Pietro Incardona committed
83

Pietro Incardona's avatar
Pietro Incardona committed
84
install_options=
85
if [ x"$comp_type" == x"full" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
86
87
88
        install_options="-s"
elif [ x"$comp_type" == x"intel" ]; then
        install_options=" "
89
else
Pietro Incardona's avatar
Pietro Incardona committed
90
91
92
93
94
95
96
97
        install_options="-s -m"
fi

foward_options=
if [ x"$comp_type" == x"se_class" ]; then
	foward_options="--enable-se-class1 --with-action-on-error=STOP_ON_ERROR"
fi

98

Pietro Incardona's avatar
Pietro Incardona committed
99
100

echo "Installing with: ./install $gpu_support  -i $dependency_dir $install_options -c \"$installation_dir $foward_options  \"  "
101
./install $gpu_support -i $dependency_dir $install_options -c "$installation_dir $foward_options " &>install_output
Pietro Incardona's avatar
Pietro Incardona committed
102
if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
103
    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
104
    exit 1 ;
Pietro Incardona's avatar
Pietro Incardona committed
105
fi
Pietro Incardona's avatar
Pietro Incardona committed
106

Pietro Incardona's avatar
Pietro Incardona committed
107
108
109
110
111
112
113
# Check of we have to do a make install
if [ x"$comp_type" == x"full" ]; then
    make install
else
    mv $HOME/openfpm_vars $HOME/openfpm_vars_$branch
    source $HOME/openfpm_vars_$branch
    make VERBOSE=1  -j 8
114
fi
115

116
if [ $? -ne 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
117
   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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
118
119
120
   exit 1 ;
fi