forked from FR-GRE-BDS-HPC-SW-SAGE2-GMA/iocatcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbench.sh
executable file
·111 lines (101 loc) · 2.72 KB
/
bench.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
#!/bin/bash
# gnuplot
# config
MESSAGES=500000
CLIENTS=2
IP=10.1.3.26
SIZES="40 64 128 256 512 1024 $((1024*2)) $((1024*4)) $((1024*8)) $((1024*16)) $((1024*32)) $((1024*64)) $((1024*128)) $((1024*256)) $((1024*512)) $((1024*1024)) $((1024*2048)) $((1024*4096))"
DIVIDE_AT=$((64*1024))
DIVIDE_AT2=$((1024*1024))
#CLIENT_OPTS=-w
#SERVER_OPTS=-w
EXTRA_TITLE=
set -e
function gen_chart1()
{
# grep driver mode
mode="$(cat client.log | egrep '^NET:' | head -n 1 | cut -d ' ' -f 2 | sed -e 's/_/-/g')"
# gen plot cmd
cat > 'result.gnuplot' <<-EOF
set term pdf
set output 'result.pdf'
set logscale x 2
set xlabel 'Message size (kBytes)'
set ylabel 'Rate (kMsg/s)'
set ytics tc lt 1
set y2tics tc lt 2
set y2label 'Bandwidth (Gbits/s)' tc lt 2
set title "Libfaric ping pong (${mode})${EXTRA_TITLE}"
set grid
plot 'result.log' u (\$13/1024):5 w lp title "Message rate", '' u (\$13/1024):8 axes x1y2 w lp title "Bandwidth"
EOF
# plot
gnuplot 'result.gnuplot'
}
function gen_chart2()
{
# grep driver mode
mode="$(cat client.log | egrep '^NET:' | head -n 1 | cut -d ' ' -f 2 | sed -e 's/_/-/g')"
# gen plot cmd
cat > 'result2.gnuplot' <<-EOF
set term pdf
set output 'result2.pdf'
set logscale x 2
set xlabel 'Message size (kBytes)'
set ylabel 'Rate (kMsg/s)'
set ytics tc lt 1
set y2tics tc lt 2
set y2label 'Bandwidth (Gbytes/s)' tc lt 2
set title "Libfaric ping pong (${mode})${EXTRA_TITLE}"
set grid
plot 'result.log' u (\$13/1024):5 w lp title "Message rate", '' u (\$13/1024):10 axes x1y2 w lp title "Bandwidth"
EOF
# plot
gnuplot 'result2.gnuplot'
}
# run server in loop
function run_server()
{
# reset
echo > result.log
# loop
for size in ${SIZES}
do
if [ ${size} == $DIVIDE_AT ]; then MESSAGES=$(($MESSAGES/10)); fi
if [ ${size} == $DIVIDE_AT2 ]; then MESSAGES=$(($MESSAGES/10)); fi
hwloc-bind --cpubind core:${CLIENTS} -- ./poc ${SERVER_OPTS} -m ${MESSAGES} -S ${size} -C ${CLIENTS} -s ${IP} | egrep '^Time' | tee -a result.log
done
gen_chart1
gen_chart2
}
# run client in loop
function run_client()
{
#reset
echo > client.log
# loop
for size in ${SIZES}
do
if [ ${size} == $DIVIDE_AT ]; then MESSAGES=$(($MESSAGES/10)); fi
if [ ${size} == $DIVIDE_AT2 ]; then MESSAGES=$(($MESSAGES/10)); fi
if [ ${CLIENTS} == 1 ]; then
hwloc-bind --cpubind core:0-$((${CLIENTS}-1)) -- ./poc ${CLIENT_OPTS} -m ${MESSAGES} -S ${size} -t ${CLIENTS} -C ${CLIENTS} -c ${IP} | tee -a client.log
else
hwloc-bind --cpubind core:$((${CLIENTS}-1)) -- ./poc ${CLIENT_OPTS} -m ${MESSAGES} -S ${size} -t ${CLIENTS} -C ${CLIENTS} -c ${IP} | tee -a client.log
fi
sleep 10
done
}
# select
case $1 in
's')
run_server
;;
'c')
run_client
;;
*)
echo "Invalid mode, please give 's' or 'c' as parameter !" 1>&2
exit 1
;;
esac