-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgreedy.sh
More file actions
executable file
·151 lines (136 loc) · 4.75 KB
/
greedy.sh
File metadata and controls
executable file
·151 lines (136 loc) · 4.75 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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/bash
set -e
# *****************************************************************************
# Defaults of arguments
# *****************************************************************************
scaleFactor=100
repetitions=10
processingStyle="avx512<v512<uint64_t>>"
queries="1.1 1.2 1.3 2.1 2.2 2.3 3.1 3.2 3.3 3.4 4.1 4.2 4.3"
findBest=""
findWorst=""
pathArtifacts="."
pathMal=""
pathRefRes=""
# *****************************************************************************
# Help message
# *****************************************************************************
function print_help () {
echo "Usage: greedy.sh [-h] [-sf N] [-r N] [-ps PROCESSING_STYLE] [-q {N.N}]"
echo " [--findBest] [--findWorst]"
echo " [--pathArtifacts] [--pathMal] [--pathRefRes]"
echo ""
echo "Determines the best and/or worst format combination w.r.t. "
echo "performance for all SSB queries."
echo ""
echo "Prerequisites:"
echo " - You have set up the evaluation environment using "
echo " 'setup_eval_env.sh'."
echo ""
echo "Optional arguments:"
echo " -h, --help Show this help message and exit."
echo " -sf N, --scaleFactor N The SSB scale factor to use. Defaults to "
echo " $scaleFactor."
echo " -r N, --repetitions N The number of times to execute each "
echo " query. Defaults to $repetitions."
echo " -ps PROCESSING_STYLE, --processingStyle PROCESSING_STYLE"
echo " The processing style to use, e.g."
echo " 'scalar<v64<uint64_t>>' or 'avx512<v512<uint6_t>>'."
echo " Defaults to '$processingStyle'."
echo " -q {N.N}, --query {N.N}, --queries {N.N}"
echo " The numbers of the queries to execute. "
echo " Multiple queries can be specified by "
echo " passing a space-separated list enclosed "
echo " in quotation marks. Defaults to all queries."
echo " --findBest Determine the best format combination for "
echo " each query. Output is stored to directory "
echo " '$actualBestDirName'."
echo " --findWorst Determine the worst format combination for "
echo " each query. Output is stored to directory "
echo " '$actualWorstDirName'."
}
# *****************************************************************************
# Argument parsing
# *****************************************************************************
# Parse arguments.
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
print_help
exit 0
;;
-sf|--scaleFactor)
scaleFactor=$2
shift
;;
-r|--repetitions)
repetitions=$2
shift
;;
-ps|--processingStyle)
processingStyle=$2
shift
;;
-q|--query|--queries)
queries=$2
shift
;;
--findBest)
findBest=1
;;
--findWorst)
findWorst=1
;;
--pathArtifacts)
pathArtifacts=$2
shift
;;
--pathMal)
pathMal=$2
shift
;;
--pathRefRes)
pathRefRes=$2
shift
;;
*)
printf "unknown option: $key\n"
exit -1
;;
esac
shift
done
pathBest=$pathArtifacts/ssb_formats_bestperf_sf$scaleFactor
pathWorst=$pathArtifacts/ssb_formats_worstperf_sf$scaleFactor
# *****************************************************************************
# Creation of the results directories
# *****************************************************************************
if [[ $findBest ]]
then
mkdir --parents $pathBest
fi
if [[ $findWorst ]]
then
mkdir --parents $pathWorst
fi
# TODO Don't hardcode this path.
cd MorphStore/Benchmarks/ssb
# *****************************************************************************
# Execution of the greedy algorithm
# *****************************************************************************
# TODO The reference results should not be necessary here.
defaultArgs="-sf $scaleFactor -ps $processingStyle -r $repetitions --pathArtifacts $pathArtifacts --pathMal $pathMal --pathRefRes $pathRefRes"
for q in $queries
do
if [[ $findBest ]]
then
./greedy.py $defaultArgs -q $q -o $pathBest --findBest
fi
if [[ $findWorst ]]
then
./greedy.py $defaultArgs -q $q -o $pathWorst --findWorst
fi
done
set +e