error_model.sh 3.6 KB

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