Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit 6ec49fc

Browse files
committed
Change batch size obtain method
1 parent a6e1161 commit 6ec49fc

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

scripts/run_benchmark.sh

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ function is_supported_topology
6767
function calculate_numnodes
6868
{
6969
if [[ $host_file != "" ]]; then
70-
nodenames=( `cat $host_file | sort | uniq ` )
71-
if [ ${#nodenames[@]} -eq 0 ]; then
72-
echo "Error: empty host file! Exit."
73-
exit 0
70+
host_list=(`cat $host_file | sort | uniq`)
71+
numnodes=${#host_list[@]}
72+
if [ $numnodes -eq 0 ]; then
73+
echo "Error: empty host list. Exit."
74+
exit 1
7475
fi
75-
numnodes=${#nodenames[@]}
7676
fi
7777
echo "Number of nodes: $numnodes"
7878
}
@@ -140,7 +140,6 @@ function obtain_intelcaffe_log
140140
function obtain_average_fwd_bwd_time
141141
{
142142
result_file=$1
143-
144143
if [ ! -f $result_file ]; then
145144
echo "Error: result file $result_file does not exist..."
146145
exit 1
@@ -163,12 +162,22 @@ function obtain_average_fwd_bwd_time
163162

164163
average_time=`echo "$total_time*1000/$iteration_num" | bc`
165164
fi
165+
echo "average time: ${average_time}"
166166
}
167167

168168
function obtain_batch_size
169169
{
170170
log_file=$1
171-
batch_size=`cat $log_file | grep SetMinibatchSize | sed -n "1, 1p" | awk '{print $(NF)}'`
171+
if [ ! -f $log_file ]; then
172+
echo "Error: log file $log_file does not exist..."
173+
exit 1
174+
fi
175+
if [ $numnodes -eq 1 ]; then
176+
batch_size=`cat $log_file | grep shape | sed -n "3, 1p" | awk '{print $(NF-4)}'`
177+
else
178+
batch_size=`cat $log_file | grep SetMinibatchSize | sed -n "1, 1p" | awk '{print $(NF)}'`
179+
fi
180+
echo "batch size: $batch_size"
172181
}
173182

174183
function calculate_images_per_second

0 commit comments

Comments
 (0)