sched_gnuplot.sh 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #!/bin/bash
  2. # StarPU --- Runtime system for heterogeneous multicore architectures.
  3. #
  4. # Copyright (C) 2009-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  5. #
  6. # StarPU is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU Lesser General Public License as published by
  8. # the Free Software Foundation; either version 2.1 of the License, or (at
  9. # your option) any later version.
  10. #
  11. # StarPU is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. #
  15. # See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. #
  17. prefix=sched
  18. outputfile=$prefix.data
  19. find timings_sched/* -name "$prefix.*" > filelist
  20. grainlist=`sed -e "s/.*$prefix\.\(.*\)\.\(.*\)$/\1/" filelist |sort -n|uniq|xargs`
  21. sizelist=`sed -e "s/.*$prefix\.\(.*\)\.\(.*\)$/\2/" filelist |sort -n|uniq`
  22. schedlist="0.greedy 0.dm 1.dm 1.dmda"
  23. # Make some header
  24. line="#SIZE "
  25. for sched in $schedlist
  26. do
  27. line="$line $sched"
  28. done
  29. echo "$line" > $outputfile
  30. for size in $sizelist
  31. do
  32. line="$size "
  33. for sched in $schedlist
  34. do
  35. # Compute Average value ...
  36. if test -f timings_sched/$prefix.$sched.$size; then
  37. # file does exists
  38. filename=timings_sched/$prefix.$sched.$size
  39. # how many samples do we have ?
  40. nsample=`cat $filename | wc -w`
  41. if test $nsample -ge 1; then
  42. sum=0
  43. for i in `cat $filename | xargs`
  44. do
  45. sum=$(echo "$sum + $i"|bc -l)
  46. done
  47. # average execution time is ...
  48. mean=$(echo "$sum / $nsample"|bc -l)
  49. # in Flop/s this is 2*size^3/3
  50. gflops=$(echo "2.0 * $size * $size * $size / (3000000 * $mean)"|bc -l)
  51. # just make this a bit prettier ..
  52. gflops=`echo $gflops | sed -e "s/\(.*\.[0-9][0-9]\).*$/\1/"`
  53. line="$line $gflops"
  54. else
  55. # we have no valid sample even if the file exists
  56. line="$line x"
  57. fi
  58. else
  59. # file does not exist
  60. line="$line x"
  61. fi
  62. line="$line "
  63. done
  64. echo "$line" >> $outputfile
  65. done
  66. gnuplotline="plot "
  67. cnt=2
  68. echo "grainlist ... $grainlist"
  69. for sched in $schedlist
  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 datafile missing 'x'
  82. set pointsize 0.75
  83. #set title "Impact of granularity"
  84. set grid y
  85. set grid x
  86. set xrange [0:49152]
  87. #set logscale x
  88. set xtics 8192,8192,65536
  89. set key invert box right bottom title "Scheduling policy"
  90. set size 0.65
  91. set xlabel "Matrix size"
  92. set ylabel "GFlop/s"
  93. plot "$outputfile" usi 1:2 with linespoint title "greedy" lt rgb "black" lw 2,\
  94. "$outputfile" usi 1:3 with linespoint title "heft-tm" lt rgb "black" lw 2,\
  95. "$outputfile" usi 1:4 with linespoint title "heft-tm-pr" lt rgb "black" lw 2,\
  96. "$outputfile" usi 1:5 with linespoint title "heft-tmdp-pr" lt rgb "black" lw 2
  97. EOF