error_model.sh 3.7 KB

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