granularity.sh 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #!/bin/bash
  2. #
  3. # StarPU
  4. # Copyright (C) INRIA 2008-2009 (see AUTHORS file)
  5. #
  6. # This program 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. # This program 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. maxiter=1
  18. MAXCPU=3
  19. MINSIZE=$((17*1024))
  20. MAXSIZE=$((29*1024))
  21. trace_granularity()
  22. {
  23. grain=$1
  24. #minblocks=1
  25. minblocks=$(($MINSIZE/$grain))
  26. #maxblocks=2
  27. maxblocks=$(($MAXSIZE/$grain))
  28. #step=2
  29. step=2
  30. for blocks in `seq $minblocks $step $maxblocks`
  31. do
  32. size=$(($blocks*$grain))
  33. ntheta=$(( $(($size/32)) + 2))
  34. echo "size : $size (grain $grain nblocks $blocks)"
  35. OPTIONS="-pin -nblocks $blocks -ntheta $ntheta -nthick 34 -v2"
  36. filename=$TIMINGDIR/granularity.$grain.$size
  37. #rm -f $filename
  38. for iter in `seq 1 $maxiter`
  39. do
  40. echo "$iter / $maxiter"
  41. val=`SCHED="dm" $ROOTDIR/examples/heat/heat $OPTIONS 2> /dev/null`
  42. echo "$val" >> $filename
  43. done
  44. done
  45. }
  46. trace_granularity_nomodel()
  47. {
  48. grain=$1
  49. #minblocks=1
  50. minblocks=$(($MINSIZE/$grain))
  51. #maxblocks=2
  52. maxblocks=$(($MAXSIZE/$grain))
  53. step=2
  54. for blocks in `seq $minblocks $step $maxblocks`
  55. do
  56. size=$(($blocks*$grain))
  57. ntheta=$(( $(($size/32)) + 2))
  58. echo "size : $size (grain $grain nblocks $blocks)"
  59. OPTIONS="-pin -nblocks $blocks -ntheta $ntheta -nthick 34 -v2"
  60. filename=$TIMINGDIR/granularity.nomodel.$grain.$size
  61. #rm -f $filename
  62. for iter in `seq 1 $maxiter`
  63. do
  64. echo "$iter / $maxiter"
  65. val=`SCHED="greedy" $ROOTDIR/examples/heat/heat $OPTIONS 2> /dev/null`
  66. echo "$val" >> $filename
  67. done
  68. done
  69. }
  70. calibrate_grain()
  71. {
  72. grain=$1;
  73. # calibrate with 12k problems
  74. blocks=$((12288/$grain))
  75. ntheta=$((384+2))
  76. # #in case this is *really* a small granularity, only 4K
  77. # blocks=$((4096/$grain))
  78. # ntheta=$((128+2))
  79. #
  80. # blocks=$((2048/$grain))
  81. # ntheta=$((64+2))
  82. #
  83. # blocks=8
  84. # ntheta=$((2+$(($size/32))))
  85. size=$(($blocks*$grain))
  86. echo "Calibrating grain $grain size $size ($blocks blocks)"
  87. for iter in `seq 1 4`
  88. do
  89. OPTIONS="-pin -nblocks $blocks -ntheta $ntheta -nthick 34 -v2"
  90. val=`CALIBRATE=1 SCHED="dm" $ROOTDIR/examples/heat/heat $OPTIONS `
  91. done
  92. }
  93. DIR=$PWD
  94. ROOTDIR=$DIR/../..
  95. SAMPLINGDIR=$DIR/sampling/
  96. TIMINGDIR=$DIR/timing/
  97. mkdir -p $TIMINGDIR
  98. mkdir -p $SAMPLINGDIR
  99. #rm -f $SAMPLINGDIR/*
  100. #grainlist="64 128 256 512 768 1024 1536 2048"
  101. grainlist="1024 512 256"
  102. #grainlist="1280"
  103. export PERF_MODEL_DIR=$SAMPLINGDIR
  104. cd $ROOTDIR
  105. make clean 1> /dev/null 2> /dev/null
  106. make examples -j ATLAS=1 CPUS=$MAXCPU CUDA=1 1> /dev/null 2> /dev/null
  107. cd $DIR
  108. # calibrate (sampling)
  109. #for grain in $grainlist
  110. #do
  111. # calibrate_grain $grain;
  112. #done
  113. # perform the actual benchmarking now
  114. for grain in $grainlist
  115. do
  116. trace_granularity $grain;
  117. # trace_granularity_nomodel $grain;
  118. done