bench_sgemm.sh 2.4 KB

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