forked from Tianxiaomo/pytorch-YOLOv4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_accuracy.sh
64 lines (54 loc) · 1.63 KB
/
run_accuracy.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
export DNNL_PRIMITIVE_CACHE_CAPACITY=1024
while getopts 'L:p:d:m:e:i:' OPTION
do
case $OPTION in
L)logdir=$OPTARG
;;
p)precision=$OPTARG
;;
d)dataset=$OPTARG
;;
m)mode=$OPTARG
;;
i)ipex=$OPTARG
;;
e)env=$OPTARG
;;
esac
done
ARGS=""
log_name=$logdir
if [ "$precision" == "bf16" ]; then
ARGS="$ARGS --bf16"
fi
if [ "$mode" == "jit" ]; then
ARGS="$ARGS --jit"
fi
if [ "$ipex" == "cpu" ]; then
ARGS="$ARGS --ipex"
elif [ "$ipex" == "xpu" ]; then
ARGS="$ARGS --ipex --xpu"
elif [ "$ipex" == "none" ]; then
if [ "$env" == "stock-pytorch-ipex" ]; then
env="stock-pytorch"
elif [ "$env" == "latest-stock-pytorch-ipex" ]; then
env="latest-stock-pytorch"
fi
fi
echo "args: $ARGS"
log_name="${logdir}/accuracy_${precision}_${env}_${mode}.log"
if [ ! -d predictions/${precision}_${env}_${mode}/ ]; then
mkdir -p predictions/${precision}_${env}_${mode}/
fi
CORES=`lscpu | grep Core | awk '{print $4}'`
TOTAL_CORES=$CORES
KMP_SETTING="KMP_AFFINITY=granularity=fine,compact,1,0"
BATCH_SIZE=128
export OMP_NUM_THREADS=$TOTAL_CORES
export $KMP_SETTING
echo -e "### using $KMP_SETTING\n\n"
sleep 3
start_core=0
end_core=`expr $CORES - 1`
numactl --physcpubind=$start_core-$end_core --membind=0 python -u main.py --evaluate $ARGS -dir $dataset -b $BATCH_SIZE --max_iter -1 2>&1 | tee ${log_name}
# numactl --physcpubind=$start_core-$end_core --membind=0 python -u main.py --evaluate $ARGS -dir $dataset -b $BATCH_SIZE --max_iter 10 --draw --draw_dir predictions/${precision}_${env}_${mode}/ 2>&1 | tee ${log_name}