diff --git a/conftest.py b/conftest.py index 4bb06293271..97e56d069d8 100644 --- a/conftest.py +++ b/conftest.py @@ -177,7 +177,7 @@ def parallel(item, m): args = ["-n", "1", pyversion, "-m", "pytest", "-s", "--runxfail", "-qq", testname] if nprocs > 1: args.extend([":", "-n", "%d" % (nprocs - 1), pyversion, "-m", "pytest", - "-s", "--runxfail", "--tb=no", "-qq", "--no-summary", testname]) + "-s", "--runxfail", "--tb=no", "-qq", testname]) # OpenMPI requires an explicit flag for oversubscription. We need it as some # of the MPI tests will spawn lots of processes if mpi_distro == 'OpenMPI': diff --git a/devito/data/data.py b/devito/data/data.py index b23a88c80e8..ba9bd47ecd3 100644 --- a/devito/data/data.py +++ b/devito/data/data.py @@ -130,7 +130,8 @@ def __array_finalize__(self, obj): decomposition.append(dec.reshape(i)) self._decomposition = tuple(decomposition) self._allocator = obj._allocator - self._is_distributed = any(i is not None for i in self._decomposition) + decomp = any(i is not None for i in self._decomposition) + self._is_distributed = decomp and obj._is_distributed else: self._distributor = obj._distributor self._allocator = obj._allocator @@ -142,7 +143,8 @@ def __array_finalize__(self, obj): # E.g., from a reduction operation such as `np.mean` or `np.all` self._modulo = tuple(False for i in range(self.ndim)) self._decomposition = (None,)*self.ndim - self._is_distributed = any(i is not None for i in self._decomposition) + decomp = any(i is not None for i in self._decomposition) + self._is_distributed = decomp and obj._is_distributed @property def _local(self): diff --git a/tests/test_data.py b/tests/test_data.py index 47c1c78d169..3f4d0b5cb96 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -208,6 +208,17 @@ def test_indexing_into_sparse(self): sf.data[1:-1, 0] = np.arange(8) assert np.all(sf.data[1:-1, 0] == np.arange(8)) + @pytest.mark.parallel(mode=1) + def test_indexing_into_sparse_subfunc_singlempi(self, mode): + grid = Grid(shape=(4, 4)) + s = SparseFunction(name='sf', grid=grid, npoint=1) + coords = np.random.rand(*s.coordinates.data.shape) + s.coordinates.data[:] = coords + + s.coordinates.data[-1, :] = s.coordinates.data[-1, :] / 2 + + assert np.allclose(s.coordinates.data[-1, :], coords[-1, :] / 2) + class TestLocDataIDX: """