error-model.sh 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. # 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. sumcore[$i]='0'
  31. ntaskcore[$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. CALIBRATE=1 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 core 0, 1 and 2
  53. avgcore0=`grep "MODEL ERROR: CORE 0" starpu.log | sed -e "s/^.*RATIO \(.*\) NTASKS\(.*\)$/\1/"`
  54. avgcore1=`grep "MODEL ERROR: CORE 1" starpu.log | sed -e "s/^.*RATIO \(.*\) NTASKS\(.*\)$/\1/"`
  55. avgcore2=`grep "MODEL ERROR: CORE 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. ntaskcore0=`grep "MODEL ERROR: CORE 0" starpu.log | sed -e "s/^.*RATIO \(.*\) NTASKS\(.*\)$/\2/"`
  58. ntaskcore1=`grep "MODEL ERROR: CORE 1" starpu.log | sed -e "s/^.*RATIO \(.*\) NTASKS\(.*\)$/\2/"`
  59. ntaskcore2=`grep "MODEL ERROR: CORE 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. sumcore[$i]=$(echo "${sumcore[$i]} + ( $avgcore0 * $ntaskcore0 ) + ( $avgcore1 * $ntaskcore1 ) + ( $avgcore2 * $ntaskcore2 )"| bc -l)
  62. ntaskcore[$i]=$(echo "${ntaskcore[$i]} + $ntaskcore0 + $ntaskcore1 + $ntaskcore2"|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 + $ntaskcore0 + $ntaskcore1 + $ntaskcore2 ))
  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 "${sumcore[$i]}/${ntaskcore[$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