sched_gnuplot.sh 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #!/bin/bash
  2. prefix=sched
  3. outputfile=$prefix.data
  4. find timings-sched/* -name "$prefix.*" > filelist
  5. grainlist=`sed -e "s/.*$prefix\.\(.*\)\.\(.*\)$/\1/" filelist |sort -n|uniq|xargs`
  6. sizelist=`sed -e "s/.*$prefix\.\(.*\)\.\(.*\)$/\2/" filelist |sort -n|uniq`
  7. schedlist="0.greedy 0.dm 1.dm 1.dmda"
  8. # Make some header
  9. line="#SIZE "
  10. for sched in $schedlist
  11. do
  12. line="$line $sched"
  13. done
  14. echo "$line" > $outputfile
  15. for size in $sizelist
  16. do
  17. line="$size "
  18. for sched in $schedlist
  19. do
  20. # Compute Average value ...
  21. if test -f timings-sched/$prefix.$sched.$size; then
  22. # file does exists
  23. filename=timings-sched/$prefix.$sched.$size
  24. # how many samples do we have ?
  25. nsample=`cat $filename | wc -w`
  26. if test $nsample -ge 1; then
  27. sum=0
  28. for i in `cat $filename | xargs`
  29. do
  30. sum=$(echo "$sum + $i"|bc -l)
  31. done
  32. # average execution time is ...
  33. mean=$(echo "$sum / $nsample"|bc -l)
  34. # in Flop/s this is 2*size^3/3
  35. gflops=$(echo "2.0 * $size * $size * $size / (3000000 * $mean)"|bc -l)
  36. # just make this a bit prettier ..
  37. gflops=`echo $gflops | sed -e "s/\(.*\.[0-9][0-9]\).*$/\1/"`
  38. line="$line $gflops"
  39. else
  40. # we have no valid sample even if the file exists
  41. line="$line x"
  42. fi
  43. else
  44. # file does not exist
  45. line="$line x"
  46. fi
  47. line="$line "
  48. done
  49. echo "$line" >> $outputfile
  50. done
  51. gnuplotline="plot "
  52. cnt=2
  53. echo "grainlist ... $grainlist"
  54. for sched in $schedlist
  55. do
  56. if test $cnt -ne 2; then
  57. # i hate gnuplot :)
  58. gnuplotline="$gnuplotline , "
  59. fi
  60. gnuplotline="$gnuplotline \"$outputfile\" usi 1:$cnt with linespoint title \"\($grain x $grain\)\" lt rgb \"black\" "
  61. cnt=$(($cnt+1))
  62. done
  63. gnuplot > /dev/null << EOF
  64. set term postscript eps enhanced color
  65. set output "$prefix.eps"
  66. set datafile missing 'x'
  67. set pointsize 0.75
  68. #set title "Impact of granularity"
  69. set grid y
  70. set grid x
  71. set xrange [0:49152]
  72. #set logscale x
  73. set xtics 8192,8192,65536
  74. set key invert box right bottom title "Scheduling policy"
  75. set size 0.65
  76. set xlabel "Matrix size"
  77. set ylabel "GFlop/s"
  78. plot "$outputfile" usi 1:2 with linespoint title "greedy" lt rgb "black" lw 2,\
  79. "$outputfile" usi 1:3 with linespoint title "heft-tm" lt rgb "black" lw 2,\
  80. "$outputfile" usi 1:4 with linespoint title "heft-tm-pr" lt rgb "black" lw 2,\
  81. "$outputfile" usi 1:5 with linespoint title "heft-tmdp-pr" lt rgb "black" lw 2
  82. EOF