numpy performance reached on reasonable matrix size

This commit is contained in:
rdgarce
2023-08-18 13:09:43 +02:00
parent 4b3127d84d
commit 44e68aa0a9
6 changed files with 360 additions and 34 deletions
+22
View File
@@ -0,0 +1,22 @@
import os
os.environ['OMP_NUM_THREADS'] = '1'
import numpy as np
import time
N = 1024
if __name__ == "__main__":
A = np.random.randn(N,N).astype(np.float64)
B = np.random.randn(N,N).astype(np.float64)
start = time.monotonic()
C = A @ B
stop = time.monotonic()
s = stop-start
ops = 2*N*N*N
print(f"NUMPY: {ops/s * 1e-9} GFLOPS\n")