diff --git a/devito/types/dense.py b/devito/types/dense.py index a4ea53b699..4ae37269cb 100644 --- a/devito/types/dense.py +++ b/devito/types/dense.py @@ -751,8 +751,10 @@ def _C_get_field(self, region, dim, side=None): def _halo_exchange(self): """Perform the halo exchange with the neighboring processes.""" - if not MPI.Is_initialized() or MPI.COMM_WORLD.size == 1 or \ - not configuration['mpi']: + if not MPI.Is_initialized() or \ + MPI.COMM_WORLD.size == 1 or \ + not configuration['mpi'] or \ + self.grid is None: # Nothing to do return if MPI.COMM_WORLD.size > 1 and self._distributor is None: diff --git a/tests/test_tensors.py b/tests/test_tensors.py index 815efa51ba..30ac7e578f 100644 --- a/tests/test_tensors.py +++ b/tests/test_tensors.py @@ -100,10 +100,10 @@ def test_tensor_matmul(func1, func2, out_type): @pytest.mark.parametrize('func1, func2, out_type', [ - (VectorFunction, TensorFunction, VectorFunction), - (VectorTimeFunction, TensorFunction, VectorTimeFunction), - (VectorFunction, TensorTimeFunction, VectorTimeFunction), - (VectorTimeFunction, TensorTimeFunction, VectorTimeFunction)]) + (VectorFunction, TensorFunction, TensorFunction), + (VectorTimeFunction, TensorFunction, TensorTimeFunction), + (VectorFunction, TensorTimeFunction, TensorTimeFunction), + (VectorTimeFunction, TensorTimeFunction, TensorTimeFunction)]) def test_tensor_matmul_T(func1, func2, out_type): grid = Grid(tuple([5]*3)) f1 = func1(name="f1", grid=grid)