Created
October 23, 2017 20:57
-
-
Save MandarGogate/ba1cc50662fcb9adea135205a6e458e1 to your computer and use it in GitHub Desktop.
Intel® Distribution for Python Benchmark
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time; | |
import scipy as sp; | |
import scipy.linalg as la; | |
import numpy as np; | |
n=10000 | |
A=sp.random.rand(n,n) | |
B=sp.random.rand(n,n) | |
t=time.time() | |
C=np.dot(A,B) | |
t=time.time()-t | |
f=2*n**3/t/1e9 | |
print("Numpy dot: time = %.2f seconds; flop rate = %.2f Gflops/s"%(t,f)) | |
t=time.time() | |
C=sp.dot(A,B) | |
t=time.time()-t | |
f=2*n**3/t/1e9 | |
print("Scipy dot: time = %.2f seconds; flop rate = %.2f Gflops/s"%(t,f)) | |
t=time.time() | |
C=la.blas.dgemm(1.0,A,B) | |
t=time.time()-t | |
f=2*n**3/t/1e9 | |
print("Scipy dgemm: time = %.2f seconds; flop rate = %.2f Gflops/s"%(t,f)) | |
# without Intel® Distribution for Python Benchmark | |
# Numpy dot: time = 32.43 seconds; flop rate = 61.68 Gflops/s | |
# Scipy dot: time = 28.53 seconds; flop rate = 70.09 Gflops/s | |
# Scipy dgemm: time = 41.09 seconds; flop rate = 48.68 Gflops/s | |
# with Intel® Distribution for Python Benchmark | |
# Numpy dot: time = 14.54 seconds; flop rate = 137.56 Gflops/s | |
# Scipy dot: time = 19.10 seconds; flop rate = 104.71 Gflops/s | |
# Scipy dgemm: time = 25.80 seconds; flop rate = 77.51 Gflops/s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment