-
Notifications
You must be signed in to change notification settings - Fork 0
/
commons.sh
152 lines (128 loc) · 3.1 KB
/
commons.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
use_all_workloads(){
WORKLOADS=(ycsb_a_uni ycsb_b_uni ycsb_c_uni ycsb_e_uni ycsb_a_zipf ycsb_b_zipf ycsb_c_zipf ycsb_e_zipf)
}
use_ab_workloads(){
WORKLOADS=(ycsb_a_uni ycsb_b_uni ycsb_a_zipf ycsb_b_zipf)
}
use_a_workloads(){
WORKLOADS=(ycsb_a_uni ycsb_a_zipf)
}
use_default_params(){
NKEYS=20000000
THREADS=8
NOPS=1000000
DELAYS=0
}
create_output(){
#$1=filename
mkdir -p output
OUTFILE=output/$1.txt
rm -rf ${OUTFILE}
echo "Results in ${OUTFILE}"
}
reset_perf_dirs(){
OUTDIR=perf_output
rm -rf $OUTDIR
mkdir $OUTDIR
echo "Result files in ${OUTDIR}"
}
create_perf_output(){
#$1=filename
OUTFILE=$OUTDIR/$1.txt
rm -rf ${OUTFILE}
echo "Results in ${OUTFILE}"
}
full_make(){
#ex:$1=EXTFLAGS=-DSKIP_CRITICAL_SECTION or EXTFLAGS=-DDISABLE_ALL
echo "clean then make mttest"
make clean
make mttest $1
}
quick_make(){
echo "make mttest"
make mttest
}
remove_nvm_files(){
rm -rf /scratch/tmp/nvm.*
rm -rf /dev/shm/incll/nvm.*
}
remove_json_out(){
rm -rf *.json
}
remove_files(){
remove_nvm_files
remove_json_out
}
write_csv_header_args(){
#ex: $1=Nkeys
#requires OUTFILE
echo "TotalOps,AvgOps,StdOps,StdPOps,Workload,$1" >> ${OUTFILE}
}
write_csv_header(){
#requires OUTFILE
echo "TotalOps,AvgOps,StdOps,StdPOps,Workload" >> ${OUTFILE}
}
run_single_experiment(){
echo "Workload:${WORKLOAD} keys and initops:${NKEYS} NOPS:${NOPS} threads:${THREADS} delay:${DELAYS} pinned"
./mttest ${WORKLOAD} --nops1=${NOPS} --ninitops=${NKEYS} --nkeys=${NKEYS} --threads=${THREADS} --delaycount=${DELAYS} --pin
sleep 1
}
run_perfed_experiment(){
echo "Workload:${WORKLOAD} keys and initops:${NKEYS} NOPS:${NOPS} threads:${THREADS} pinned"
/usr/bin/time -f "%e,,real-elapsed-time(10runs),,,,," perf stat -d -o ${Oname} -r ${REPEAT} -e instructions:u,task-clock -x, ./mttest ${WORKLOAD} --nops1=${NOPS} --ninitops=${NKEYS} --nkeys=${NKEYS} --threads=${THREADS} --pin &> ${Odump}
echo "read elapsed time"
tail -1 ${Odump} >> ${OUTFILE}
}
run_perf_simple_experiment(){
echo "Workload:${WORKLOAD} keys and initops:${NKEYS} NOPS:${NOPS} threads:${THREADS} pinned"
perf stat -d -r ${REPEAT} -e instructions:u,task-clock -x, ./mttest ${WORKLOAD} --nops1=${NOPS} --ninitops=${NKEYS} --nkeys=${NKEYS} --threads=${THREADS} --pin
}
get_average_results(){
#requires OUTFILE
python get_average.py "${WORKLOAD}" >> ${OUTFILE}
}
get_average_results_args(){
#ex: $1=${NKEYS}
#requires OUTFILE
python get_average.py "${WORKLOAD},$1" >> ${OUTFILE}
}
read_out(){
cat ${OUTFILE}
}
remove_out(){
rm ${OUTFILE}
}
run_multi_experiment(){
#requires REPEAT, WORKLOAD
for i in $(eval echo {1..$REPEAT}); do
remove_nvm_files
run_single_experiment
remove_nvm_files
sleep 1
done
}
run_different_workloads(){
for WORKLOAD in ${WORKLOADS[@]}; do
remove_json_out
run_multi_experiment
get_average_results
done
}
run_different_workloads_args(){
#ex:$1=${NKEYS}
for WORKLOAD in ${WORKLOADS[@]}; do
remove_json_out
run_multi_experiment
get_average_results_args $1
done
}
set_repeat(){
#ex $1=REPEAT
REPEAT=$1
#argument processing
if [ -z "$1" ]
then
REPEAT=10
fi
echo "repeat:${REPEAT}"
}