comp.sh 2.3 KB

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