sched_gnuplot.sh 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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=sched
  19. outputfile=$prefix.data
  20. find timings_sched/* -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. schedlist="0.greedy 0.dm 1.dm 1.dmda"
  24. # Make some header
  25. line="#SIZE "
  26. for sched in $schedlist
  27. do
  28. line="$line $sched"
  29. done
  30. echo "$line" > $outputfile
  31. for size in $sizelist
  32. do
  33. line="$size "
  34. for sched in $schedlist
  35. do
  36. # Compute Average value ...
  37. if test -f timings_sched/$prefix.$sched.$size; then
  38. # file does exists
  39. filename=timings_sched/$prefix.$sched.$size
  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. echo "grainlist ... $grainlist"
  70. for sched in $schedlist
  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 datafile missing 'x'
  83. set pointsize 0.75
  84. #set title "Impact of granularity"
  85. set grid y
  86. set grid x
  87. set xrange [0:49152]
  88. #set logscale x
  89. set xtics 8192,8192,65536
  90. set key invert box right bottom title "Scheduling policy"
  91. set size 0.65
  92. set xlabel "Matrix size"
  93. set ylabel "GFlop/s"
  94. plot "$outputfile" usi 1:2 with linespoint title "greedy" lt rgb "black" lw 2,\
  95. "$outputfile" usi 1:3 with linespoint title "heft-tm" lt rgb "black" lw 2,\
  96. "$outputfile" usi 1:4 with linespoint title "heft-tm-pr" lt rgb "black" lw 2,\
  97. "$outputfile" usi 1:5 with linespoint title "heft-tmdp-pr" lt rgb "black" lw 2
  98. EOF