-
Notifications
You must be signed in to change notification settings - Fork 4
/
addrs.sh
executable file
·71 lines (52 loc) · 1.57 KB
/
addrs.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
#!/bin/zsh
source run_env.sh
max_test=80
max_retries=10
stride=1
train_len=256
run_id="addr_sweep_${train_len}"
if [ ! -f addrs.dat ]; then
echo "Generating addrs.dat"
./make_addrs.py
fi
export FORCEADDR=1
make -B
mkdir -p out
outdir="sweep_out/${run_id}_${stride}"
mkdir -p $outdir
out_file="${outdir}/${run_id}_sweep.out"
echo "Saving results to ${outdir} and $out_file"
while read addr; do
echo "${GREEN}================ $addr ================${NOCOLOR}"
# run experiment and get data. Repeat until AoP activates
aop_active=0
retries=1
while [[ aop_active -eq 0 && $retries -lt $max_retries ]]; do
[[ $retries -gt 1 ]] && echo \
"${RED}${addr} Attempt #$retries/$max_retries${NOCOLOR}"
successful=0
alloc_retries=1
while [[ $successful -eq 0 && $alloc_retries -lt $max_retries ]]; do
successful=1
$BIN $train_len 1 32 4 $stride $addr || successful=0
((alloc_retries += 1))
done
((retries += 1))
if [[ $successful -eq 0 ]]; then
echo "${RED}${addr} Failed to allocate${NOCOLOR}"
continue
fi
aop_active=1
./get_avg.py "out/baseline.out" "out/aop.out" \
"${run_id}" --append_save --omit --save_file $out_file || aop_active=0
if [[ $retries -eq $max_retries && $aop_active -eq 0 ]] then
./get_avg.py "out/baseline.out" "out/aop.out" \
"${run_id}" --append_save --omit --save_file $out_file --save_anyway
echo "Abandoning ${addr} after $retries attempts"
fi
done
if [[ -f "out/aop.out" ]]; then
mv -f out/aop.out "${outdir}/aop_${addr}.out"
mv -f out/baseline.out "${outdir}/baseline_${addr}.out"
fi
done < addrs.dat