-
Notifications
You must be signed in to change notification settings - Fork 18
/
run_dnnmark_template.sh
executable file
·152 lines (136 loc) · 3.53 KB
/
run_dnnmark_template.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
#!/bin/bash
# Wrapper API for DNNMark
# 2018 (C) Peter Bryzgalov @ CHITECH Stair Lab
usage=$(cat <<- USAGEBLOCK
Run DNNMark with parameters from CLI.
Usage:
$(basename $0) [-n <number of images, batch size>]
[-c <number of channels in input images>]
[-h <height of input images>]
[-w <widht of input images>]
[-k <number of filters, ouput channels>]
[-s <size of filter kernel>]
[-u <stride>]
[-p <padding>]
[ --algo <cudnnConvolutionBwdFilterAlgo_t> - cuDNN algorithm for backward filter convolution]
[ --bwd_filter_pref <fastest/no_workspace/specify_workspace_limit> - cuDNN backward filter algorithm selection preference]
[ --algod <cudnnConvolutionBwdDataAlgo_t> - cuDNN algorithm for backward data convolution]
[-b <benchmark executable, default=test_bwd_conv>]
[ --iter <int> - number of FWD+BWD passes to measure time]
[ --template - benchmark configuration template file]
[ --debug - debug info ]
[ --help - usage info ]
[ -d <dataset size> - number of samples in dataset, derives number of iterations from batch size and datasetsize]
Configuration saved in temporary file conf_tmp.dnnmark
USAGEBLOCK
)
template="conf_convolution_block.dnntemplate"
config_file="conf_tmp.dnnmark"
conv_bwd_filter_pref="fastest"
# Defaults
N=64
C=3
H=32
W=32
K=128
S=3
U=1
P=1
BENCH="test_composed_model"
ITER=1
debug=0
datasetsize=0
while test $# -gt 0; do
case "$1" in
--help)
echo "$usage"
exit 0
;;
-n)
N="$2";shift;
;;
-c)
C="$2";shift;
;;
-h)
H="$2";shift;
;;
-w)
W="$2";shift;
;;
-k)
K="$2";shift;
;;
-s)
S="$2";shift;
;;
-u)
U="$2";shift;
;;
-p)
P="$2";shift;
;;
-b)
BENCH="$2";shift;
;;
-d)
datasetsize="$2";shift;
;;
--algo)
CBFA="$2";shift;
;;
--bwd_filter_pref)
conv_bwd_filter_pref="$2";shift;
;;
--algod)
CBDA="$2";shift;
;;
--iter)
ITER="$2";shift;
;;
--debug)
debug=1
;;
--template)
template="$2";shift;
;;
--)
shift
break;;
-*)
echo "Unknown option $1";
echo "$usage"
exit 1
;;
*)
break;;
esac
shift
done
if [ $CBFA ];then
CUDNN_CBFA="algo=$CBFA"
fi
if [ $CBDA ];then
CUDNN_CBDA="algod=$CBDA"
fi
divide_ceil() {
echo "($1 + $2 - 1)/$2" | bc
}
# Calculate number of iterations from BS ($N) and dataset size
if [ $datasetsize -gt 0 ]; then
echo "datasetsize=$datasetsize"
# echo "$datasetsize / $N = "
# echo "$(divide_ceil $datasetsize $N)"
ITER=$(divide_ceil $datasetsize $N)
fi
echo "Using template $template"
conf="$(echo EOF;cat $template;echo EOF)"
eval "cat <<$conf" >$config_file
echo "Config: ---"
cat $config_file
echo "-----------"
echo "Benchmark: $BENCH"
echo "Iterations:$ITER"
com="./build/benchmarks/${BENCH}/dnnmark_${BENCH} -config $config_file --warmup 0 --iterations $ITER --debuginfo $debug"
echo $com
$com