@@ -95,6 +95,13 @@ function detect_cpu
9595
9696function set_numa_node
9797{
98+ numa_bin=" numactl -H"
99+ # check if os has 'libnuma' package ready
100+ check_dependency $numa_bin
101+ if [ $? -ne 0 ]; then
102+ echo " No numactl command support."
103+ return
104+ fi
98105 # detect numa mode: cache and flat mode for KNL
99106 numa_node=($( numactl -H | grep " available" | awk -F ' ' ' {print $2}' ) )
100107 if [ $numa_node -eq 1 ]; then
@@ -191,7 +198,7 @@ function clear_envs
191198function set_mlsl_vars
192199{
193200 if [ " ${num_mlsl_servers} " -eq -1 ]; then
194- if [ " ${numnodes} " -eq 1 ]; then
201+ if [ ${numnodes} -eq 1 ]; then
195202 numservers=0
196203 else
197204 if [ " ${cpu_model} " == " bdw" ] || [ " ${cpu_model} " == " skx" ]; then
@@ -257,11 +264,18 @@ function execute_command
257264 if [ " ${cpu_model} " == " bdw" ] || [ " ${cpu_model} " == " skx" ]; then
258265 exec_command=" $xeonbin_ "
259266 else
260-
261- exec_command=" numactl --preferred=$numanode $xeonbin_ "
267+ numa_bin=" numactl --preferred=$numanode "
268+ # check if os has 'libnuma' package ready
269+ check_dependency $numa_bin
270+ if [ $? -ne 0 ]; then
271+ echo " No numactl command support."
272+ exec_command=" $xeonbin_ "
273+ else
274+ exec_command=" $numa_bin $xeonbin_ "
275+ fi
262276 fi
263277
264- if [ " ${numnodes} " -gt 1 ]; then
278+ if [ ${numnodes} -gt 1 ]; then
265279 # Produce the configuration file for mpiexec.
266280 # Each line of the config file contains a # host, environment, binary name.
267281 cfile_=nodeconfig-${cpu_model} -${numnodes} .txt
@@ -285,7 +299,7 @@ function execute_command
285299 mv $sensor_log_file $result_dir_ /
286300 fi
287301
288- if [ " ${numnodes} " -eq 1 ]; then
302+ if [ ${numnodes} -eq 1 ]; then
289303 time GLOG_minloglevel=0 $exec_command > ${log_file} 2>&1
290304 else
291305 exec_command=" -l -configfile $cfile_ "
@@ -317,7 +331,8 @@ function obtain_average_fwd_bwd_time
317331# used to calculate images / s
318332function obtain_batch_size
319333{
320- batch_size=` cat $model_file | grep shape | sed -n " 3, 1p" | awk ' {print $4}' `
334+ # catch batch size of training
335+ batch_size=` cat $model_file | grep shape | sed -n " 1, 1p" | awk ' {print $4}' `
321336 echo " batch size : $batch_size "
322337}
323338
0 commit comments