-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tests.slurm
executable file
·201 lines (141 loc) · 4 KB
/
run_tests.slurm
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#!/bin/bash
#SBATCH -n 1 # Number of tasks
#SBATCH -c 20 # Number of cores requested
#SBATCH -N 1 # Number of nodes requested
#SBATCH -t 300 # Runtime in minutes
#SBATCH -o on_a_single_node.out # Standard out goes to this file
#SBATCH -e on_a_single_node.err # Standard err goes to this file
#SBATCH --mail-type ALL
#SBATCH --mail-user tknappra@hawaii.edu
#SBATCH --account=ics_632
#SBATCH -p ics632.q
echo "running tests..."
# setup vars
str="time_val"
n=9500 # array size
k_start=1 # tile size start
k_end=300 # tile size end
k_inc=1 # tile increment amount
epochs=10 # tests per tile size
# clear any possible previous results
> normal_time_results.txt
> tile_time_results.txt
> normal_l1_results.txt
> tile_l1_results.txt
> normal_llc_results.txt
> tile_llc_results.txt
###### time - non tiled ########
echo "time - non tiled"
# compile
icc exercise1.c -o exercise1 -O3 -D N=$n -D k=100
for ((i=0; i<epochs; i++))
do
# send stats to output file
perf stat -o perf.txt ./exercise1;
# parse time value from output file
str=$(cat perf.txt | grep "seconds time elapsed" | sed "s/ *//" | sed "s/ seconds.*//" | sed "s/,//g")
# append time with trial number to time_results file
echo -n "$str, " >> normal_time_results.txt
# log trial number
echo $i
done
echo ""
###### time - tiled ########
echo "time - tiled"
for ((j=k_start; j<=k_end; j+=k_inc))
do
# compile
icc exercise1.c -o exercise1 -O3 -D N=$n -D k=$j -D TILE_MODE
# append tile size to time_results file
echo -n "$j, " >> tile_time_results.txt
# log tile size
echo $j
for ((i=0; i<epochs; i++))
do
# send stats to output file
perf stat -o perf.txt ./exercise1;
# parse time value from output file
str=$(cat perf.txt | grep "seconds time elapsed" | sed "s/ *//" | sed "s/ seconds.*//" | sed "s/,//g")
# append time with trial number to time_results file
echo -n "$str, " >> tile_time_results.txt
# log trial number
echo $i
done
echo "" >> tile_time_results.txt
done
echo ""
###### L1 cache misses - non tiled ########
echo "L1 cache misses - non tiled"
icc exercise1.c -o exercise1 -O3 -D N=$n -D k=100
for ((i=0; i<epochs; i++))
do
perf stat -e L1-dcache-load-misses -o perf.txt ./exercise1;
str=$(cat perf.txt | grep "L1" | sed "s/ *//" | sed "s/ .*L1.*//" | sed "s/,//g")
echo -n "$str, " >> normal_l1_results.txt
echo $i
done
echo ""
###### L1 cache misses - tiled ########
echo "L1 cache misses - tiled"
for ((j=k_start; j<=k_end; j+=k_inc))
do
icc exercise1.c -o exercise1 -O3 -D N=$n -D k=$j -D TILE_MODE
echo -n "$j, " >> tile_l1_results.txt
echo $j
for ((i=0; i<epochs; i++))
do
perf stat -e L1-dcache-load-misses -o perf.txt ./exercise1;
str=$(cat perf.txt | grep "L1" | sed "s/ *//" | sed "s/ .*L1.*//" | sed "s/,//g")
echo -n "$str, " >> tile_l1_results.txt
echo $i
done
echo "" >> tile_l1_results.txt
done
echo ""
###### LLC misses - non tiled ########
echo "LLC misses - non tiled"
icc exercise1.c -o exercise1 -O3 -D N=$n -D k=100
for ((i=0; i<epochs; i++))
do
perf stat -e LLC-load-misses -o perf.txt ./exercise1;
str=$(cat perf.txt | grep "LLC" | sed "s/ *//" | sed "s/ .*LLC.*//" | sed "s/,//g")
echo -n "$str, " >> normal_llc_results.txt
echo $i
done
echo ""
###### LLC misses - tiled ########
echo "LLC misses - tiled"
for ((j=k_start; j<=k_end; j+=k_inc))
do
icc exercise1.c -o exercise1 -O3 -D N=$n -D k=$j -D TILE_MODE
echo -n "$j, " >> tile_llc_results.txt
echo $j
for ((i=0; i<epochs; i++))
do
perf stat -e LLC-load-misses -o perf.txt ./exercise1;
str=$(cat perf.txt | grep "LLC" | sed "s/ *//" | sed "s/ .*LLC.*//" | sed "s/,//g")
echo -n "$str, " >> tile_llc_results.txt
echo $i
done
echo "" >> tile_llc_results.txt
done
echo ""
# log everything
cat normal_time_results.txt
echo ""
echo ""
cat tile_time_results.txt
echo ""
echo ""
cat normal_l1_results.txt
echo ""
echo ""
cat tile_l1_results.txt
echo ""
echo ""
cat normal_llc_results.txt
echo ""
echo ""
cat tile_llc_results.txt
echo ""
echo ""