forked from parallelcomputingabo/Homework-2
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathbenchmark.sh
More file actions
executable file
·35 lines (30 loc) · 1.92 KB
/
benchmark.sh
File metadata and controls
executable file
·35 lines (30 loc) · 1.92 KB
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
#! /bin/sh
echo 'Iterating each data folder and running benchmark 100 times on each case...'
# run benchmark and save results to results/benchmark{case_number}.txt
mkdir -p results
echo '+====================================================================================================+'
for data in `seq 0 9`; do
echo "| Running benchmark on $data |"
echo -n '|'
: > results/benchmark$data.txt
for i in `seq 100`; do
./matmul $data >> results/benchmark$data.txt
echo -n '-'
done
echo '|'
done
echo '+====================================================================================================+'
# extract statistics from results and save to results/benchmark_summary.csv
echo 'Extracting statistics from benchmark results...'
RESULT_FILE=results/benchmark_summary.csv
: > $RESULT_FILE
echo 'Test Case,Dimensions (m × n × p),Naive Time (s),Blocked Time (s),Parallel Time (s),Blocked Speedup,Parallel Speedup' > $RESULT_FILE
for data in `seq 0 9`; do
echo -n "$data," >> $RESULT_FILE
grep -oEm1 '[0-9]+x[0-9]+x[0-9]+' results/benchmark$data.txt | tr '\n' ',' >> $RESULT_FILE
grep 'Naive time' results/benchmark$data.txt | cut -d' ' -f3 | awk '{sum+=$1; count++} END {print sum/count}' | tr '\n' ',' >> $RESULT_FILE
grep 'Blocked time' results/benchmark$data.txt | cut -d' ' -f3 | awk '{sum+=$1; count++} END {print sum/count}' | tr '\n' ',' >> $RESULT_FILE
grep 'Parallel time' results/benchmark$data.txt | cut -d' ' -f3 | awk '{sum+=$1; count++} END {print sum/count}' | tr '\n' ',' >> $RESULT_FILE
grep 'Blocked speedup' results/benchmark$data.txt | cut -d' ' -f3 | tr -d 'x' | awk '{sum+=$1; count++} END {print sum/count}' | tr '\n' ',' >> $RESULT_FILE
grep 'Parallel speedup' results/benchmark$data.txt | cut -d' ' -f3 | tr -d 'x' | awk '{sum+=$1; count++} END {print sum/count}' >> $RESULT_FILE
done