bench_sgemm.sh 2.3 KB

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