From bf6960404e99f9786cc2d320e46beb6404466e44 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Keck <Jean-Baptiste.Keck@imag.fr> Date: Fri, 28 Feb 2020 23:18:48 +0100 Subject: [PATCH] little fixed for ci --- hysop/numerics/fft/_mkl_fft.py | 28 ++++++++++++++++++++-------- hysop/numerics/tests/test_fft.py | 2 +- hysop/topology/cartesian_topology.py | 23 ++++++++++++----------- 3 files changed, 33 insertions(+), 20 deletions(-) diff --git a/hysop/numerics/fft/_mkl_fft.py b/hysop/numerics/fft/_mkl_fft.py index 6dadfa219..94c329dce 100644 --- a/hysop/numerics/fft/_mkl_fft.py +++ b/hysop/numerics/fft/_mkl_fft.py @@ -86,17 +86,29 @@ def setup_transform(x, axis, transform, inverse, type): return (sin,din,sout,dout) -def fft(**kwds): - out = mkl_fft(**kwds) +def fft(out=None, **kwds): + if (out is None): + out = mkl_fft(**kwds) + else: + out[...] = mkl_fft(**kwds) return out -def ifft(**kwds): - out = mkl_ifft(**kwds) +def ifft(out=None, **kwds): + if (out is None): + out = mkl_ifft(**kwds) + else: + out[...] = mkl_ifft(**kwds) return out -def rfft(**kwds): - out = mkl_rfft(**kwds) +def rfft(out=None, **kwds): + if (out is None): + out = mkl_rfft(**kwds) + else: + out[...] = mkl_rfft(**kwds) return out -def irfft(**kwds): - out = mkl_irfft(**kwds) +def irfft(out=None, **kwds): + if (out is None): + out = mkl_irfft(**kwds) + else: + out[...] = mkl_irfft(**kwds) return out diff --git a/hysop/numerics/tests/test_fft.py b/hysop/numerics/tests/test_fft.py index c519754b7..e20e21781 100644 --- a/hysop/numerics/tests/test_fft.py +++ b/hysop/numerics/tests/test_fft.py @@ -707,7 +707,7 @@ class TestFFT(object): else: dtypes = (HYSOP_REAL,) for dtype in dtypes: - #self._test_forward_backward_1d(dtype=dtype) + self._test_forward_backward_1d(dtype=dtype) self._test_1d(dtype=dtype, failures=failures.setdefault(dtype.__name__, {})) self.report_failures(failures) diff --git a/hysop/topology/cartesian_topology.py b/hysop/topology/cartesian_topology.py index 28f1473c0..64162b0fa 100644 --- a/hysop/topology/cartesian_topology.py +++ b/hysop/topology/cartesian_topology.py @@ -775,18 +775,19 @@ class CartesianTopology(CartesianTopologyView, Topology): msg = ' parameter is useless when cutdirs is provided.' assert shape is None, 'shape ' + msg assert dim is None, 'dim ' + msg - is_distributed = npw.asboolarray(cutdirs).copy() - dim = np.sum(is_distributed>0) - assert dim <= domain_dim, 'cutdirs is not of size domain_dim' - - cart_shape = npw.asintegerarray(MPI.Compute_dims(parent_size,dim)) - cls._optimize_shape(cart_shape) - assert np.sum(cutdirs > 0) == cart_shape.size,\ - "Created shape {} doesnt respect specified cutdirs {}".format( - np.sum(cutdirs > 0), cart_shape.size) - shape = npw.dim_ones(domain_dim) - shape[is_distributed>0] = cart_shape + is_distributed = npw.asboolarray(cutdirs).copy() + if is_distributed.any(): + dim = np.sum(is_distributed>0) + assert dim <= domain_dim, 'cutdirs is not of size domain_dim' + cart_shape = npw.asintegerarray(MPI.Compute_dims(parent_size,dim)) + cls._optimize_shape(cart_shape) + assert np.sum(cutdirs > 0) == cart_shape.size,\ + "Created shape {} doesnt respect specified cutdirs {}".format( + np.sum(cutdirs > 0), cart_shape.size) + shape[is_distributed>0] = cart_shape + else: + assert parent_size==1 else: if (dim is not None): # method (d) -- GitLab