-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_single_batch_inference.sh
executable file
·64 lines (49 loc) · 1.84 KB
/
run_single_batch_inference.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
#!/bin/sh
# script for benchmarking single batch inference mkldnn RNN performance
# tesing both single socket and single thread performance
# uncomment the following line to get mkldnn trace log
# export MKLDNN_VERBOSE=2
# to use mkldnn
# run_single_batch_inference.sh --mkldnn
###########################################################
# RNN configs
N=1
T=15
L=2
I=250
H=200
###########################################################
ARGS=""
ARGS="$ARGS --inference"
echo -e "\n### inference mode "
if [[ "$1" == "--mkldnn" ]]; then
ARGS="$ARGS --mkldnn"
echo "### using mkldnn"
shift
fi
CORES=`lscpu | grep Core | awk '{print $4}'`
SOCKETS=`lscpu | grep Socket | awk '{print $2}'`
TOTAL_CORES=`expr $CORES \* $SOCKETS`
LAST_CORE=`expr $CORES - 1`
KMP_SETTING="KMP_AFFINITY=granularity=fine,compact,1,0"
KMP_BLOCKTIME=1
PREFIX="numactl --physcpubind=0-$LAST_CORE --membind=0"
export $KMP_SETTING
export KMP_BLOCKTIME=$KMP_BLOCKTIME
echo -e "\n### using $KMP_SETTING"
echo -e "### using KMP_BLOCKTIME=$KMP_BLOCKTIME"
echo -e "### using $PREFIX\n"
### single socket test
echo -e "\n### using OMP_NUM_THREADS=$CORES"
OMP_NUM_THREADS=$CORES $PREFIX python -u benchmark.py $ARGS --time_step=$T --batch_size=$N --input_size=$I --hidden_size=$H
### single thread test
echo -e "\n### using OMP_NUM_THREADS=1"
OMP_NUM_THREADS=1 $PREFIX python -u benchmark.py $ARGS --time_step=$T --batch_size=$N --input_size=$I --hidden_size=$H
### single thread test
#echo -e "\n### using OMP_NUM_THREADS=1"
#echo -e "### using layer=$T"
#OMP_NUM_THREADS=1 $PREFIX python -u benchmark.py $ARGS --time_step=1 --layers=$T --batch_size=$N --input_size=$I --hidden_size=$H
### single thread test
echo -e "\n### using OMP_NUM_THREADS=1"
echo -e "### using layer=1"
OMP_NUM_THREADS=1 $PREFIX python -u benchmark.py $ARGS --time_step=1 --layers=1 --batch_size=$N --input_size=$I --hidden_size=$H