comp.sh 2.4 KB

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