-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasis_runs.sh
94 lines (82 loc) · 2.33 KB
/
asis_runs.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
#!/bin/bash
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
source ~/tf-v1.4.0/bin/activate
vars=(
#nodistortions
num_batches="1100"
num_gpus="1 2 4"
model="resnet50"
batch_size="64"
local_parameter_device="gpu"
variable_update="replicated"
#use_fp16=True
#fp16_loss_scale=1
dataset="imagenet:/path-to-TFR/ImageNet synthetic"
)
#nvprof="/usr/local/cuda/bin/nvprof -o"
if [ "$nvprof" != "" ] ; then
nv_extra="--num_warmup_batches=1 --display_every=1"
fi
iters=3
results_dir="results"
mkdir -p $results_dir
ext=$(date +%d%b%Y_%H%M%S)
base="x86"
cmds="python tf_cnn_benchmarks.py"
for elm in "${vars[@]}" ; do
option=$(echo $elm | cut -d'=' -f 1)
value=$(echo $elm | cut -d'=' -f 2)
if [ "${value}" == "${option}" ] ; then
cmds=$(echo "${cmds}" | sed "s/$/ --"${option}"/g")
else
tmpcmds="${cmds}"
cmds=""
for val in ${value} ; do
val=$(echo $val | sed 's/\//\\\//g')
if [ "$option" == "dataset" ] ; then
for v in $val ; do
if [ "$v" == "synthetic" ] ; then
data_name="synthetic"
cmds="${tmpcmds}\n"
else
data_name=$(echo $v | cut -d':' -f 1)
data_dir=$(echo $v | cut -d':' -f 2)
tcmds=$(echo "${tmpcmds}" | sed "s/$/ --data_name="${data_name}" --data_dir="${data_dir}"/g")
cmds="${cmds}$tcmds\n"
fi
done
else
tcmds=$(echo "${tmpcmds}" | sed "s/$/ --"${option}"="${val}"/g")
cmds="${cmds}$tcmds\n"
fi
done
fi
cmds=$(echo -e "$cmds" )
l=$(echo "$cmds" | wc -l)
cmds=$(echo "$cmds" | head -$l)
done
cmds=$(echo "$cmds" | sed 's/ /:/g')
for cmd in $cmds ; do
cmd=$(echo $cmd | tr ':' ' ')
logfile=$(echo "$cmd" | tr '_' '-' | tr ' ' '_' | sed 's/--//g' | sed 's/python_tf-cnn-benchmarks.py_//g' | tr '=' '-')
if echo $logfile | grep data-dir > /dev/null 2>&1 ; then
logfile=$(echo $logfile | sed 's/_data-dir-[^_$][^_$]*//g')
else
logfile="${logfile}_data-name-synthetic"
fi
iter=0
while [ $iter -lt $iters ] ; do
log="${results_dir}/${base}_${logfile}_${ext}_${iter}"
_cmd=$cmd
if [ "$nvprof" != "" ] ; then
_cmd="${nvprof} ${log}.nvvp ${cmd} ${extra_nv}"
fi
log="${log}.log"
echo "$log"
#echo $_cmd
#echo
echo $_cmd >> ${log} 2>&1
eval $_cmd >> ${log} 2>&1
iter=$(expr $iter + 1)
done
done