Commit 4b297b21 by Martin Reinecke

### tweaks

parent 1dda33da
 ... @@ -2,7 +2,6 @@ import numpy as np ... @@ -2,7 +2,6 @@ import numpy as np import pypocketfft import pypocketfft from time import time from time import time import matplotlib.pyplot as plt import matplotlib.pyplot as plt import math def _l2error(a, b): def _l2error(a, b): ... @@ -43,9 +42,10 @@ def measure_fftw_np_interface(a, nrepeat, nthr): ... @@ -43,9 +42,10 @@ def measure_fftw_np_interface(a, nrepeat, nthr): def measure_pypocketfft(a, nrepeat, nthr): def measure_pypocketfft(a, nrepeat, nthr): import pypocketfft as ppf import pypocketfft as ppf tmin = 1e38 tmin = 1e38 b = a.copy() for i in range(nrepeat): for i in range(nrepeat): t0 = time() t0 = time() b = ppf.c2c(a, forward=True, nthreads=nthr) b = ppf.c2c(a, out=b, forward=True, nthreads=nthr) t1 = time() t1 = time() tmin = min(tmin, t1-t0) tmin = min(tmin, t1-t0) return tmin, b return tmin, b ... ...
 ... @@ -2,7 +2,13 @@ import numpy as np ... @@ -2,7 +2,13 @@ import numpy as np import pypocketfft import pypocketfft from time import time from time import time import matplotlib.pyplot as plt import matplotlib.pyplot as plt import math def get_complex_array(real_array, allocfunc): tocomplex = { np.float32: np.complex64, np.float64: np.complex128 } shape = list(real_array.shape) shape[-1] = shape[-1]//2 + 1 return allocfunc(shape, dtype=tocomplex[real_array.dtype.type]) def _l2error(a, b): def _l2error(a, b): ... @@ -12,11 +18,7 @@ def _l2error(a, b): ... @@ -12,11 +18,7 @@ def _l2error(a, b): def measure_fftw(a, nrepeat, nthr, flags=('FFTW_MEASURE',)): def measure_fftw(a, nrepeat, nthr, flags=('FFTW_MEASURE',)): import pyfftw import pyfftw f1 = pyfftw.empty_aligned(a.shape, dtype=a.dtype) f1 = pyfftw.empty_aligned(a.shape, dtype=a.dtype) tval = np.ones(1).astype(f1.dtype) f2 = get_complex_array(a, pyfftw.empty_aligned) t2 = (tval+1j*tval).dtype shape_out=list(a.shape) shape_out[-1] = shape_out[-1]//2 + 1 f2 = pyfftw.empty_aligned(shape_out, dtype=t2) fftw = pyfftw.FFTW(f1, f2, flags=flags, axes=range(a.ndim), threads=nthr) fftw = pyfftw.FFTW(f1, f2, flags=flags, axes=range(a.ndim), threads=nthr) f1[()] = a f1[()] = a tmin = 1e38 tmin = 1e38 ... @@ -47,9 +49,10 @@ def measure_fftw_np_interface(a, nrepeat, nthr): ... @@ -47,9 +49,10 @@ def measure_fftw_np_interface(a, nrepeat, nthr): def measure_pypocketfft(a, nrepeat, nthr): def measure_pypocketfft(a, nrepeat, nthr): import pypocketfft as ppf import pypocketfft as ppf tmin = 1e38 tmin = 1e38 b = get_complex_array(a, np.empty) for i in range(nrepeat): for i in range(nrepeat): t0 = time() t0 = time() b = ppf.r2c(a, forward=True, nthreads=nthr) b = ppf.r2c(a, forward=True, nthreads=nthr, out=b) t1 = time() t1 = time() tmin = min(tmin, t1-t0) tmin = min(tmin, t1-t0) return tmin, b return tmin, b ... ...
 ... @@ -3392,6 +3392,9 @@ template void r2r_genuine_hartley(const shape_t &shape, ... @@ -3392,6 +3392,9 @@ template void r2r_genuine_hartley(const shape_t &shape, const T *data_in, T *data_out, T fct, size_t nthreads=1) const T *data_in, T *data_out, T fct, size_t nthreads=1) { { if (util::prod(shape)==0) return; if (util::prod(shape)==0) return; if (axes.size()==1) return r2r_separable_hartley(shape, stride_in, stride_out, axes, data_in, data_out, fct, nthreads); util::sanity_check(shape, stride_in, stride_out, data_in==data_out, axes); util::sanity_check(shape, stride_in, stride_out, data_in==data_out, axes); shape_t tshp(shape); shape_t tshp(shape); tshp[axes.back()] = tshp[axes.back()]/2+1; tshp[axes.back()] = tshp[axes.back()]/2+1; ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!