bench_sgemm.sh 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #!/bin/bash
  2. # StarPU --- Runtime system for heterogeneous multicore architectures.
  3. #
  4. # Copyright (C) 2009-2011,2014,2019 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. DIR=$PWD
  19. ROOTDIR=$DIR/../..
  20. BUILDDIR=$PWD/build/
  21. INSTALLDIR=$PWD/local/
  22. PERFDIR=$DIR/sampling/
  23. # Testing another specific scheduler, no need to run this
  24. [ -z "$STARPU_SCHED" -a "$STARPU_SCHED" != dm ] || exit 77
  25. make -C ../../ distclean
  26. mkdir -p $PERFDIR
  27. mkdir -p $BUILDDIR
  28. cd $BUILDDIR
  29. $DIR/../../configure -C --prefix=$INSTALLDIR --with-goto-dir=/home/gonnet/These/Libs/GotoBLAS/GotoBLAS/ --enable-verbose
  30. make -j 10
  31. make install
  32. sizelist="16 32 48 64 96 128 192 256 384 512 1024 2048 4096"
  33. cpu_output=$DIR/output.cpu
  34. gpu_output=$DIR/output.gpu
  35. rm -f $cpu_output
  36. rm -f $gpu_output
  37. export STARPU_WORKERS_CPUID="2"
  38. export STARPU_CALIBRATE=1
  39. export STARPU_SCHED="dm"
  40. # benchmark GotoBLAS
  41. for size in $sizelist;
  42. do
  43. niter=1000
  44. if test $size -ge 512; then
  45. niter=20
  46. fi
  47. if test $size -ge 2048; then
  48. niter=5
  49. fi
  50. echo "GotoBLAS -> size $size niter $niter"
  51. timing=`STARPU_NCPUS=1 STARPU_NCUDA=0 $INSTALLDIR/lib/starpu/examples/dw_mult_no_filters -x $size -y $size -z $size -nblocks 1 -iter $niter 2> /dev/null`
  52. echo "$size $timing $niter" >> $cpu_output
  53. done
  54. # benchmark CUBLAS
  55. for size in $sizelist;
  56. do
  57. niter=2500
  58. if test $size -ge 512; then
  59. niter=250
  60. fi
  61. if test $size -ge 2048; then
  62. niter=25
  63. fi
  64. echo "CUBLAS -> size $size niter $niter"
  65. timing=`STARPU_NCPUS=0 STARPU_NCUDA=1 $INSTALLDIR/lib/starpu/examples/dw_mult_no_filters -x $size -y $size -z $size -nblocks 1 -iter $niter 2 -pin 2> /dev/null`
  66. echo "$size $timing $niter" >> $gpu_output
  67. done
  68. gnuplot > /dev/null << EOF
  69. set term postscript eps enhanced color
  70. set output "bench_sgemm.eps"
  71. set logscale x
  72. set logscale y
  73. plot "$cpu_output" usi 1:(\$2/\$3) with linespoint, \
  74. "$gpu_output" usi 1:(\$2/\$3) with linespoint
  75. EOF