-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
executable file
·151 lines (125 loc) · 4.67 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/bash
#
# Copyright 2012, Brian Smith
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Install script
#
# add our PEs
function pe_exists(){
qconf -spl 2>&1 | grep -q "^$1\$"
return $?
}
export installDir=$1
export QUEUE_PREFIX=gepetools
if [[ -z "$installDir" ]]; then
echo "Please specify an installation directory: "
echo "./install.sh <installation_dir>"
exit 1
fi
echo "You should have root privs for this. Hope you're in sudoers..."
sudo mkdir -p $installDir
sudo chmod 755 $installDir
ppns=( 1 2 3 4 5 6 8 10 12 16 24 32 )
for queue in $(qconf -sql); do
if pe_exists ${QUEUE_PREFIX}_${queue}; then
echo "PE '${QUEUE_PREFIX}_${queue}' already exists! Bailing..."
exit 1
fi
sed "s|%%INSTALL_DIR%%|$installDir|g" > /tmp/pefile.$$ <<EOF
pe_name ${QUEUE_PREFIX}_${queue}
slots 9999
user_lists NONE
xuser_lists NONE
start_proc_args %%INSTALL_DIR%%/startpe.sh \$pe_hostfile
stop_proc_args %%INSTALL_DIR%%/stoppe.sh
allocation_rule \$fill_up
control_slaves TRUE
job_is_first_task FALSE
urgency_slots min
accounting_summary FALSE
EOF
qconf -Ap /tmp/pefile.$$
qconf -mattr queue pe_list ${QUEUE_PREFIX}_${queue} $queue
done
for queue in $(qconf -sql); do
for ppn in ${ppns[@]}; do
pe=${QUEUE_PREFIX}_${queue}.${ppn}
if pe_exists $pe; then
echo "PE '$pe' already exists! Bailing..."
rm -f /tmp/pefile.$$
exit 1
fi
sed "s|%%INSTALL_DIR%%|$installDir|g" >/tmp/pefile.$$ <<EOF
pe_name $pe
slots 9999
user_lists NONE
xuser_lists NONE
start_proc_args %%INSTALL_DIR%%/startpe.sh \$pe_hostfile
stop_proc_args %%INSTALL_DIR%%/stoppe.sh
allocation_rule $ppn
control_slaves TRUE
job_is_first_task FALSE
urgency_slots min
accounting_summary FALSE
EOF
qconf -Ap /tmp/pefile.$$
qconf -mattr queue pe_list $pe $queue
done
done
rm -f /tmp/pefile.$$
echo "You should have root privs for this next part. Hope you're in sudoers..."
sudo install --owner=root --group=root --mode=755 startpe.sh $installDir/
sudo sed -i "s|%%INSTALL_DIR%%|$installDir|g" $installDir/startpe.sh
sudo install --owner=root --group=root --mode=755 stoppe.sh $installDir/
sudo sed -i "s|%%INSTALL_DIR%%|$installDir|g" $installDir/stoppe.sh
sudo install --owner=root --group=root --mode=755 getjidprocinfo $installDir/
sudo sed -i "s|%%INSTALL_DIR%%|$installDir|g" $installDir/getjidprocinfo
sudo install --owner=root --group=root --mode=755 extJobInfo $installDir/
sudo sed -i "s|%%INSTALL_DIR%%|$installDir|g" $installDir/extJobInfo
sudo install --owner=root --group=root --mode=755 rshExtJobInfo $installDir/
sudo sed -i "s|%%INSTALL_DIR%%|$installDir|g" $installDir/rshExtJobInfo
sudo install --owner=root --group=root --mode=755 rshExtWrap $installDir/
sudo sed -i "s|%%INSTALL_DIR%%|$installDir|g" $installDir/rshExtWrap
sudo install --owner=root --group=root --mode=755 mpdboot $installDir/
sudo sed -i "s|%%INSTALL_DIR%%|$installDir|g" $installDir/mpdboot
sudo install --owner=root --group=root --mode=755 rsh $installDir/
sudo install --owner=root --group=root --mode=755 pe.jsv $installDir/
sudo install --owner=root --group=root --mode=644 pe_env_setup $installDir/
sudo sed -i "s|%%INSTALL_DIR%%|$installDir|g" $installDir/pe_env_setup
sudo touch $installDir/.gepetools.install
# Setup MPD daemon
sudo rsync -a mpd $installDir/
pushd $installDir/mpd
sudo ./aimk
popd
# Add complex attributes
qconf -sc >> /tmp/complexAttribs.$$
cat >>/tmp/complexAttribs.$$ <<EOF
pcpus pcpus INT <= YES NO 0 0
nodes nodes INT <= YES NO 0 0
ppn ppn INT <= YES NO 0 0
EOF
qconf -Mc /tmp/complexAttribs.$$
rm -f /tmp/complexAttribs.$$
# Add complex values to queues
# TODO: Change this to global host configuration
for queue in $(qconf -sql); do
qconf -mattr queue complex_values pcpus=99999 $queue
qconf -mattr queue complex_values nodes=99999 $queue
qconf -mattr queue complex_values ppn=99999 $queue
done
exit