Browse Source

added benchmark scripts for numpy, octave and R

tags/v0.2.15^2
Werner Saar 10 years ago
parent
commit
8614057ea9
27 changed files with 1538 additions and 0 deletions
  1. +56
    -0
      benchmark/scripts/NUMPY/cgemm.py
  2. +56
    -0
      benchmark/scripts/NUMPY/cgemv.py
  3. +58
    -0
      benchmark/scripts/NUMPY/daxpy.py
  4. +56
    -0
      benchmark/scripts/NUMPY/ddot.py
  5. +55
    -0
      benchmark/scripts/NUMPY/deig.py
  6. +56
    -0
      benchmark/scripts/NUMPY/dgemm.py
  7. +56
    -0
      benchmark/scripts/NUMPY/dgemv.py
  8. +58
    -0
      benchmark/scripts/NUMPY/dgesv.py
  9. +56
    -0
      benchmark/scripts/NUMPY/dsolve.py
  10. +56
    -0
      benchmark/scripts/NUMPY/sdot.py
  11. +56
    -0
      benchmark/scripts/NUMPY/sgemm.py
  12. +56
    -0
      benchmark/scripts/NUMPY/sgemv.py
  13. +56
    -0
      benchmark/scripts/NUMPY/zgemm.py
  14. +56
    -0
      benchmark/scripts/NUMPY/zgemv.py
  15. +56
    -0
      benchmark/scripts/OCTAVE/cgemm.m
  16. +56
    -0
      benchmark/scripts/OCTAVE/cgemv.m
  17. +56
    -0
      benchmark/scripts/OCTAVE/deig.m
  18. +56
    -0
      benchmark/scripts/OCTAVE/dgemm.m
  19. +56
    -0
      benchmark/scripts/OCTAVE/dgemv.m
  20. +59
    -0
      benchmark/scripts/OCTAVE/dsolve.m
  21. +56
    -0
      benchmark/scripts/OCTAVE/sgemm.m
  22. +56
    -0
      benchmark/scripts/OCTAVE/sgemv.m
  23. +56
    -0
      benchmark/scripts/OCTAVE/zgemm.m
  24. +56
    -0
      benchmark/scripts/OCTAVE/zgemv.m
  25. +62
    -0
      benchmark/scripts/R/deig.R
  26. +63
    -0
      benchmark/scripts/R/dgemm.R
  27. +63
    -0
      benchmark/scripts/R/dsolve.R

+ 56
- 0
benchmark/scripts/NUMPY/cgemm.py View File

@@ -0,0 +1,56 @@
#!/usr/bin/python

import os
import sys
import time
import numpy
from numpy.random import randn

def run_cgemm(N,l):

A = randn(N,N).astype('float32') + randn(N,N).astype('float32') * 1j;
B = randn(N,N).astype('float32') + randn(N,N).astype('float32') * 1j;

start = time.time();
for i in range(0,l):
ref = numpy.dot(A,B)
end = time.time()
timediff = (end -start)
mflops = ( 8*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_cgemm(i,LOOPS)


+ 56
- 0
benchmark/scripts/NUMPY/cgemv.py View File

@@ -0,0 +1,56 @@
#!/usr/bin/python

import os
import sys
import time
import numpy
from numpy.random import randn

def run_cgemv(N,l):

A = randn(N,N).astype('float32') + randn(N,N).astype('float32') * 1j;
B = randn(N).astype('float32') + randn(N).astype('float32') * 1j;

start = time.time();
for i in range(0,l):
ref = numpy.dot(A,B)
end = time.time()
timediff = (end -start)
mflops = ( 8*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_cgemv(i,LOOPS)


+ 58
- 0
benchmark/scripts/NUMPY/daxpy.py View File

@@ -0,0 +1,58 @@
#!/usr/bin/python

import os
import sys
import time
import numpy
from numpy.random import randn
from scipy.linalg.blas import daxpy


def run_daxpy(N,l):

x = randn(N).astype('float64')
y = randn(N).astype('float64')

start = time.time();
for i in range(0,l):
y = daxpy(x,y, a=2.0 )
end = time.time()
timediff = (end -start)
mflops = ( 2*N ) *l / timediff
mflops *= 1e-6

size = "%d" % (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_daxpy(i,LOOPS)


+ 56
- 0
benchmark/scripts/NUMPY/ddot.py View File

@@ -0,0 +1,56 @@
#!/usr/bin/python

import os
import sys
import time
import numpy
from numpy.random import randn

def run_ddot(N,l):

A = randn(N).astype('float64')
B = randn(N).astype('float64')

start = time.time();
for i in range(0,l):
ref = numpy.dot(A,B)
end = time.time()
timediff = (end -start)
mflops = ( 2*N ) *l / timediff
mflops *= 1e-6

size = "%d" % (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_ddot(i,LOOPS)


+ 55
- 0
benchmark/scripts/NUMPY/deig.py View File

@@ -0,0 +1,55 @@
#!/usr/bin/python

import os
import sys
import time
import numpy
from numpy.random import randn

def run_deig(N,l):

A = randn(N,N).astype('float64')

start = time.time();
for i in range(0,l):
la,v = numpy.linalg.eig(A)
end = time.time()
timediff = (end -start)
mflops = ( 26.33 *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_deig(i,LOOPS)


+ 56
- 0
benchmark/scripts/NUMPY/dgemm.py View File

@@ -0,0 +1,56 @@
#!/usr/bin/python

import os
import sys
import time
import numpy
from numpy.random import randn

def run_dgemm(N,l):

A = randn(N,N).astype('float64')
B = randn(N,N).astype('float64')

start = time.time();
for i in range(0,l):
ref = numpy.dot(A,B)
end = time.time()
timediff = (end -start)
mflops = ( 2*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_dgemm(i,LOOPS)


+ 56
- 0
benchmark/scripts/NUMPY/dgemv.py View File

@@ -0,0 +1,56 @@
#!/usr/bin/python

import os
import sys
import time
import numpy
from numpy.random import randn

def run_dgemv(N,l):

A = randn(N,N).astype('float64')
B = randn(N).astype('float64')

start = time.time();
for i in range(0,l):
ref = numpy.dot(A,B)
end = time.time()
timediff = (end -start)
mflops = ( 2*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_dgemv(i,LOOPS)


+ 58
- 0
benchmark/scripts/NUMPY/dgesv.py View File

@@ -0,0 +1,58 @@
#!/usr/bin/python

import os
import sys
import time
import numpy
from numpy.random import randn
from scipy.linalg.lapack import dgesv

def run_dgesv(N,l):

a = randn(N,N).astype('float64')
b = randn(N,N).astype('float64')

start = time.time();
for i in range(0,l):
dgesv(a,b,1,1)
end = time.time()
timediff = (end -start)

mflops = ( 2.0/3.0 *N*N*N + 2.0*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_dgesv(i,LOOPS)


+ 56
- 0
benchmark/scripts/NUMPY/dsolve.py View File

@@ -0,0 +1,56 @@
#!/usr/bin/python

import os
import sys
import time
import numpy
from numpy.random import randn

def run_dsolve(N,l):

A = randn(N,N).astype('float64')
B = randn(N,N).astype('float64')

start = time.time();
for i in range(0,l):
ref = numpy.linalg.solve(A,B)
end = time.time()
timediff = (end -start)
mflops = ( 2.0/3.0 *N*N*N + 2.0*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_dsolve(i,LOOPS)


+ 56
- 0
benchmark/scripts/NUMPY/sdot.py View File

@@ -0,0 +1,56 @@
#!/usr/bin/python

import os
import sys
import time
import numpy
from numpy.random import randn

def run_sdot(N,l):

A = randn(N).astype('float32')
B = randn(N).astype('float32')

start = time.time();
for i in range(0,l):
ref = numpy.dot(A,B)
end = time.time()
timediff = (end -start)
mflops = ( 2*N ) *l / timediff
mflops *= 1e-6

size = "%d" % (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_sdot(i,LOOPS)


+ 56
- 0
benchmark/scripts/NUMPY/sgemm.py View File

@@ -0,0 +1,56 @@
#!/usr/bin/python

import os
import sys
import time
import numpy
from numpy.random import randn

def run_sgemm(N,l):

A = randn(N,N).astype('float32')
B = randn(N,N).astype('float32')

start = time.time();
for i in range(0,l):
ref = numpy.dot(A,B)
end = time.time()
timediff = (end -start)
mflops = ( 2*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_sgemm(i,LOOPS)


+ 56
- 0
benchmark/scripts/NUMPY/sgemv.py View File

@@ -0,0 +1,56 @@
#!/usr/bin/python

import os
import sys
import time
import numpy
from numpy.random import randn

def run_sgemv(N,l):

A = randn(N,N).astype('float32')
B = randn(N).astype('float32')

start = time.time();
for i in range(0,l):
ref = numpy.dot(A,B)
end = time.time()
timediff = (end -start)
mflops = ( 2*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_sgemv(i,LOOPS)


+ 56
- 0
benchmark/scripts/NUMPY/zgemm.py View File

@@ -0,0 +1,56 @@
#!/usr/bin/python

import os
import sys
import time
import numpy
from numpy.random import randn

def run_zgemm(N,l):

A = randn(N,N).astype('float64') + randn(N,N).astype('float64') * 1j;
B = randn(N,N).astype('float64') + randn(N,N).astype('float64') * 1j;

start = time.time();
for i in range(0,l):
ref = numpy.dot(A,B)
end = time.time()
timediff = (end -start)
mflops = ( 8*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_zgemm(i,LOOPS)


+ 56
- 0
benchmark/scripts/NUMPY/zgemv.py View File

@@ -0,0 +1,56 @@
#!/usr/bin/python

import os
import sys
import time
import numpy
from numpy.random import randn

def run_zgemv(N,l):

A = randn(N,N).astype('float64') + randn(N,N).astype('float64') * 1j;
B = randn(N).astype('float64') + randn(N).astype('float64') * 1j;

start = time.time();
for i in range(0,l):
ref = numpy.dot(A,B)
end = time.time()
timediff = (end -start)
mflops = ( 8*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_zgemv(i,LOOPS)


+ 56
- 0
benchmark/scripts/OCTAVE/cgemm.m View File

@@ -0,0 +1,56 @@
#!/usr/bin/octave --silent

nfrom = 128 ;
nto = 2048;
nstep = 128;
loops = 1;


arg_list = argv();
for i = 1:nargin

switch(i)
case 1
nfrom = str2num(arg_list{i});
case 2
nto = str2num(arg_list{i});
case 3
nstep = str2num(arg_list{i});
case 4
loops = str2num(arg_list{i});

endswitch

endfor

p = getenv("OPENBLAS_LOOPS");
if p
loops = str2num(p);
endif

printf("From %d To %d Step=%d Loops=%d\n",nfrom, nto, nstep, loops);
printf(" SIZE FLOPS TIME\n");

n = nfrom;
while n <= nto

A = single(rand(n,n)) + single(rand(n,n)) * 1i;
B = single(rand(n,n)) + single(rand(n,n)) * 1i;
start = clock();

l=0;
while l < loops

C = A * B;
l = l + 1;

endwhile

timeg = etime(clock(), start);
mflops = ( 4.0 * 2.0*n*n*n *loops ) / ( timeg * 1.0e6 );

st1 = sprintf("%dx%d : ", n,n);
printf("%20s %10.2f MFlops %10.6f sec\n", st1, mflops, timeg);
n = n + nstep;

endwhile

+ 56
- 0
benchmark/scripts/OCTAVE/cgemv.m View File

@@ -0,0 +1,56 @@
#!/usr/bin/octave --silent

nfrom = 128 ;
nto = 2048;
nstep = 128;
loops = 1;


arg_list = argv();
for i = 1:nargin

switch(i)
case 1
nfrom = str2num(arg_list{i});
case 2
nto = str2num(arg_list{i});
case 3
nstep = str2num(arg_list{i});
case 4
loops = str2num(arg_list{i});

endswitch

endfor

p = getenv("OPENBLAS_LOOPS");
if p
loops = str2num(p);
endif

printf("From %d To %d Step=%d Loops=%d\n",nfrom, nto, nstep, loops);
printf(" SIZE FLOPS TIME\n");

n = nfrom;
while n <= nto

A = single(rand(n,n)) + single(rand(n,n)) * 1i;
B = single(rand(n,1)) + single(rand(n,1)) * 1i;
start = clock();

l=0;
while l < loops

C = A * B;
l = l + 1;

endwhile

timeg = etime(clock(), start);
mflops = ( 4.0 * 2.0*n*n *loops ) / ( timeg * 1.0e6 );

st1 = sprintf("%dx%d : ", n,n);
printf("%20s %10.2f MFlops %10.6f sec\n", st1, mflops, timeg);
n = n + nstep;

endwhile

+ 56
- 0
benchmark/scripts/OCTAVE/deig.m View File

@@ -0,0 +1,56 @@
#!/usr/bin/octave --silent

nfrom = 128 ;
nto = 2048;
nstep = 128;
loops = 1;


arg_list = argv();
for i = 1:nargin

switch(i)
case 1
nfrom = str2num(arg_list{i});
case 2
nto = str2num(arg_list{i});
case 3
nstep = str2num(arg_list{i});
case 4
loops = str2num(arg_list{i});

endswitch

endfor

p = getenv("OPENBLAS_LOOPS");
if p
loops = str2num(p);
endif

printf("From %d To %d Step=%d Loops=%d\n",nfrom, nto, nstep, loops);
printf(" SIZE FLOPS TIME\n");

n = nfrom;
while n <= nto

A = double(rand(n,n));
start = clock();

l=0;
while l < loops

[V,lambda] = eig(A);
l = l + 1;

endwhile


timeg = etime(clock(), start);
mflops = ( 26.33 *n*n*n ) *loops / ( timeg * 1.0e6 );

st1 = sprintf("%dx%d : ", n,n);
printf("%20s %10.2f MFlops %10.6f sec\n", st1, mflops, timeg );
n = n + nstep;

endwhile

+ 56
- 0
benchmark/scripts/OCTAVE/dgemm.m View File

@@ -0,0 +1,56 @@
#!/usr/bin/octave --silent

nfrom = 128 ;
nto = 2048;
nstep = 128;
loops = 1;


arg_list = argv();
for i = 1:nargin

switch(i)
case 1
nfrom = str2num(arg_list{i});
case 2
nto = str2num(arg_list{i});
case 3
nstep = str2num(arg_list{i});
case 4
loops = str2num(arg_list{i});

endswitch

endfor

p = getenv("OPENBLAS_LOOPS");
if p
loops = str2num(p);
endif

printf("From %d To %d Step=%d Loops=%d\n",nfrom, nto, nstep, loops);
printf(" SIZE FLOPS TIME\n");

n = nfrom;
while n <= nto

A = double(rand(n,n));
B = double(rand(n,n));
start = clock();

l=0;
while l < loops

C = A * B;
l = l + 1;

endwhile

timeg = etime(clock(), start);
mflops = ( 2.0*n*n*n *loops ) / ( timeg * 1.0e6 );

st1 = sprintf("%dx%d : ", n,n);
printf("%20s %10.2f MFlops %10.6f sec\n", st1, mflops, timeg);
n = n + nstep;

endwhile

+ 56
- 0
benchmark/scripts/OCTAVE/dgemv.m View File

@@ -0,0 +1,56 @@
#!/usr/bin/octave --silent

nfrom = 128 ;
nto = 2048;
nstep = 128;
loops = 1;


arg_list = argv();
for i = 1:nargin

switch(i)
case 1
nfrom = str2num(arg_list{i});
case 2
nto = str2num(arg_list{i});
case 3
nstep = str2num(arg_list{i});
case 4
loops = str2num(arg_list{i});

endswitch

endfor

p = getenv("OPENBLAS_LOOPS");
if p
loops = str2num(p);
endif

printf("From %d To %d Step=%d Loops=%d\n",nfrom, nto, nstep, loops);
printf(" SIZE FLOPS TIME\n");

n = nfrom;
while n <= nto

A = double(rand(n,n));
B = double(rand(n,1));
start = clock();

l=0;
while l < loops

C = A * B;
l = l + 1;

endwhile

timeg = etime(clock(), start);
mflops = ( 2.0*n*n *loops ) / ( timeg * 1.0e6 );

st1 = sprintf("%dx%d : ", n,n);
printf("%20s %10.2f MFlops %10.6f sec\n", st1, mflops, timeg);
n = n + nstep;

endwhile

+ 59
- 0
benchmark/scripts/OCTAVE/dsolve.m View File

@@ -0,0 +1,59 @@
#!/usr/bin/octave --silent

nfrom = 128 ;
nto = 2048;
nstep = 128;
loops = 1;


arg_list = argv();
for i = 1:nargin

switch(i)
case 1
nfrom = str2num(arg_list{i});
case 2
nto = str2num(arg_list{i});
case 3
nstep = str2num(arg_list{i});
case 4
loops = str2num(arg_list{i});

endswitch

endfor

p = getenv("OPENBLAS_LOOPS");
if p
loops = str2num(p);
endif

printf("From %d To %d Step=%d Loops=%d\n",nfrom, nto, nstep, loops);
printf(" SIZE FLOPS TIME\n");

n = nfrom;
while n <= nto

A = double(rand(n,n));
B = double(rand(n,n));
start = clock();

l=0;
while l < loops

x = linsolve(A,B);
#x = A / B;
l = l + 1;

endwhile


timeg = etime(clock(), start);
#r = norm(A*x - B)/norm(B)
mflops = ( 2.0/3.0 *n*n*n + 2.0*n*n*n ) *loops / ( timeg * 1.0e6 );

st1 = sprintf("%dx%d : ", n,n);
printf("%20s %10.2f MFlops %10.6f sec\n", st1, mflops, timeg );
n = n + nstep;

endwhile

+ 56
- 0
benchmark/scripts/OCTAVE/sgemm.m View File

@@ -0,0 +1,56 @@
#!/usr/bin/octave --silent

nfrom = 128 ;
nto = 2048;
nstep = 128;
loops = 1;


arg_list = argv();
for i = 1:nargin

switch(i)
case 1
nfrom = str2num(arg_list{i});
case 2
nto = str2num(arg_list{i});
case 3
nstep = str2num(arg_list{i});
case 4
loops = str2num(arg_list{i});

endswitch

endfor

p = getenv("OPENBLAS_LOOPS");
if p
loops = str2num(p);
endif

printf("From %d To %d Step=%d Loops=%d\n",nfrom, nto, nstep, loops);
printf(" SIZE FLOPS TIME\n");

n = nfrom;
while n <= nto

A = single(rand(n,n));
B = single(rand(n,n));
start = clock();

l=0;
while l < loops

C = A * B;
l = l + 1;

endwhile

timeg = etime(clock(), start);
mflops = ( 2.0*n*n*n *loops ) / ( timeg * 1.0e6 );

st1 = sprintf("%dx%d : ", n,n);
printf("%20s %10.2f MFlops %10.6f sec\n", st1, mflops, timeg);
n = n + nstep;

endwhile

+ 56
- 0
benchmark/scripts/OCTAVE/sgemv.m View File

@@ -0,0 +1,56 @@
#!/usr/bin/octave --silent

nfrom = 128 ;
nto = 2048;
nstep = 128;
loops = 1;


arg_list = argv();
for i = 1:nargin

switch(i)
case 1
nfrom = str2num(arg_list{i});
case 2
nto = str2num(arg_list{i});
case 3
nstep = str2num(arg_list{i});
case 4
loops = str2num(arg_list{i});

endswitch

endfor

p = getenv("OPENBLAS_LOOPS");
if p
loops = str2num(p);
endif

printf("From %d To %d Step=%d Loops=%d\n",nfrom, nto, nstep, loops);
printf(" SIZE FLOPS TIME\n");

n = nfrom;
while n <= nto

A = single(rand(n,n));
B = single(rand(n,1));
start = clock();

l=0;
while l < loops

C = A * B;
l = l + 1;

endwhile

timeg = etime(clock(), start);
mflops = ( 2.0*n*n *loops ) / ( timeg * 1.0e6 );

st1 = sprintf("%dx%d : ", n,n);
printf("%20s %10.2f MFlops %10.6f sec\n", st1, mflops, timeg);
n = n + nstep;

endwhile

+ 56
- 0
benchmark/scripts/OCTAVE/zgemm.m View File

@@ -0,0 +1,56 @@
#!/usr/bin/octave --silent

nfrom = 128 ;
nto = 2048;
nstep = 128;
loops = 1;


arg_list = argv();
for i = 1:nargin

switch(i)
case 1
nfrom = str2num(arg_list{i});
case 2
nto = str2num(arg_list{i});
case 3
nstep = str2num(arg_list{i});
case 4
loops = str2num(arg_list{i});

endswitch

endfor

p = getenv("OPENBLAS_LOOPS");
if p
loops = str2num(p);
endif

printf("From %d To %d Step=%d Loops=%d\n",nfrom, nto, nstep, loops);
printf(" SIZE FLOPS TIME\n");

n = nfrom;
while n <= nto

A = double(rand(n,n)) + double(rand(n,n)) * 1i;
B = double(rand(n,n)) + double(rand(n,n)) * 1i;
start = clock();

l=0;
while l < loops

C = A * B;
l = l + 1;

endwhile

timeg = etime(clock(), start);
mflops = ( 4.0 * 2.0*n*n*n *loops ) / ( timeg * 1.0e6 );

st1 = sprintf("%dx%d : ", n,n);
printf("%20s %10.2f MFlops %10.6f sec\n", st1, mflops, timeg);
n = n + nstep;

endwhile

+ 56
- 0
benchmark/scripts/OCTAVE/zgemv.m View File

@@ -0,0 +1,56 @@
#!/usr/bin/octave --silent

nfrom = 128 ;
nto = 2048;
nstep = 128;
loops = 1;


arg_list = argv();
for i = 1:nargin

switch(i)
case 1
nfrom = str2num(arg_list{i});
case 2
nto = str2num(arg_list{i});
case 3
nstep = str2num(arg_list{i});
case 4
loops = str2num(arg_list{i});

endswitch

endfor

p = getenv("OPENBLAS_LOOPS");
if p
loops = str2num(p);
endif

printf("From %d To %d Step=%d Loops=%d\n",nfrom, nto, nstep, loops);
printf(" SIZE FLOPS TIME\n");

n = nfrom;
while n <= nto

A = double(rand(n,n)) + double(rand(n,n)) * 1i;
B = double(rand(n,1)) + double(rand(n,1)) * 1i;
start = clock();

l=0;
while l < loops

C = A * B;
l = l + 1;

endwhile

timeg = etime(clock(), start);
mflops = ( 4.0 * 2.0*n*n *loops ) / ( timeg * 1.0e6 );

st1 = sprintf("%dx%d : ", n,n);
printf("%20s %10.2f MFlops %10.6f sec\n", st1, mflops, timeg);
n = n + nstep;

endwhile

+ 62
- 0
benchmark/scripts/R/deig.R View File

@@ -0,0 +1,62 @@
#!/usr/bin/Rscript

argv <- commandArgs(trailingOnly = TRUE)

nfrom = 128
nto = 2048
nstep = 128
loops = 1

if ( length(argv) > 0 ) {

for ( z in 1:length(argv) ) {

if ( z == 1 ) {
nfrom <- as.numeric(argv[z])
} else if ( z==2 ) {
nto <- as.numeric(argv[z])
} else if ( z==3 ) {
nstep <- as.numeric(argv[z])
} else if ( z==4 ) {
loops <- as.numeric(argv[z])
}
}

}

p=Sys.getenv("OPENBLAS_LOOPS")
if ( p != "" ) {
loops <- as.numeric(p)
}


cat(sprintf("From %.0f To %.0f Step=%.0f Loops=%.0f\n",nfrom, nto, nstep, loops))
cat(sprintf(" SIZE Flops Time\n"))

n = nfrom
while ( n <= nto ) {

A <- matrix(runif(n*n), ncol = n, nrow = n, byrow = TRUE)
l = 1

start <- proc.time()[3]

while ( l <= loops ) {

ev <- eigen(A)
l = l + 1
}

end <- proc.time()[3]
timeg = end - start
mflops = (26.66 *n*n*n ) * loops / ( timeg * 1.0e6 )

st = sprintf("%.0fx%.0f :",n , n)
cat(sprintf("%20s %10.2f MFlops %10.6f sec\n", st, mflops, timeg))

n = n + nstep

}



+ 63
- 0
benchmark/scripts/R/dgemm.R View File

@@ -0,0 +1,63 @@
#!/usr/bin/Rscript

argv <- commandArgs(trailingOnly = TRUE)

nfrom = 128
nto = 2048
nstep = 128
loops = 1

if ( length(argv) > 0 ) {

for ( z in 1:length(argv) ) {

if ( z == 1 ) {
nfrom <- as.numeric(argv[z])
} else if ( z==2 ) {
nto <- as.numeric(argv[z])
} else if ( z==3 ) {
nstep <- as.numeric(argv[z])
} else if ( z==4 ) {
loops <- as.numeric(argv[z])
}
}

}

p=Sys.getenv("OPENBLAS_LOOPS")
if ( p != "" ) {
loops <- as.numeric(p)
}


cat(sprintf("From %.0f To %.0f Step=%.0f Loops=%.0f\n",nfrom, nto, nstep, loops))
cat(sprintf(" SIZE Flops Time\n"))

n = nfrom
while ( n <= nto ) {

A <- matrix(runif(n*n), ncol = n, nrow = n, byrow = TRUE)
B <- matrix(runif(n*n), ncol = n, nrow = n, byrow = TRUE)
l = 1

start <- proc.time()[3]

while ( l <= loops ) {

C <- A %*% B
l = l + 1
}

end <- proc.time()[3]
timeg = end - start
mflops = ( 2.0 *n*n*n ) * loops / ( timeg * 1.0e6 )

st = sprintf("%.0fx%.0f :",n , n)
cat(sprintf("%20s %10.2f MFlops %10.6f sec\n", st, mflops, timeg))

n = n + nstep

}



+ 63
- 0
benchmark/scripts/R/dsolve.R View File

@@ -0,0 +1,63 @@
#!/usr/bin/Rscript

argv <- commandArgs(trailingOnly = TRUE)

nfrom = 128
nto = 2048
nstep = 128
loops = 1

if ( length(argv) > 0 ) {

for ( z in 1:length(argv) ) {

if ( z == 1 ) {
nfrom <- as.numeric(argv[z])
} else if ( z==2 ) {
nto <- as.numeric(argv[z])
} else if ( z==3 ) {
nstep <- as.numeric(argv[z])
} else if ( z==4 ) {
loops <- as.numeric(argv[z])
}
}

}

p=Sys.getenv("OPENBLAS_LOOPS")
if ( p != "" ) {
loops <- as.numeric(p)
}


cat(sprintf("From %.0f To %.0f Step=%.0f Loops=%.0f\n",nfrom, nto, nstep, loops))
cat(sprintf(" SIZE Flops Time\n"))

n = nfrom
while ( n <= nto ) {

A <- matrix(runif(n*n), ncol = n, nrow = n, byrow = TRUE)
B <- matrix(runif(n*n), ncol = n, nrow = n, byrow = TRUE)
l = 1

start <- proc.time()[3]

while ( l <= loops ) {

solve(A,B)
l = l + 1
}

end <- proc.time()[3]
timeg = end - start
mflops = (2.0/3.0 *n*n*n + 2.0 *n*n*n ) * loops / ( timeg * 1.0e6 )

st = sprintf("%.0fx%.0f :",n , n)
cat(sprintf("%20s %10.2f MFlops %10.6f sec\n", st, mflops, timeg))

n = n + nstep

}



Loading…
Cancel
Save