perf.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #!/bin/bash
  2. # StarPU --- Runtime system for heterogeneous multicore architectures.
  3. #
  4. # Copyright (C) 2010,2011,2014 Université de Bordeaux
  5. # Copyright (C) 2010,2015,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. # 4G x np = 4 * (k*1K) ^ 2
  19. # A G * np = 4 * k^2 * 1M
  20. # A * 250 * np = k^2
  21. # A = 6
  22. # k = sqrt(1500*np)
  23. # np = 1 => k = 32
  24. # np = 2 => k = 48
  25. # np = 3 => k = 64
  26. # np = 4 => k = 64
  27. # Problem size
  28. NBLOCKS=16
  29. BLOCKSIZE=1024
  30. SIZE=$(($NBLOCKS*$BLOCKSIZE))
  31. echo "JOB ID ${PBS_JOBID}"
  32. nnodes=$(cat machinefile.${PBS_JOBID}|wc -l)
  33. echo "got $nnodes mpi nodes"
  34. # Calibrate
  35. ncalibrate=0
  36. for i in `seq 1 $ncalibrate`
  37. do
  38. echo "STARPU_CALIBRATE $i/$ncalibrate"
  39. STARPU_CALIBRATE=1 STARPU_SCHED="dmda" STARPU_PREFETCH=1 mpirun -machinefile machinefile.${PBS_JOBID} -np $nnodes ./mpi_lu/plu_example_float -p 2 -q 2 -nblocks 32 -size $((32*$BLOCKSIZE)) -numa
  40. done
  41. func()
  42. {
  43. ngpus=$1
  44. np=$2
  45. p=$3
  46. q=$4
  47. nblocks=$5
  48. echo "*******************************************"> log
  49. echo "*************** NGPUS $ngpus - np $np - nblocks $nblocks **************">> log
  50. echo "*******************************************">> log
  51. cat log
  52. cat log >> log.all
  53. STARPU_NCPUS=0 STARPU_NCUDA=$ngpus STARPU_SCHED="dmda" STARPU_PREFETCH=1 mpirun -machinefile machinefile.${PBS_JOBID} -np $np ./mpi_lu/plu_example_float -p $p -q $q -nblocks $nblocks -size $(($nblocks * $BLOCKSIZE)) -numa > log.out 2> log.err
  54. cat log.out > log
  55. cat log.err >> log
  56. cat log
  57. cat log >> log.all
  58. }
  59. rm -f log.all
  60. #how many time do we repeat each experiment ?
  61. nloops=3
  62. per_node_max_memory=7000
  63. for np in 1 2 4
  64. do
  65. for nblocks in 16 32 48 64 80
  66. do
  67. for ngpus_per_node in 1 2 3 4
  68. do
  69. for loop in `seq 1 $nloops`
  70. do
  71. # Compute p and q from np
  72. case $np in
  73. 1) p=1; q=1;;
  74. 2) p=2; q=1;;
  75. 4) p=2; q=2;;
  76. *) echo -n "does not support $np nodes yet";;
  77. esac
  78. # Does the problem fit into memory ?
  79. matrix_size=$(($nblocks * $BLOCKSIZE))
  80. per_node_memory=$(($((4*$matrix_size*$matrix_size/(1024*1024))) / $np))
  81. echo "NP $np P $p Q $q SIZE $per_node_memory NBLOCKS $nblocks"
  82. if test $per_node_memory -ge $per_node_max_memory; then
  83. echo "Problem is too large !"
  84. else
  85. func $ngpus_per_node $np $p $q $nblocks
  86. echo "go !"
  87. fi
  88. done
  89. done
  90. done
  91. done