bench_sgemm.sh 2.3 KB

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