granularity_gnuplot.sh 2.6 KB

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