evaluate_expression.sh 1.9 KB

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