-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuildall
executable file
·269 lines (238 loc) · 9.93 KB
/
buildall
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
#! /bin/bash
# -*- Mode: sh; sh-basic-offset:2 ; indent-tabs-mode:nil -*-
#
# Copyright (c) 2014-2016 Los Alamos National Security, LLC. All rights
# reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
#----------------------------------------------------------------------------
# buildall - build libhio on multiple systems with multiple options
#
# Change History:
# 20150428 cgw Initial version
#----------------------------------------------------------------------------
synexit() {
echo ""
if [[ -n $* ]]; then echo $*; echo ""; fi
echo "buildall - build libhio on multiple systems"
echo ""
echo " Syntax:"
echo " buildall [-ai] [-t build_tree] [-n tarname]"
echo " [-r rmt_dir] [version ...] "
echo " [-h]"
echo ""
echo " Options:"
echo " -a Autogen (local only) disables -i"
echo " -i Incremental transfer and build"
echo " -t build_tree Local directory containing hio build tree"
echo " Default is $tree"
echo " -n tarname Dist tarball base name and dir name"
echo " (default $tarname)"
echo " -r rmt_dir Remote directory name. Default is env var"
echo " HIOBUILD_RMT_DIR or ~/pgm/hio"
echo " version One or more version names. Special values:"
echo " \"good\" - all known good versions."
echo " \"other\" - all other versions."
echo " \"all\" - all versions."
echo " -h Display this help"
echo ""
echo " Results logged to $logfn. Good versions are:"
echo " $goodver"
echo " Other versions are:"
echo " $otherver"
echo ""
echo " Example - full build locally and all good remote versions:"
echo " buildall good"
echo ""
echo " Example - incremental remote build of a single version:"
echo " buildall -i mu-intel"
echo ""
echo " Example - full local build with autogen:"
echo " buildall -a local"
echo ""
echo " Cornell Wright cornell@lanl.gov"
exit 8
}
cmd() {
echo "`date \"$datefmt\"` $host ---> $*" 2>&1 | tee -a $log
eval $* 2>&1 | tee -a $log
}
msg() {
echo "`date \"$datefmt\"` $host $*" 2>&1 | tee -a $log
}
#----------------------------------------------------------------------------
# build_l - local build of hio
#----------------------------------------------------------------------------
build_l() {
options=$*
if [[ $autogen -gt 0 ]]; then
cmd ./hiobuild -ax $options
gotdist=1
elif [[ $incremental -gt 0 ]]; then
cmd ./hiobuild $options
else
cmd ./hiobuild -fx $options
gotdist=1
fi
}
#----------------------------------------------------------------------------
# build_r - remote build a single version of hio
#----------------------------------------------------------------------------
build_r() {
gateway=$1
dest=$2
dir=$3
tarname=$4
shift 4
options=$*
if [[ $gateway == "none" ]]; then
dest_ssh=$dest
dest_scp=$dest
gw_rsync=""
dest_rsync=$dest
else
dest_ssh="-t $gateway ssh $dest"
dest_scp="$gateway:$dest"
gw_rsync="--rsync-path=\"ssh $dest /usr/bin/rsync\""
dest_rsync="$gateway"
fi
if [[ $incremental -gt 0 ]]; then
# Use contents of dist tarball to identify files to rsync (ignore m4/*)
awkpgm='
/^-/{ f=$9;
sub("[^/]*/", "", f);
if ("m4/" != substr(f, 0, 3)) {
files = files " " f;
}
}
END { print files}
'
files=`tar -tvf $tarname.tar.gz | awk "$awkpgm"`
cmd "rsync -RlptgPv $gw_rsync $files $dest_rsync:$dir/$tarname";
cmd "ssh $dest_ssh \"cd $dir/$tarname; ./hiobuild $options\""
else
options="-c $options"
if [[ $gotdist -eq 0 ]]; then
cmd "make dist"
gotdist=1;
fi
cmd "ssh $dest_ssh uptime" # Sometime first ssh hangs, make it innocuous
cmd "ssh $dest_ssh \"mkdir -p $dir; rm -fR $dir/*\""
cmd "ssh $dest_ssh \"ls -altr $dir\""
cmd "scp $tarname.tar.gz \"$dest_scp:$dir\""
cmd "ssh $dest_ssh \"cd $dir; tar -xf $tarname.tar.gz; cd $dir/$tarname; ./hiobuild $options\""
fi
}
# Set up temporary log directory and file
datefmt="+%Y-%m-%d %H:%M:%S"
logfn="buildall.out"
tdir=$(mktemp -d /tmp/buildall.tmp.XXXX)
log="$tdir/$logfn"
host=`hostname -s`
gotdist=0
args=$*
msg "buildall $args: Starting at `date`"
#----------------------------------------------------------------------------
# Parse arguments
#----------------------------------------------------------------------------
autogen=0
incremental=0
tree=$(dirname ${BASH_SOURCE[0]}) # -t defaults to location of this script
tarname="libhio-1.4.0"
dir_suffix="" # Directory suffix - used to force version specific name on remote directory
goodver="local mu-gnu mu-intel mu-pgi ct-gnu ct-intel tt-gnu bu-gnu bu-cray"
otherver="ct-cray ct-pgi ga-gnu ga-cray ga-intel ga-pgi tt-intel tt-pgi tt-cray"
if [[ -z $HIOBUILD_RMT_DIR ]]; then rmt_dir="~/pgm/hio"
else rmt_dir=$HIOBUILD_RMT_DIR; fi
while getopts "hait:n:r:" optname; do
case $optname in
h ) synexit;;
a ) autogen=1;;
i ) incremental=1;;
t ) tree=$OPTARG;;
n ) tarname=$OPTARG;;
r ) rmt_dir=$OPTARG;;
\? ) synexit "Error: invalid option";;
esac
done
shift $((OPTIND - 1 ))
vers=$*
if [[ $vers == "good" ]]; then vers=$goodver
elif [[ $vers == "other" ]]; then vers=$otherver
elif [[ $vers == "all" ]]; then vers="$goodver $otherver"
fi
# Move log file to build directory
if [[ ! -d $tree ]]; then synexit "Error: directory $tree does not exist"; fi
msg "---> cd $tree"
cd $tree
mv -f $log .
log="$PWD/$logfn"
rm -fR $tdir
#----------------------------------------------------------------------------
# Run builds
#----------------------------------------------------------------------------
for v in $vers; do
vs=$v$dir_suffix
case $v in
local ) build_l -n $vs;;
gr-gnu ) build_r none gr-fey "$rmt_dir/$vs" $tarname -n $vs -l gcc -l openmpi ;;
gr-intel ) build_r none gr-fey "$rmt_dir/$vs" $tarname -n $vs -l intel -l openmpi ;;
ml-gnu ) build_r none ml-fey "$rmt_dir/$vs" $tarname -n $vs -l gcc -l openmpi ;;
ml-intel ) build_r none ml-fey "$rmt_dir/$vs" $tarname -n $vs -l intel -l openmpi ;;
sn-gnu ) build_r none sn-fey "$rmt_dir/$vs" $tarname -n $vs -l gcc -l openmpi ;;
sn-intel ) build_r none sn-fey "$rmt_dir/$vs" $tarname -n $vs -l intel -l openmpi ;;
wf-gnu ) build_r none wf-fey "$rmt_dir/$vs" $tarname -n $vs -l gcc -l openmpi ;;
wf-intel ) build_r none wf-fey "$rmt_dir/$vs" $tarname -n $vs -l intel -l openmpi ;;
ga-gnu ) build_r vl-gate ga-fe1 "$rmt_dir/$vs" $tarname -n $vs -s PrgEnv-intel,PrgEnv-gnu ;;
ga-gnuk ) build_r vl-gate ga-fe1 "$rmt_dir/$vs" $tarname -n $vs -s craype-haswell,craype-mic-knl -s PrgEnv-intel,PrgEnv-gnu ;;
ga-cray ) build_r vl-gate ga-fe1 "$rmt_dir/$vs" $tarname -n $vs -s PrgEnv-intel,PrgEnv-cray ;;
ga-crayk ) build_r vl-gate ga-fe1 "$rmt_dir/$vs" $tarname -n $vs -s craype-haswell,craype-mic-knl -s PrgEnv-intel,PrgEnv-cray ;;
ga-intel ) build_r vl-gate ga-fe1 "$rmt_dir/$vs" $tarname -n $vs ;;
ga-intel17 ) build_r vl-gate ga-fe1 "$rmt_dir/$vs" $tarname -n $vs -l friendly-testing -s PrgEnv-intel,PrgEnv-intel/17.0.1 ;;
ga-intelk ) build_r vl-gate ga-fe1 "$rmt_dir/$vs" $tarname -n $vs -s craype-haswell,craype-mic-knl ;;
ga-intel17k ) build_r vl-gate ga-fe1 "$rmt_dir/$vs" $tarname -n $vs -s craype-haswell,craype-mic-knl ;;
ga-pgi ) build_r vl-gate ga-fe1 "$rmt_dir/$vs" $tarname -n $vs -s PrgEnv-intel,PrgEnv-pgi ;;
t2-gnuk ) build_r ae-gate tr2-fe1 "$rmt_dir/$vs" $tarname -n $vs -s PrgEnv-intel,PrgEnv-gnu ;;
t2-intelk ) build_r ae-gate tr2-fe1 "$rmt_dir/$vs" $tarname -n $vs ;;
tt-gnu ) build_r none tt-fey "$rmt_dir/$vs" $tarname -n $vs -s PrgEnv-intel,PrgEnv-gnu ;;
tt-gnuk ) build_r none tt-fey "$rmt_dir/$vs" $tarname -n $vs -s craype-haswell,craype-mic-knl -s PrgEnv-intel,PrgEnv-gnu ;;
tt-cray ) build_r none tt-fey "$rmt_dir/$vs" $tarname -n $vs -s PrgEnv-intel,PrgEnv-cray ;;
tt-crayk ) build_r none tt-fey "$rmt_dir/$vs" $tarname -n $vs -s craype-haswell,craype-mic-knl -s PrgEnv-intel,PrgEnv-cray ;;
tt-intel ) build_r none tt-fey "$rmt_dir/$vs" $tarname -n $vs ;;
tt-intelk ) build_r none tt-fey "$rmt_dir/$vs" $tarname -n $vs -s craype-haswell,craype-mic-knl ;;
tt-pgi ) build_r none tt-fey "$rmt_dir/$vs" $tarname -n $vs -s PrgEnv-intel,PrgEnv-pgi ;;
tr-gnu ) build_r none tr-fe1 "$rmt_dir/$vs" $tarname -n $vs -s PrgEnv-intel,PrgEnv-gnu ;;
tr-intel ) build_r none tr-fe1 "$rmt_dir/$vs" $tarname -n $vs ;;
bu-gnu ) build_r vl-gate bu-login "$rmt_dir/$vs" $tarname -n $vs -s PrgEnv-intel,PrgEnv-gnu ;;
bu-intel ) build_r vl-gate bu-login "$rmt_dir/$vs" $tarname -n $vs ;;
* ) msg "Error: version \"$v\" not recognized"
esac
done
#----------------------------------------------------------------------------
# Print results summary
#----------------------------------------------------------------------------
type gawk > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
msg "gawk not available, skipping results summary"
else
tmpfile=tmp.buildall.summary
awkpgm='
BEGIN { lastp=p=0 }
/\[HIOBUILD_RESULT_START\]/ { p=1 }
/\[HIOBUILD_RESULT_END\]/ { p=0 }
/^ssh:/ {print prevline; print}
{ prevline=$0; if (lastp || p) print; lastp=p }
'
msg
msg "buildall results summary:"
cat $log | gawk "$awkpgm" > $tmpfile
cmd "cat $tmpfile"
msg
cmd rm -f $tmpfile
fi
msg "buildall $args: Done at `date`"
# --- end of buildall ---