import numpy as np
import time as time
import matplotlib.pyplot as plt
#nlist = 10**np.array([1,2,3,4])
nlist = np.arange(64,1e3,64,dtype=int)
tavg = []
tmax = []
tmin = []
for n in nlist:
v = np.ones((n,n),dtype=np.float16)
w = np.ones((n,n),dtype=np.float16)
u = v + w
m=5
ts = np.zeros((m,))
for i in range(m):
t = time.time()
u = v + w
ts[i] = time.time() - t
tavg.append(ts.mean())
tmax.append(ts.max())
tmin.append(ts.min())
plt.loglog(nlist, tavg)
plt.grid(True)
#plt.loglog(nlist, tmax)
#plt.loglog(nlist, tmin)
v.nbytes
32 * 1024