Skip to content

Commit 1e9ecb6

Browse files
committed
report: make efficiency print wall-time graphs too
Now, the efficiency script directly outputs the timings to .wt.csv. Then we use awk to process this csv file and compute another one with the speedups (awk is actually really useful to process csv files). We don't use log scales for the strong scaling graph, to avoid focus on low core counts.
1 parent ccab9c7 commit 1e9ecb6

File tree

1 file changed

+70
-19
lines changed

1 file changed

+70
-19
lines changed

tools/report/efficiency

Lines changed: 70 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ shift
1818

1919
csv="$BASELINE.strong.csv"
2020
svg="$BASELINE.strong.svg"
21+
csv_wt="$BASELINE.wt.csv"
22+
svg_wt="$BASELINE.wt.svg"
2123

2224
bg_path() {
2325
benchmark_group=$1
@@ -47,7 +49,7 @@ stddev_ns() {
4749
fi
4850
}
4951

50-
sayfile Aggregating "$csv"
52+
sayfile Aggregating "$csv_wt"
5153

5254
thread_counts=$(
5355
for benchmark_group in "$@"
@@ -65,10 +67,10 @@ done | sort -n | uniq
6567
for benchmark_group in "$@"
6668
do
6769
group=$(echo "$benchmark_group" | tr ';' '_')
68-
printf " ; %s" "$group"
70+
printf ";%s" "$group"
6971
done
7072
printf "\n"
71-
) >"$csv"
73+
) >"$csv_wt"
7274

7375
echo "$thread_counts" | while read -r thread_count
7476
do
@@ -77,37 +79,86 @@ do
7779
do
7880
if t=$(time_ns "$benchmark_group" "$thread_count")
7981
then
80-
t_seq=$(time_ns "$benchmark_group" 1)
81-
speedup=$(echo "$t_seq / $t" | bc -l)
82-
printf " ; %f" "$speedup"
82+
printf ";%f" "$t"
8383
else
84-
printf " ;"
84+
printf ";"
8585
fi
8686
done
8787
printf "\n"
88-
done >>"$csv"
88+
done >>"$csv_wt"
8989

90-
max_thread_count=$(echo "$thread_counts" | tail -n1)
91-
plot_cmds=$(awk -v csv="$csv" "BEGIN{
92-
for (i=1; i<ARGC; i++) {
93-
gsub(/_/, \"\\\\_\", ARGV[i])
94-
printf \",'%s' using 1:%d title '%s' with linespoints\",csv,i+1,ARGV[i]
90+
sayfile Aggregating "$csv"
91+
92+
awk '
93+
BEGIN { FS = ";"; OFS = ";" }
94+
(NR == 1) { print }
95+
(NR == 2) {
96+
for (i = 2; i <= NF; i++) { t_seq[i] = $i; $i = 1 }
97+
print
98+
}
99+
(NR > 2) {
100+
for (i = 2; i <= NF; i++) {
101+
if ($i != "") { $i = t_seq[i] / $i }
102+
}
103+
print
104+
}
105+
' "$csv_wt" >"$csv"
106+
107+
speedup_bound=$(awk '
108+
BEGIN { max_speedup = 0; FS = ";" }
109+
(NR > 1) {
110+
for (i = 2; i <= NF; i++) {
111+
if (max_speedup < $i) { max_speedup = $i }
112+
}
95113
}
96-
}" $@)
114+
END { print max_speedup * 1.05 }
115+
' "$csv")
116+
117+
max_thread_count=$(echo "$thread_counts" | tail -n1)
118+
plot_cmds() {
119+
csv="$1"
120+
shift
121+
122+
i=2
123+
for p in "$@"
124+
do
125+
p=$(echo "$p" | sed 's/_/\\_/g')
126+
printf "'%s' using 1:%d title '%s' with linespoints" "$csv" "$i" "$p"
127+
if [ $i -le $# ]
128+
then printf ", "
129+
fi
130+
i=$((i+1))
131+
done
132+
}
133+
134+
sayfile Rendering "$svg"
97135

98136
gnuplot <<EOF
99137
set output '$svg'
100138
set datafile separator ';'
101139
set term svg size 1366,768
102140
103-
set title 'Strong scaling'
141+
set title '$TITLE - strong scaling'
104142
set xlabel 'Number of threads'
105143
set ylabel 'Speedup'
106144
set xrange [1:$max_thread_count]
107-
set logscale x 2
108-
set logscale y 2
145+
set yrange [1:$speedup_bound]
109146
set grid ytics
110-
plot x title 'Ideal' dashtype 2 $plot_cmds
147+
plot x title 'Ideal' dashtype 2, $(plot_cmds "$csv" "$@")
111148
EOF
112149

113-
say Rendered "$svg"
150+
sayfile Rendering "$svg_wt"
151+
152+
gnuplot <<EOF
153+
set output '$svg_wt'
154+
set datafile separator ';'
155+
set term svg size 1366,768
156+
157+
set title '$TITLE - wall time'
158+
set xlabel 'Number of threads'
159+
set ylabel 'Wall time (ns)'
160+
set xrange [1:$max_thread_count]
161+
set logscale y 10
162+
set grid ytics
163+
plot $(plot_cmds "$csv_wt" "$@")
164+
EOF

0 commit comments

Comments
 (0)