build.sh 3.34 KB
Newer Older
incardon's avatar
incardon committed
1 2 3 4
#! /bin/bash

# Make a directory in /tmp/OpenFPM_pdata

incardon's avatar
incardon committed
5 6 7 8 9
workspace=$1
hostname=$(hostname)
target=$3
comp_type=$4
branch=$5
incardon's avatar
incardon committed
10
with_gpu=$6
incardon's avatar
incardon committed
11

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

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

incardon's avatar
incardon committed
24

incardon's avatar
incardon 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
incardon's avatar
incardon committed
28
	echo 4 > $HOME/openfpm_dependencies/openfpm_pdata/$branch/MPI/version
29
fi
incardon's avatar
incardon committed
30

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

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

incardon's avatar
incardon committed
42
if [ x"$hostname" == x"falcon1" ]; then
incardon's avatar
incardon committed
43
#       rm -rf $HOME/openfpm_dependencies/openfpm_pdata/$branch/
incardon's avatar
incardon committed
44
        echo "falcon1 settings"
incardon's avatar
incardon committed
45 46 47 48 49 50 51
	if [ x"$comp_type" == x"intel" ]; then
        	module load parallel_studio_xe/2019u1
        	mkdir $HOME/openfpm_dependencies_intel/openfpm_pdata/$branch
	else
        	mkdir $HOME/openfpm_dependencies/openfpm_pdata/$branch
	fi

incardon's avatar
incardon committed
52 53 54
	dependency_dir=/projects/ppm/rundeck/openfpm_dependencies/
else
	dependency_dir=$HOME/openfpm_dependencies/openfpm_pdata/$branch
incardon's avatar
incardon committed
55
	mkdir $HOME/openfpm_dependencies/openfpm_pdata/$branch
incardon's avatar
incardon committed
56 57
fi

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

incardon's avatar
Latest  
incardon 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
incardon's avatar
incardon committed
68
  branch=$dep_dir
incardon's avatar
Latest  
incardon committed
69 70
fi

incardon's avatar
incardon committed
71 72 73
mkdir src/config
mkdir openfpm_numerics/src/config

74
echo "Compiling general"
incardon's avatar
incardon committed
75

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

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

incardon's avatar
incardon committed
84 85 86 87
install_options=
if [ x"$comp_type" != x"full" ]; then
	install_options="-m"
fi
incardon's avatar
incardon committed
88

89 90 91 92 93
foward_options=
if [ x"$comp_type" == x"se_class" ]; then
	foward_options="--enable-se-class1"
fi

94

incardon's avatar
incardon committed
95

96 97
echo "Installing with: ./install $gpu_support  -i $dependency_dir $install_options -s -c \"$installation_dir $foward_options  \"  "
./install $gpu_support -i $dependency_dir $install_options -s -c "$installation_dir $foward_options "
incardon's avatar
incardon committed
98
if [ $? -ne 0 ]; then
incardon's avatar
incardon committed
99
    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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
incardon's avatar
incardon committed
100
    exit 1 ;
incardon's avatar
incardon committed
101
fi
incardon's avatar
incardon committed
102

incardon's avatar
incardon committed
103 104 105 106 107 108 109
# 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
110
fi
incardon's avatar
incardon committed
111

112
if [ $? -ne 0 ]; then
incardon's avatar
incardon committed
113
   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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
incardon's avatar
incardon committed
114 115 116
   exit 1 ;
fi