evaluate_expression.sh 1.7 KB

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