Skip to content

Commit 8ed8a93

Browse files
authored
Merge pull request #6222 from tensor-tang/bc
use awk command to replace bc
2 parents d5e3279 + 7b827d9 commit 8ed8a93

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

benchmark/paddle/image/run_mkldnn_infer.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function clock_to_seconds() {
44
hours=`echo $1 | awk -F ':' '{print $1}'`
55
mins=`echo $1 | awk -F ':' '{print $2}'`
66
secs=`echo $1 | awk -F ':' '{print $3}'`
7-
echo `bc -l <<< "$secs + $mins * 60 + $hours * 3600"`
7+
echo `awk 'BEGIN{printf "%.2f",('$secs' + '$mins' * 60 + '$hours' * 3600)}'`
88
}
99

1010
function infer() {
@@ -58,9 +58,9 @@ function infer() {
5858
end=`tail ${log} -n 2 | head -n 1 | awk -F ' ' '{print $2}' | xargs`
5959
start_sec=`clock_to_seconds $start`
6060
end_sec=`clock_to_seconds $end`
61-
fps=`bc <<< "scale = 2; 1280 / ($end_sec - $start_sec)"`
61+
fps=`awk 'BEGIN{printf "%.2f",(1280 / ('$end_sec' - '$start_sec'))}'`
6262
echo "Last 1280 samples start: ${start}(${start_sec} sec), end: ${end}(${end_sec} sec;" >> ${log}
63-
echo "FPS: $fps images/sec" >> ${log}
63+
echo "FPS: $fps images/sec" 2>&1 | tee -a ${log}
6464
}
6565

6666
if [ ! -f "train.list" ]; then

0 commit comments

Comments
 (0)