Commit bc6f45f9 authored by Martin Reinecke's avatar Martin Reinecke

print some more information during the run

parent 804b4c6c
......@@ -42,9 +42,9 @@ def get_next_prime_factor(n):
def measure_fftw(a, nrepeat):
import pyfftw
f1 = pyfftw.empty_aligned(a.shape, dtype=a.dtype)
f1[()] = a
f2 = pyfftw.empty_aligned(a.shape, dtype=a.dtype)
fftw = pyfftw.FFTW(f1, f2, flags=('FFTW_MEASURE',), axes=range(a.ndim), threads=nthr)
f1[()] = a
tmin = 1e38
for i in range(nrepeat):
t0 = time()
......@@ -89,13 +89,15 @@ def measure_scipy_fftpack(a, nrepeat):
def bench_nd(ndim, nmax, ntry, tp, funcs, nrepeat, ttl="", filename=""):
print("{}D, type {}, max extent is {}:".format(ndim, tp, nmax))
results = [[] for i in range(len(funcs))]
for n in range(ntry):
print(n, ntry)
shp = np.random.randint(nmax//3, nmax+1, ndim)
print(" {0:4d}/{1}: shape={2} ...".format(n, ntry, shp), end=" ", flush=True)
a = (np.random.rand(*shp) + 1j*np.random.rand(*shp)).astype(tp)
for func, res in zip(funcs, results):
res.append(func(a, nrepeat))
print("{0:5.2e}/{1:5.2e} = {2:5.2f}".format(results[0][n],results[1][n],results[0][n]/results[1][n]))
results = np.array(results)
plt.title("{}: {}D, {}, max_extent={}".format(
ttl, ndim, str(tp), nmax))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment