Skip to content

Commit c6a27bb

Browse files
committed
added benchmark tests for ssyrk and dsyrk
1 parent f16b4f1 commit c6a27bb

File tree

2 files changed

+116
-0
lines changed

2 files changed

+116
-0
lines changed

benchmark/scripts/SCIPY/dsyrk.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/python
2+
3+
import os
4+
import sys
5+
import time
6+
import numpy
7+
from numpy.random import randn
8+
from scipy.linalg import blas
9+
10+
def run_dsyrk(N,l):
11+
12+
A = randn(N,N).astype('float64')
13+
C = randn(N,N).astype('float64')
14+
15+
16+
start = time.time();
17+
for i in range(0,l):
18+
C = blas.dsyrk(1.0,A)
19+
end = time.time()
20+
21+
timediff = (end -start)
22+
mflops = ( N*N*N) *l / timediff
23+
mflops *= 1e-6
24+
25+
size = "%dx%d" % (N,N)
26+
print("%14s :\t%20f MFlops\t%20f sec" % (size,mflops,timediff))
27+
28+
29+
if __name__ == "__main__":
30+
N=128
31+
NMAX=2048
32+
NINC=128
33+
LOOPS=1
34+
35+
z=0
36+
for arg in sys.argv:
37+
if z == 1:
38+
N = int(arg)
39+
elif z == 2:
40+
NMAX = int(arg)
41+
elif z == 3:
42+
NINC = int(arg)
43+
elif z == 4:
44+
LOOPS = int(arg)
45+
46+
z = z + 1
47+
48+
if 'OPENBLAS_LOOPS' in os.environ:
49+
p = os.environ['OPENBLAS_LOOPS']
50+
if p:
51+
LOOPS = int(p);
52+
53+
print("From: %d To: %d Step=%d Loops=%d" % (N, NMAX, NINC, LOOPS))
54+
print("\tSIZE\t\t\tFlops\t\t\t\t\tTime")
55+
56+
for i in range (N,NMAX+NINC,NINC):
57+
run_dsyrk(i,LOOPS)
58+

benchmark/scripts/SCIPY/ssyrk.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/python
2+
3+
import os
4+
import sys
5+
import time
6+
import numpy
7+
from numpy.random import randn
8+
from scipy.linalg import blas
9+
10+
def run_ssyrk(N,l):
11+
12+
A = randn(N,N).astype('float32')
13+
C = randn(N,N).astype('float32')
14+
15+
16+
start = time.time();
17+
for i in range(0,l):
18+
C = blas.ssyrk(1.0,A)
19+
end = time.time()
20+
21+
timediff = (end -start)
22+
mflops = ( N*N*N) *l / timediff
23+
mflops *= 1e-6
24+
25+
size = "%dx%d" % (N,N)
26+
print("%14s :\t%20f MFlops\t%20f sec" % (size,mflops,timediff))
27+
28+
29+
if __name__ == "__main__":
30+
N=128
31+
NMAX=2048
32+
NINC=128
33+
LOOPS=1
34+
35+
z=0
36+
for arg in sys.argv:
37+
if z == 1:
38+
N = int(arg)
39+
elif z == 2:
40+
NMAX = int(arg)
41+
elif z == 3:
42+
NINC = int(arg)
43+
elif z == 4:
44+
LOOPS = int(arg)
45+
46+
z = z + 1
47+
48+
if 'OPENBLAS_LOOPS' in os.environ:
49+
p = os.environ['OPENBLAS_LOOPS']
50+
if p:
51+
LOOPS = int(p);
52+
53+
print("From: %d To: %d Step=%d Loops=%d" % (N, NMAX, NINC, LOOPS))
54+
print("\tSIZE\t\t\tFlops\t\t\t\t\tTime")
55+
56+
for i in range (N,NMAX+NINC,NINC):
57+
run_ssyrk(i,LOOPS)
58+

0 commit comments

Comments
 (0)