comp.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #!/bin/bash
  2. # StarPU --- Runtime system for heterogeneous multicore architectures.
  3. #
  4. # Copyright (C) 2011 Inria
  5. # Copyright (C) 2012,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. infilename=$1
  19. outfilename=$2
  20. withctx=$3
  21. compute_effic=$4
  22. ninstr=$5
  23. best_gflops_withoutctxs=$6
  24. rm -rf $outfilename
  25. while read line
  26. do
  27. results=($line)
  28. gflops1=0
  29. gflops2=0
  30. t1=0
  31. t2=0
  32. if [ $withctx -eq 1 ]
  33. then
  34. gpu=${results[0]}
  35. gpu1=${results[1]}
  36. gpu2=${results[2]}
  37. ncpus1=${results[3]}
  38. ncpus2=${results[4]}
  39. gflops1=${results[5]}
  40. gflops2=${results[6]}
  41. t1=${results[7]}
  42. t2=${results[8]}
  43. maxtime=$(echo "$t1/$t2"|bc -l)
  44. maxtime=${maxtime/.*}
  45. if [ "$maxtime" == "" ]
  46. then
  47. maxtime=$t2
  48. else
  49. maxtime=$t1
  50. fi
  51. gflops=$(echo "$ninstr/$maxtime"|bc -l)
  52. if [ $compute_effic -eq 1 ]
  53. then
  54. gflops_norm=$(echo "$gflops/$best_gflops_withoutctxs"|bc -l)
  55. echo "$gpu $gpu1 $gpu2 $ncpus1 $ncpus2 `printf '%2.2f %2.2f' $gflops $gflops_norm`" >> $outfilename$gpu1$gpu2
  56. else
  57. nres=$(echo "$gpu+$gpu1+$gpu2+$ncpus1+$ncpus2"|bc -l)
  58. best_gflops_rate=$(echo "$best_gflops_withoutctxs/$nres"|bc -l)
  59. gflop_rate=$(echo "$gflops/$nres"|bc -l)
  60. gflop_norm_rate=$(echo "$gflop_rate/$best_gflops_rate"|bc -l)
  61. echo "$ncpus1 $ncpus2 `printf '%2.2f %2.2f %2.2f' $gflops $gflop_rate $gflop_norm_rate`" >> $outfilename
  62. fi
  63. else
  64. nres=${results[0]}
  65. gflops1=${results[1]}
  66. gflops2=${results[2]}
  67. t1=${results[3]}
  68. t2=${results[4]}
  69. maxtime=$(echo "$t1/$t2"|bc -l)
  70. maxtime=${maxtime/.*}
  71. if [ "$maxtime" == "" ]
  72. then
  73. maxtime=$t2
  74. else
  75. maxtime=$t1
  76. fi
  77. gflops=$(echo "$ninstr/$maxtime"|bc -l)
  78. if [ $compute_effic -eq 1 ]
  79. then
  80. echo "$nres `printf '%2.2f' $gflops`" >> $outfilename
  81. else
  82. gflop_rate=$(echo "$gflops/$nres"|bc -l)
  83. echo "$nres `printf '%2.2f %2.2f' $gflops $gflop_rate`" >> $outfilename
  84. fi
  85. fi
  86. done < $infilename