-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
142 lines (118 loc) · 3.35 KB
/
run.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
## This script runs our treewidht-based approach, together with 8 different heuristics and compares the number of cache misses in each case
## The script gets a sequence of references in input/ref.txt, it also gets the parameters m p where m is the size of the cache, p is the packing factor
m="$1";
p="$2";
tl=300; #time limit for our algorithms
tltwo=600; #time limit for finding tree decompositions
tlh=300; #time limit for heuristics
echo "time limit is:"
echo $tl
#move to a temporary directory
cp ../Algorithm1/Algorithm1 temp
cp ../Algorithm1/Algorithm2 temp
cp ../heuristics/1/h1 temp
cp ../heuristics/2/h2 temp
cp ../heuristics/3/h3 temp
cp ../heuristics/4/h4 temp
cp ../heuristics/5/h5 temp
cp ../heuristics/6/h6 temp
cp ../heuristics/util/cache_miss_count temp
cp ../nice-tree-decomposition/MakeNiceTreeDecomposition.jar temp
cp input/ref.txt temp
cd temp
################################
echo "Running our Approach..."
echo "Getting the Nice Tree Decomposition"
time timeout $tltwo java -jar MakeNiceTreeDecomposition.jar $m $p
rc=$?
if(($rc!=0))
then
echo "Error (perhaps TL exceeded?) in MakeNiceTreeDecomposition" >> ../output/error.txt
exit $rc
fi
if(($m>1))
then
echo "Running the second algorithm, because m>1"
time timeout $tl ./Algorithm2 $m $p
rc=$?
if(($rc!=0))
then
echo "Error (perhaps TL exceeded?) in Algorithm 2" >> ../output/error.txt
exit $rc
fi
else
echo "Running the first algorithm, m = 1"
time timeout $tl ./Algorithm1 $m $p
rc=$?
if(($rc!=0))
then
echo "Error (perhaps TL exceeded?) in Algorithm 1" >> ../output/error.txt
exit $rc
fi
fi
echo "End of our approach"
################################
echo "Running the heuristics"
################################
echo "Running Pipeline A"
time timeout $tlh ./h1 $m $p > scheme.txt
cat scheme.txt
echo "Cache misses:"
./cache_miss_count $m $p
################################
################################
echo "Running Pipeline B"
time timeout $tlh ./h2 $m $p > scheme.txt
cat scheme.txt
echo "Cache misses:"
./cache_miss_count $m $p
################################
################################
echo "Running Pipeline C"
time timeout $tlh ./h3 $m $p > scheme.txt
cat scheme.txt
echo "Cache misses:"
./cache_miss_count $m $p
################################
################################
echo "Running Pipline D"
time timeout $tlh ./h2 $m $p > scheme.txt
time timeout $tlh ./h4 $m $p > scheme.txt
cat scheme.txt
echo "Cache misses:"
./cache_miss_count $m $p
################################
################################
echo "Running Pipline E"
time timeout $tlh ./h3 $m $p > scheme.txt
time timeout $tlh ./h4 $m $p > scheme.txt
cat scheme.txt
echo "Cache misses:"
./cache_miss_count $m $p
################################
################################
echo "Running Pipline F"
time timeout $tlh ./h2 1 1 > scheme.txt
time timeout $tlh ./h4 $m $p > scheme.txt
cat scheme.txt
echo "Cache misses:"
./cache_miss_count $m $p
################################
################################
echo "Running Pipeline G"
time timeout $tlh ./h5 $m $p > scheme.txt
cat scheme.txt
echo "Cache misses:"
./cache_miss_count $m $p
################################
################################
echo "Running Pipeline H"
time timeout $tlh ./h6 $m $p > scheme.txt
cat scheme.txt
echo "Cache misses:"
./cache_miss_count $m $p
################################
echo "Run finished"
#clean up
#cd ..
#rm -r -f temp