-
Notifications
You must be signed in to change notification settings - Fork 0
/
tensorflow_blt
executable file
·75 lines (63 loc) · 2.11 KB
/
tensorflow_blt
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
#!/bin/sh
set -eu
trap exit TERM INT QUIT
trap "killall tensorflow_mnist_short 2>/dev/null || true" EXIT
show_usage="0"
if [ ! -x setpgrp ]
then
echo "ERROR: setpgrp binary not found; did you build it?" >&2
exit 3
fi
if [ -z "${CATBENCH_JAGFILE-}" ]
then
cat >&2 <<-tac
$0: should be invoked via driver
tac
show_usage="2"
fi
if [ "$show_usage" -ne "0" -o $# -gt 2 ]
then
cat <<-tac
USAGE: $0 [min core count] [max core count]
[min core count] defaults to one.
[max core count] defaults to one fewer than the number of physical cores on the first CPU socket.
If only one of these is specified, it is assumed to be the max.
tac
exit "$show_usage"
fi
logfilename="$CATBENCH_JAGFILE"
num_trash="`lscpu | grep Core | tr -s " " | rev | cut -d" " -f1 | rev`"
step_trash="`grep -m2 "physical id" /proc/cpuinfo | uniq | wc -l`"
start_trash="1"
if [ -n "${2-}" ]
then
start_trash="$1"
shift
fi
if [ -n "${1-}" ]
then
num_trash="$1"
fi
constrain="$(((1 << (step_trash * num_trash)) - 1))"
printf "%s\n" "Trying core counts between $start_trash and $num_trash..."
jaguar/jaguar set "$logfilename" legend.samples.num_trash.description string "Cores running contender"
jaguar/jaguar set "$logfilename" legend.samples.num_trash.unit string ""
jaguar/jaguar set "$logfilename" legend.samples.contender_tput.description string "Contender throughput"
jaguar/jaguar set "$logfilename" legend.samples.contender_tput.unit string "epochs/s"
jaguar/jaguar set "$logfilename" data.basecontender.description string "ContenderOnly"
data="integer,fraction\nnum_trash,contender_tput"
mask="0x0"
for num in `seq "$num_trash"`
do
mask="`printf %#x "$(((mask + ((1 << (step_trash * num)) | num == num_trash)) & constrain))"`"
if [ "$num" -lt "$start_trash" ]
then
continue
fi
printf "\n%s\n" "$num cores (mask $mask):"
time="`time -p taskset "$mask" ./setpgrp ./tensorflow_mnist_short 2>&1 | tee /dev/tty | sed -n 's/.*real \(.*\).*/\1/p'`"
tput="`printf "%s\n" "1 / $time" | bc -l`"
printf "%s\n" "time $time s (tput $tput epochs/s)"
data="$data\n$num,$tput"
done
printf "$data" | jaguar/jaguar set "$logfilename" data.basecontender.samples array -