Skip to content

Instantly share code, notes, and snippets.

@miku
Created November 22, 2017 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miku/0f5e0c4966940c17c0a5a8849518b3fb to your computer and use it in GitHub Desktop.
Save miku/0f5e0c4966940c17c0a5a8849518b3fb to your computer and use it in GitHub Desktop.
Benchmark numpy MKL OS X
# http://sharapov.com/2016/02/08/building-numpy-with-mkl/
import time
import numpy as np
A = np.random.rand(2000,2000)
B = np.random.rand(2000,2000)
print('Matrix multiplication')
time1 = time.time()
clock1 = time.clock()
C = np.dot(A,B)
clock2 = time.clock()
time2 = time.time()
print(' Elapsed time: %.02f sec.' % (time2-time1) )
print(' CPU time: %.02f sec.' % (clock2-clock1) )
print('Eigenvalue computation')
time1 = time.time()
clock1 = time.clock()
np.linalg.eig(A)
clock2 = time.clock()
time2 = time.time()
print(' Elapsed time: %.02f sec.' % (time2-time1) )
print(' CPU time: %.02f sec.' % (clock2-clock1) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment