model.sh 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/bash
  2. # StarPU --- Runtime system for heterogeneous multicore architectures.
  3. #
  4. # Copyright (C) 2008, 2009, 2010 Université de Bordeaux 1
  5. # Copyright (C) 2010 Centre National de la Recherche Scientifique
  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. trace_model()
  18. {
  19. inputfile=$1
  20. cpuentries=`head -1 $inputfile`
  21. gpuentries=`head -2 $inputfile|tail -1`
  22. cpumodel=`head -3 $inputfile|tail -1`
  23. gpumodel=`head -4 $inputfile|tail -1`
  24. a_cpu=`cut -f 1 $inputfile| head -5|tail -1`
  25. b_cpu=`cut -f 2 $inputfile| head -5|tail -1`
  26. c_cpu=`cut -f 3 $inputfile| head -5|tail -1`
  27. a_gpu=`cut -f 1 $inputfile| head -6|tail -1`
  28. b_gpu=`cut -f 2 $inputfile| head -6|tail -1`
  29. c_gpu=`cut -f 3 $inputfile| head -6|tail -1`
  30. alpha_cpu=`cut -f 5 $inputfile| head -3|tail -1`
  31. alpha_gpu=`cut -f 5 $inputfile| head -4|tail -1`
  32. beta_cpu=`cut -f 6 $inputfile| head -3|tail -1`
  33. beta_gpu=`cut -f 6 $inputfile| head -4|tail -1`
  34. tail -$(($gpuentries + $cpuentries)) $inputfile | head -$(($cpuentries)) |cut -f 2-4 > $inputfile.cpu
  35. tail -$(($gpuentries)) $inputfile | cut -f 2-4> $inputfile.gpu
  36. echo "pouet $cpuentries gpu $gpuentries toot"
  37. echo "cpumodel $alpha_cpu * size ^ $beta_cpu"
  38. echo "gpumodel $alpha_gpu * size ^ $beta_gpu"
  39. gpfile=$inputfile.gp
  40. echo "#!/usr/bin/gnuplot -persist" > $gpfile
  41. echo "set term postscript eps enhanced color" >> $gpfile
  42. echo "set logscale x" >> $gpfile
  43. echo "set logscale y" >> $gpfile
  44. echo "set key left top" >> $gpfile
  45. echo "set title \"$inputfile\"" >> $gpfile
  46. echo "set output \"$inputfile.eps\"" >> $gpfile
  47. echo "plot $alpha_gpu*x**$beta_gpu title \"GPU regression\" ,\\" >> $gpfile
  48. echo " \"$inputfile.gpu\" with errorbar title \"GPU measured\" ,\\" >> $gpfile
  49. echo " $c_gpu + exp(log($a_gpu) + $b_gpu * log(x) ) title \"GPU regression (non linear)\" ,\\" >> $gpfile
  50. echo " \"$inputfile.cpu\" with errorbar title \"CPU measured\" ,\\" >> $gpfile
  51. echo " $alpha_cpu*x**$beta_cpu title \"CPU regression\" ,\\" >> $gpfile
  52. echo " $c_cpu + exp(log($a_cpu) + $b_cpu * log(x) ) title \"CPU regression (non linear)\"" >> $gpfile
  53. gnuplot $gpfile
  54. }
  55. for file in $@
  56. do
  57. trace_model "$file"
  58. done