evaluate_expression.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/bash
  2. # StarPU --- Runtime system for heterogeneous multicore architectures.
  3. #
  4. # Copyright (C) 2011 Inria
  5. # Copyright (C) 2012,2017 CNRS
  6. #
  7. # StarPU is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU Lesser General Public License as published by
  9. # the Free Software Foundation; either version 2.1 of the License, or (at
  10. # your option) any later version.
  11. #
  12. # StarPU is distributed in the hope that it will be useful, but
  13. # WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. #
  16. # See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. #
  18. nsamples=3
  19. BENCH_NAME=$1
  20. OPTIONS=$2
  21. filename=$3
  22. print_options=$4
  23. gflops1_avg=0
  24. gflops2_avg=0
  25. t1_avg=0
  26. t2_avg=0
  27. t_total_avg=0
  28. for s in `seq 1 $nsamples`
  29. do
  30. echo "$ROOTDIR/examples/$BENCH_NAME $OPTIONS"
  31. val=`$ROOTDIR/examples/$BENCH_NAME $OPTIONS`
  32. echo "$val"
  33. results=($val)
  34. gflops1_avg=$(echo "$gflops1_avg+${results[0]}"|bc -l)
  35. gflops2_avg=$(echo "$gflops2_avg+${results[1]}"|bc -l)
  36. t1_avg=$(echo "$t1_avg+${results[2]}"|bc -l)
  37. t2_avg=$(echo "$t2_avg+${results[3]}"|bc -l)
  38. t_total_avg=$(echo "$t_total_avg+${results[4]}"|bc -l)
  39. done
  40. gflops1_avg=$(echo "$gflops1_avg / $nsamples"|bc -l)
  41. gflops2_avg=$(echo "$gflops2_avg / $nsamples"|bc -l)
  42. t1_avg=$(echo "$t1_avg / $nsamples"|bc -l)
  43. t2_avg=$(echo "$t2_avg / $nsamples"|bc -l)
  44. t_total_avg=$(echo "$t_total_avg / $nsamples"|bc -l)
  45. echo "$print_options `printf '%2.2f %2.2f %2.2f %2.2f %2.2f' $gflops1_avg $gflops2_avg $t1_avg $t2_avg $t_total_avg`"
  46. echo "$print_options `printf '%2.2f %2.2f %2.2f %2.2f %2.2f' $gflops1_avg $gflops2_avg $t1_avg $t2_avg $t_total_avg`" >> $filename