-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmark_all
executable file
·80 lines (66 loc) · 1.37 KB
/
benchmark_all
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
#!/bin/bash
#function declaration
function usage() {
echo "Usage: benchmark_all <min_thread> <max_thread> <multiple_increment>"
echo "Usage: benchmark_all <min_thread> <max_thread> <multiple_increment> <optional_file_input>"
echo ""
}
#bash script
if [[ $# < 3 ]]
then
usage
exit 0
fi
if [[ $1 > $2 && [$1 < 1] ]]
then
usage
exit 0
fi
repeat=4
echo "Rebuilding projects..."
echo ""
make clean
make
echo ""
echo "Build complete."
echo ""
benchmark="./benchmark"
input_file="input/test_input_1500.in"
if [[ $# > 3 ]]
then
input_file=$4
fi
ref="bin/ref"
echo "=================================================================="
echo ""
echo "Running reference command ${ref}"
echo ""
eval ${benchmark} ${ref} ${input_file} ${repeat} 1
cmd[0]="bin/thread"
cmd[1]="bin/openmp"
cmd[2]="bin/opentask"
for((c = 0; c < ${#cmd[@]}; c++))
do
echo "=================================================================="
echo ""
echo "Running benchmark for command ${cmd[$c]}"
if [[ $1 < 2 ]]
then
echo ""
echo "Running single threaded variant..."
eval ${benchmark} ${cmd[$c]} ${input_file} ${repeat} 1
fi
start=$1
if [[ $1 == 1 ]]
then
start=2
fi
for (( i = $start; i <= $2 ; i+=$3 ))
do
echo ""
echo "Running for threadcount == ${i}..."
eval ${benchmark} ${cmd[$c]} ${input_file} ${repeat} ${i}
done
done
echo ""
echo "Done with benchmark for all"