error_model.sh 3.6 KB

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