-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelper.sh
executable file
·185 lines (176 loc) · 3.43 KB
/
helper.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
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#!/bin/bash
clean() {
echo "==== Cleaning build folder ===="
rm -rf build/
rm compile_commands.json
}
config() {
echo "==== Crating build folder ===="
mkdir build
cd build
echo "==== Configuring cmake ===="
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DLT_LLVM_INSTALL_DIR=$LLVM_DIR ..
cd ..
cp build/compile_commands.json compile_commands.json
echo "==== Done! ===="
}
compile() {
cd build
echo "==== Compiling Project ===="
ninja
cd ..
echo "==== Done! ===="
}
run() {
echo "==== Running $1 ===="
opt -load-pass-plugin build/lib/libCacheAnalysisPass.so \
-passes='lru-misses(function(loop-unroll-and-jam))' \
test/$1.ll -o /dev/null
#llvm-dis < out.bc > out.ll
}
test() {
./build/bin/UnitTest --gtest_brief=1
}
allBenchs=("adpcm"
"bs"
"bsort100"
"cnt"
"compress"
"cover"
"crc"
"dijkstra"
"duff"
"edn"
"expint"
"fdct"
"fft1"
"fibcall"
"fir"
"hello"
"insertsort"
"janne_complex"
"jfdctint"
"lcdnum"
"lms"
"ludcmp"
"matmult"
"minver"
"ndes"
"nsichneu"
"ns"
"prime"
"qsort-exam"
"qurt"
"recursion"
"select"
"sqrt"
"statemate"
"ud"
"whet"
)
runall() {
for str in ${allBenchs[@]}; do
echo
run $str
done
}
autogradesetup() {
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 14
sudo apt update
sudo apt install cmake ninja-build
export LLVM_DIR=/usr/lib/llvm-14
clean
config
compile
}
case $1 in
as)
autogradesetup
;;
clean)
clean
;;
config)
config
;;
c | compile)
compile
;;
cr)
compile
if [ $2 ]; then
run $2
else
echo "==== Please provide name of the test as second argument! ===="
fi
;;
r | run)
if [ $2 ]; then
run $2
else
echo "==== Please provide name of the test as second argument! ===="
fi
;;
t | test)
test
;;
ra | runall)
runall
;;
docker)
docker build -t rtsalab01cacheanalysis:latest .
docker run -i -d -v "$(pwd)"/.:/root:rw --name RTSAlab01 rtsalab01cacheanalysis
;;
evaluation | eval)
run "crc"
echo "==== Correct crc ===="
echo "MustHits: 90"
echo
run "cnt"
echo "==== Correct cnt ===="
echo "MustHits: 28"
echo
run "duff"
echo "==== Correct duff ===="
echo "MustHits: 78"
echo
run "fft1"
echo "==== Correct fft1 ===="
echo "MustHits: 74"
echo
run "insertsort"
echo "==== Correct insertsort ===="
echo "MustHits: 61"
echo
run "matmult"
echo "==== Correct matmult ===="
echo "MustHits: 34"
echo
;;
a | all)
clean
config
cd build
ninja
echo "==== Done! ===="
;;
*)
if [ $1 ]; then
echo "Unknown argument: $1"
fi
echo "Please provide one of the following arguments:"
echo " clean Deletes the build folder"
echo " config Creates build folder and configures build System"
echo " docker Build and Run Docker container for development"
echo " eval Run a subset of tests for evaluation of your implementation"
echo " c | compile Compiles the Project"
echo " a | all Cleans, configures and compiles the project"
echo " r | run [name] Run pass on test/[name] from the test folder"
echo " cr [name] Compile and run pass on test/[name] from the test folder"
echo " ra | runall Run pass on all tests from the test folder"
echo " t | test Execute Unit tests, only test that Fail are printed."
exit
;;
esac