-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_app.sh
More file actions
executable file
·78 lines (68 loc) · 2.75 KB
/
Copy pathrun_app.sh
File metadata and controls
executable file
·78 lines (68 loc) · 2.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
#!/bin/bash
# Written By Lixiang
mpr_dir=${PWD}
champsim_dir=${PWD}/external/ChampSim
bench_dir=${mpr_dir}/test-cases
trace_dir=${mpr_dir}/trace
result_dir=${mpr_dir}/result
RUN_UNION_TRACE=true
RUN_MPR=true
RUN_CHAMPSIM=true
RUN_VALIDATE=false
RUN_PARSER=true
app=$1
binary_file=${bench_dir}/${app}/${app}
champsim_trace_file=${trace_dir}/champsim/${app}.champsim.trace
mpr_trace_file=${trace_dir}/mpr/${app}.mpr.trace
# skip_len=750000000000
skip_len=0
trace_len=300000000
# Get trace from union tracer
if [ "$RUN_UNION_TRACE" = true ] ; then
# Build app
gcc -O0 -g ${binary_file}.c -o ${binary_file}
objdump -S ${binary_file} > ${binary_file}.asm
# app_input=
if [ -f "$champsim_trace_file" ] ; then
rm "$champsim_trace_file"
fi
if [ -f "$mpr_trace_file" ] ; then
rm "$mpr_trace_file"
fi
mkdir -p ${trace_dir}/champsim
mkdir -p ${trace_dir}/mpr
pin -t ${mpr_dir}/tracer/obj-intel64/union_tracer.so -o ${champsim_trace_file} -m ${mpr_trace_file} -t ${trace_len} -s ${skip_len} -- ${binary_file} 2>${result_dir}/${app}/tracer_err.txt
gzip -c ${champsim_trace_file} > ${champsim_trace_file}.gz
if [ -f "$champsim_trace_file" ] ; then
rm "$champsim_trace_file"
fi
fi
# Get pattern from MPR
stat_file=${result_dir}/${app}/${app}.stat
pattern_file=${result_dir}/${app}/${app}.pattern
hotregion_file=${result_dir}/${app}/${app}.hotregion
if [ "$RUN_MPR" = true ] ; then
mkdir -p ${result_dir}/${app}
echo ${mpr_dir}/build/mpr --analyze -trace=${mpr_trace_file} -stat=${stat_file} -pattern=${pattern_file} -hotregionresult=${hotregion_file} 2>${result_dir}/${app}/mpr_err.txt &
${mpr_dir}/build/mpr --analyze -trace=${mpr_trace_file} -stat=${stat_file} -pattern=${pattern_file} -hotregionresult=${hotregion_file} 2>${result_dir}/${app}/mpr_err.txt &
fi
# Get miss from Champsim
miss_file=${result_dir}/${app}/${app}.miss
if [ "$RUN_CHAMPSIM" = true ] ; then
mkdir -p ${result_dir}/${app}
${champsim_dir}/bin/champsim --warmup_instructions 0 --simulation_instructions ${trace_len} ${champsim_trace_file}.gz 1>/dev/null 2>${miss_file} &
fi
wait
echo "Analyze $app done."
result_file=${result_dir}/${app}/${app}.res
if [ "$RUN_VALIDATE" = true ] ; then
mkdir -p ${result_dir}/${app}
${mpr_dir}/build/mpr --validate -trace=${mpr_trace_file} -pattern=${pattern_file} -result=${result_file} 2>${result_dir}/${app}/valid_err.txt &
fi
if [ "$RUN_PARSER" = true ] ; then
out_file=${result_dir}/${app}/${app}.csv
echo ${mpr_dir}/build/pattern2line ${miss_file} ${pattern_file} ${out_file} ${binary_file} 2>${result_dir}/${app}/parse_err.txt
${mpr_dir}/build/pattern2line ${miss_file} ${pattern_file} ${out_file} ${binary_file} 2>${result_dir}/${app}/parse_err.txt &
fi
wait
echo "Run $app done."