sched.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. DIR=$PWD
  17. ROOTDIR=$DIR/../..
  18. TIMINGDIR=$DIR/timings-sched/
  19. mkdir -p $TIMINGDIR
  20. BENCH_NAME=cholesky_2ctxs
  21. nsamples=3
  22. filename=$TIMINGDIR/$BENCH_NAME_$1
  23. gpu=$2
  24. gpu1=$3
  25. gpu2=$4
  26. nmaxcpus=$STARPU_NCPUS
  27. echo $nmaxcpus
  28. nmincpus1=1
  29. nmincpus2=1
  30. if [ $gpu1 -gt 0 ]
  31. then
  32. nmincpus1=0
  33. fi
  34. if [ $gpu2 -gt 0 ]
  35. then
  36. nmincpus2=0
  37. fi
  38. blocks1=40
  39. blocks2=40
  40. size1=20000
  41. size2=10000
  42. #size1=$(($blocks1*1024))
  43. #size2=$(($blocks2*1024))
  44. for j in `seq $nmincpus1 1 $(($nmaxcpus-1))`
  45. do
  46. if [ $j -gt $(($nmaxcpus-$nmincpus2)) ]
  47. then
  48. break
  49. fi
  50. ncpus1=$j
  51. ncpus2=$(($nmaxcpus-$j))
  52. OPTIONS="-pin -nblocks $blocks1 -size $size1 -nblocks $blocks2 -size $size2 -gpu $gpu -gpu1 $gpu1 -gpu2 $gpu2 -cpu1 $ncpus1 -cpu2 $ncpus2"
  53. gflops1_avg=0
  54. gflops2_avg=0
  55. t1_avg=0
  56. t2_avg=0
  57. t_total_avg=0
  58. exec_nsamples=$nsamples
  59. for s in `seq 1 $nsamples`
  60. do
  61. echo "$ROOTDIR/examples/$BENCH_NAME/$BENCH_NAME $OPTIONS"
  62. val=`$ROOTDIR/examples/$BENCH_NAME/$BENCH_NAME $OPTIONS`
  63. echo "$val"
  64. val=`echo $val|tr " " "\n"`
  65. i=0
  66. for x in $val
  67. do
  68. if [ $i -eq 0 ]
  69. then
  70. gflops1_avg=$(echo "$gflops1_avg + $x"|bc -l)
  71. fi
  72. if [ $i -eq 1 ]
  73. then
  74. gflops2_avg=$(echo "$gflops2_avg+$x"|bc -l)
  75. fi
  76. if [ $i -eq 2 ]
  77. then
  78. t1_avg=$(echo "$t1_avg+$x"|bc -l)
  79. fi
  80. if [ $i -eq 3 ]
  81. then
  82. t2_avg=$(echo "$t2_avg+$x"|bc -l)
  83. fi
  84. if [ $i -eq 4 ]
  85. then
  86. t_total_avg=$(echo "$t_total_avg+$x"|bc -l)
  87. fi
  88. i=$(($i+1))
  89. done
  90. if [ "$val" == "" ]
  91. then
  92. echo "no val"
  93. exec_nsamples=$(($exec_nsamples-1))
  94. fi
  95. done
  96. gflops1_avg=$(echo "$gflops1_avg / $exec_nsamples"|bc -l)
  97. gflops2_avg=$(echo "$gflops2_avg / $exec_nsamples"|bc -l)
  98. t1_avg=$(echo "$t1_avg / $exec_nsamples"|bc -l)
  99. t2_avg=$(echo "$t2_avg / $exec_nsamples"|bc -l)
  100. t_total_avg=$(echo "$t_total_avg / $exec_nsamples"|bc -l)
  101. echo "$exec_nsamples"
  102. echo "$gpu $gpu1 $gpu2 $ncpus1 $ncpus2 `printf '%2.2f %2.2f %2.2f %2.2f %2.2f' $gflops1_avg $gflops2_avg $t1_avg $t2_avg $t_total_avg`"
  103. echo "$gpu $gpu1 $gpu2 $ncpus1 $ncpus2 `printf '%2.2f %2.2f %2.2f %2.2f %2.2f' $gflops1_avg $gflops2_avg $t1_avg $t2_avg $t_total_avg`" >> $filename
  104. done