forked from tlc-pack/TLCBench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
benchmark_autoscheduler.sh
58 lines (51 loc) · 2.3 KB
/
benchmark_autoscheduler.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
#!/bin/bash -x
record_root="tuning_records/2021-09-30"
target='llvm -mcpu=cascadelake -model=platinum-8280'
dtype='float32'
network_list=('ResNet50_v1b' 'resnet_50')
cores_list=('28' '28' '4') # multi-instances should be the last one
batch_list=('1' '128' '1')
repeat=400
physical_cores=28
network='resnet_50'
for i in $(seq 1 ${#cores_list[@]}); do
num_cores=${cores_list[$i-1]}
batch_size=${batch_list[$i-1]}
export OMP_NUM_THREADS=${num_cores}
export KMP_AFFINITY=granularity=fine,noduplicates,compact,1,0
num_groups=$[${physical_cores}/${num_cores}]
for j in $(seq 0 $[${num_groups}-1]); do
start_core=$[${j}*${num_cores}]
end_core=$[$[${j}+1]*${num_cores}-1]
record_dir="${record_root}/${network}_${num_cores}cores_bs${batch_size}/"
benchmark_log="${record_root}/benchmark_autoscheduler_${network}_${num_cores}cores_bs${batch_size}_cores${start_core}-${end_core}.log"
printf "=%.0s" {1..100}; echo
echo "benchmarking autoscheduler using ${network} with ${num_cores} cores and batchsize=${batch_size} on cores: ${start_core}-${end_core}"
echo "using tuning records at ${record_dir}"
echo "saving logs to ${benchmark_log}"; echo
if [ ${num_groups} == 1 ]
then
numactl --physcpubind=${start_core}-${end_core} --membind=0 \
python benchmark_autoscheduler.py \
--network=${network} \
--batch-size=${batch_size} \
--target="${target}" \
--dtype=${dtype} \
--logdir=${record_dir} \
--repeat=${repeat} \
> ${benchmark_log} 2>&1
echo "done benchmarking autoscheduler using ${network} with ${num_cores} cores and batchsize=${batch_size} on cores: ${start_core}-${end_core}"
else
numactl --physcpubind=${start_core}-${end_core} --membind=0 \
python benchmark_autoscheduler.py \
--network=${network} \
--batch-size=${batch_size} \
--target="${target}" \
--dtype=${dtype} \
--logdir=${record_dir} \
--repeat=${repeat} \
> ${benchmark_log} 2>&1 &
fi
done
done
echo "benchmarking sessions lanched, please wait for the python runs."