error_model.sh 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #!/bin/bash
  2. # StarPU --- Runtime system for heterogeneous multicore architectures.
  3. #
  4. # Copyright (C) 2009-2011,2014, 2019 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. # for bc
  19. scale=8
  20. #nblockslist="2 4 8 16 16 16 16 16 16 16 16 16 16 16 16"
  21. nblockslist="4 8 16 16 16 16 16 16 16 16 16"
  22. niter=5
  23. #nblockslist="4 4"
  24. #niter=2
  25. # Testing another specific scheduler, no need to run this
  26. [ -z "$STARPU_SCHED" -a "$STARPU_SCHED" != dm ] || exit 77
  27. rm -f log
  28. echo "#iter cpu0 (#tasks0) cpu1 (#tasks1) cpu2 (#tasks2) gpu0 (#tasksgpu0) #totaltask gflops" > gnuplot.data
  29. i=0
  30. for nblocks in $nblockslist
  31. do
  32. i=$(($i + 1))
  33. sumcpu[$i]='0'
  34. ntaskcpu[$i]='0'
  35. sumcuda[$i]='0'
  36. ntaskcuda[$i]='0'
  37. cpu_ntasktotal[$i]='0'
  38. gpu_ntasktotal[$i]='0'
  39. sumgflops[$i]='0'
  40. done
  41. for iter in `seq 1 $niter`
  42. do
  43. cpu_taskcnt=0
  44. gpu_taskcnt=0
  45. i=0
  46. rm -f ../../.sampling/*
  47. for nblocks in $nblockslist
  48. do
  49. i=$(($i + 1))
  50. ntheta=$(($((32 * $nblocks)) + 2))
  51. echo "ITER $iter -> I $i NBLOCKS $nblocks"
  52. STARPU_CALIBRATE=1 STARPU_SCHED="dm" ../../examples/heat/heat -nblocks $nblocks -nthick 34 -ntheta $ntheta -pin 2> output.log.err > output.log
  53. gflops=`grep "Synthetic GFlops :" output.log.err| sed -e "s/Synthetic GFlops ://"`
  54. sumgflops[$i]=$(echo "${sumgflops[$i]} + $gflops"|bc -l)
  55. # retrieve ratio for cpu 0, 1 and 2
  56. avgcpu0=`grep "MODEL ERROR: CPU 0" starpu.log | sed -e "s/^.*RATIO \(.*\) NTASKS\(.*\)$/\1/"`
  57. avgcpu1=`grep "MODEL ERROR: CPU 1" starpu.log | sed -e "s/^.*RATIO \(.*\) NTASKS\(.*\)$/\1/"`
  58. avgcpu2=`grep "MODEL ERROR: CPU 2" starpu.log | sed -e "s/^.*RATIO \(.*\) NTASKS\(.*\)$/\1/"`
  59. avgcuda0=`grep "MODEL ERROR: CUDA 0" starpu.log | sed -e "s/^.*RATIO \(.*\) NTASKS\(.*\)$/\1/"`
  60. ntaskcpu0=`grep "MODEL ERROR: CPU 0" starpu.log | sed -e "s/^.*RATIO \(.*\) NTASKS\(.*\)$/\2/"`
  61. ntaskcpu1=`grep "MODEL ERROR: CPU 1" starpu.log | sed -e "s/^.*RATIO \(.*\) NTASKS\(.*\)$/\2/"`
  62. ntaskcpu2=`grep "MODEL ERROR: CPU 2" starpu.log | sed -e "s/^.*RATIO \(.*\) NTASKS\(.*\)$/\2/"`
  63. ntaskcuda0=`grep "MODEL ERROR: CUDA 0" starpu.log | sed -e "s/^.*RATIO \(.*\) NTASKS\(.*\)$/\2/"`
  64. sumcpu[$i]=$(echo "${sumcpu[$i]} + ( $avgcpu0 * $ntaskcpu0 ) + ( $avgcpu1 * $ntaskcpu1 ) + ( $avgcpu2 * $ntaskcpu2 )"| bc -l)
  65. ntaskcpu[$i]=$(echo "${ntaskcpu[$i]} + $ntaskcpu0 + $ntaskcpu1 + $ntaskcpu2"|bc -l)
  66. sumcuda[$i]=$(echo "${sumcuda[$i]} + ( $avgcuda0 * $ntaskcuda0 )"| bc -l)
  67. ntaskcuda[$i]=$(echo "${ntaskcuda[$i]} + $ntaskcuda0"|bc -l)
  68. cpu_taskcnt=$(($cpu_taskcnt + $ntaskcpu0 + $ntaskcpu1 + $ntaskcpu2 ))
  69. gpu_taskcnt=$(($gpu_taskcnt + $ntaskcuda0))
  70. cpu_ntasktotal[$i]=$( echo "$cpu_taskcnt + ${cpu_ntasktotal[$i]}" | bc -l)
  71. gpu_ntasktotal[$i]=$( echo "$gpu_taskcnt + ${gpu_ntasktotal[$i]}" | bc -l)
  72. done
  73. done
  74. i=0
  75. echo "#ntaskscpu #avg. error cpu #ntaskgpu #avg. error gpu #avg. gflops" > gnuplot.data
  76. for nblocks in $nblockslist
  77. do
  78. i=$(($i + 1))
  79. avggflops=$(echo "${sumgflops[$i]}/$niter"|bc -l)
  80. cpu_ntasks=$(echo "${cpu_ntasktotal[$i]}/$niter" | bc -l)
  81. gpu_ntasks=$(echo "${gpu_ntasktotal[$i]}/$niter" | bc -l)
  82. avgcpu=$(echo "${sumcpu[$i]}/${ntaskcpu[$i]}"|bc -l)
  83. avgcuda=$(echo "${sumcuda[$i]}/${ntaskcuda[$i]}"|bc -l)
  84. echo "$cpu_ntasks $avgcpu $gpu_ntasks $avgcuda $avggflops" >> gnuplot.data
  85. done
  86. ./error_model.gp