bandwidth_scheds.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #!/bin/bash
  2. # StarPU --- Runtime system for heterogeneous multicore architectures.
  3. #
  4. # Copyright (C) 2016-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. set -e
  18. DIR=$(dirname $0)
  19. if [ -n "$STARPU_SCHED" ]
  20. then
  21. SCHEDS=$STARPU_SCHED
  22. DEFAULT=$STARPU_SCHED
  23. else
  24. SCHEDS=`$DIR/../../tools/starpu_sched_display`
  25. DEFAULT=eager
  26. fi
  27. if [ -n "$STARPU_BENCH_DIR" ]; then
  28. cat > bandwidth.gp << EOF
  29. set term svg font ",12" size 1500,500 linewidth 0.5
  30. set output "bandwidth.svg"
  31. set pointsize 0.3
  32. EOF
  33. else
  34. fast="-n 3 -c 4"
  35. cat > bandwidth.gp << EOF
  36. set term postscript eps enhanced color font ",18"
  37. set output "bandwidth.eps"
  38. set size 2,1
  39. EOF
  40. fi
  41. cat >> bandwidth.gp << EOF
  42. set key outside
  43. set ylabel "GB/s"
  44. set xlabel "ncores"
  45. plot \\
  46. "bandwidth-$DEFAULT.dat" using 1:5 with lines title "alone interleave", \\
  47. "bandwidth-$DEFAULT.dat" using 1:6 with lines title "nop", \\
  48. "bandwidth-$DEFAULT.dat" using 1:7 with lines title "sync", \\
  49. "bandwidth-$DEFAULT.dat" using 1:2 with lines title "alone contiguous", \\
  50. EOF
  51. run()
  52. {
  53. sched=$1
  54. type=$2
  55. if [ "$sched" != eager -a "$sched" != "$SCHEDS" ]; then
  56. extra=-a
  57. else
  58. extra=
  59. fi
  60. STARPU_BACKOFF_MIN=0 STARPU_BACKOFF_MAX=0 STARPU_SCHED=$sched $STARPU_LAUNCH $DIR/bandwidth $fast $extra "$@" | tee bandwidth-$sched.dat
  61. echo "\"bandwidth-$sched.dat\" using 1:3 with linespoints lt $type pt $type title \"$sched\", \\" >> bandwidth.gp
  62. echo "\"bandwidth-$sched.dat\" using 1:8 with linespoints lt $type pt $type notitle, \\" >> bandwidth.gp
  63. }
  64. case "$MAKEFLAGS" in
  65. *\ -j1[0-9]*\ *|*\ -j[2-9]*\ *)
  66. type=1
  67. for sched in $SCHEDS
  68. do
  69. run $sched $type &
  70. type=$((type+1))
  71. done
  72. while true
  73. do
  74. set +e
  75. wait -n
  76. RET=$?
  77. set -e
  78. if [ $RET = 127 ] ; then break ; fi
  79. if [ $RET != 0 ] ; then exit $RET ; fi
  80. done
  81. ;;
  82. *)
  83. type=1
  84. for sched in $SCHEDS
  85. do
  86. run $sched $type
  87. type=$((type+1))
  88. done
  89. ;;
  90. esac
  91. if gnuplot bandwidth.gp ; then
  92. if [ -n "$STARPU_BENCH_DIR" ]; then
  93. cp bandwidth.svg $STARPU_BENCH_DIR/
  94. fi
  95. fi