granularity_gnuplot.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. #!/bin/bash
  2. # StarPU --- Runtime system for heterogeneous multicore architectures.
  3. #
  4. # Copyright (C) 2009-2011,2014 Université de Bordeaux
  5. # Copyright (C) 2010,2015,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. prefix=granularity
  19. prefix=hybrid
  20. outputfile=$prefix.data
  21. find timing/* -name "$prefix.*" > filelist
  22. grainlist=`sed -e "s/.*$prefix\.\(.*\)\.\(.*\)$/\1/" filelist |sort -n|uniq|xargs`
  23. sizelist=`sed -e "s/.*$prefix\.\(.*\)\.\(.*\)$/\2/" filelist |sort -n|uniq`
  24. # Make some header
  25. line="#SIZE "
  26. for grain in $grainlist
  27. do
  28. line="$line $grain"
  29. done
  30. echo "$line" > $outputfile
  31. for size in $sizelist
  32. do
  33. line="$size "
  34. for grain in $grainlist
  35. do
  36. # Compute Average value ...
  37. if test -f timing/$prefix.$grain.$size; then
  38. # file does exists
  39. filename=timing/$prefix.$grain.$size
  40. # echo "GRAIN $grain SIZE $size exists !"
  41. # how many samples do we have ?
  42. nsample=`cat $filename | wc -w`
  43. if test $nsample -ge 1; then
  44. sum=0
  45. for i in `cat $filename | xargs`
  46. do
  47. sum=$(echo "$sum + $i"|bc -l)
  48. done
  49. # average execution time is ...
  50. mean=$(echo "$sum / $nsample"|bc -l)
  51. # in Flop/s this is 2*size^3/3
  52. gflops=$(echo "2.0 * $size * $size * $size / (3000000 * $mean)"|bc -l)
  53. # just make this a bit prettier ..
  54. gflops=`echo $gflops | sed -e "s/\(.*\.[0-9][0-9]\).*$/\1/"`
  55. line="$line $gflops"
  56. else
  57. # we have no valid sample even if the file exists
  58. line="$line x"
  59. fi
  60. else
  61. # file does not exist
  62. line="$line x"
  63. fi
  64. line="$line "
  65. done
  66. echo "$line" >> $outputfile
  67. done
  68. gnuplotline="plot "
  69. cnt=2
  70. for grain in $grainlist
  71. do
  72. if test $cnt -ne 2; then
  73. # i hate gnuplot :)
  74. gnuplotline="$gnuplotline , "
  75. fi
  76. gnuplotline="$gnuplotline \"$outputfile\" usi 1:$cnt with linespoint title \"\($grain x $grain\)\" lt rgb \"black\" "
  77. cnt=$(($cnt+1))
  78. done
  79. gnuplot > /dev/null << EOF
  80. set term postscript eps enhanced color
  81. set output "$prefix.eps"
  82. set pointsize 0.75
  83. #set title "Impact of granularity"
  84. set grid y
  85. set grid x
  86. #set logscale x
  87. set key box right bottom title "tile size"
  88. set size 0.65
  89. set xlabel "Matrix size"
  90. set ylabel "GFlop/s"
  91. $gnuplotline
  92. EOF