From c6a27bbe64f7c88a5a2bc48b54e152f52dc9eec3 Mon Sep 17 00:00:00 2001 From: Werner Saar Date: Sun, 10 Jan 2016 12:19:03 +0100 Subject: [PATCH] added benchmark tests for ssyrk and dsyrk --- benchmark/scripts/SCIPY/dsyrk.py | 58 ++++++++++++++++++++++++++++++++++++++++ benchmark/scripts/SCIPY/ssyrk.py | 58 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100755 benchmark/scripts/SCIPY/dsyrk.py create mode 100755 benchmark/scripts/SCIPY/ssyrk.py diff --git a/benchmark/scripts/SCIPY/dsyrk.py b/benchmark/scripts/SCIPY/dsyrk.py new file mode 100755 index 0000000..1ff481e --- /dev/null +++ b/benchmark/scripts/SCIPY/dsyrk.py @@ -0,0 +1,58 @@ +#!/usr/bin/python + +import os +import sys +import time +import numpy +from numpy.random import randn +from scipy.linalg import blas + +def run_dsyrk(N,l): + + A = randn(N,N).astype('float64') + C = randn(N,N).astype('float64') + + + start = time.time(); + for i in range(0,l): + C = blas.dsyrk(1.0,A) + end = time.time() + + timediff = (end -start) + mflops = ( N*N*N) *l / timediff + mflops *= 1e-6 + + size = "%dx%d" % (N,N) + print("%14s :\t%20f MFlops\t%20f sec" % (size,mflops,timediff)) + + +if __name__ == "__main__": + N=128 + NMAX=2048 + NINC=128 + LOOPS=1 + + z=0 + for arg in sys.argv: + if z == 1: + N = int(arg) + elif z == 2: + NMAX = int(arg) + elif z == 3: + NINC = int(arg) + elif z == 4: + LOOPS = int(arg) + + z = z + 1 + + if 'OPENBLAS_LOOPS' in os.environ: + p = os.environ['OPENBLAS_LOOPS'] + if p: + LOOPS = int(p); + + print("From: %d To: %d Step=%d Loops=%d" % (N, NMAX, NINC, LOOPS)) + print("\tSIZE\t\t\tFlops\t\t\t\t\tTime") + + for i in range (N,NMAX+NINC,NINC): + run_dsyrk(i,LOOPS) + diff --git a/benchmark/scripts/SCIPY/ssyrk.py b/benchmark/scripts/SCIPY/ssyrk.py new file mode 100755 index 0000000..1dee9e2 --- /dev/null +++ b/benchmark/scripts/SCIPY/ssyrk.py @@ -0,0 +1,58 @@ +#!/usr/bin/python + +import os +import sys +import time +import numpy +from numpy.random import randn +from scipy.linalg import blas + +def run_ssyrk(N,l): + + A = randn(N,N).astype('float32') + C = randn(N,N).astype('float32') + + + start = time.time(); + for i in range(0,l): + C = blas.ssyrk(1.0,A) + end = time.time() + + timediff = (end -start) + mflops = ( N*N*N) *l / timediff + mflops *= 1e-6 + + size = "%dx%d" % (N,N) + print("%14s :\t%20f MFlops\t%20f sec" % (size,mflops,timediff)) + + +if __name__ == "__main__": + N=128 + NMAX=2048 + NINC=128 + LOOPS=1 + + z=0 + for arg in sys.argv: + if z == 1: + N = int(arg) + elif z == 2: + NMAX = int(arg) + elif z == 3: + NINC = int(arg) + elif z == 4: + LOOPS = int(arg) + + z = z + 1 + + if 'OPENBLAS_LOOPS' in os.environ: + p = os.environ['OPENBLAS_LOOPS'] + if p: + LOOPS = int(p); + + print("From: %d To: %d Step=%d Loops=%d" % (N, NMAX, NINC, LOOPS)) + print("\tSIZE\t\t\tFlops\t\t\t\t\tTime") + + for i in range (N,NMAX+NINC,NINC): + run_ssyrk(i,LOOPS) + -- 2.7.4