Created
November 22, 2017 22:33
-
-
Save miku/0f5e0c4966940c17c0a5a8849518b3fb to your computer and use it in GitHub Desktop.
Benchmark numpy MKL OS X
This file contains 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
# 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