Commit 4f8ff621 authored by Ben Boeckel's avatar Ben Boeckel Committed by Kitware Robot

Merge topic 'mpi4py-not-avail'

fdd23770 numpy_interface: handle mpi4py not being available
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Utkarsh Ayachit's avatarUtkarsh Ayachit <utkarsh.ayachit@kitware.com>
Merge-request: !4723
parents 76e78997 fdd23770
......@@ -192,8 +192,11 @@ def _global_func(impl, array, axis, controller):
if axis is None or axis == 0:
if controller is None and vtkMultiProcessController is not None:
controller = vtkMultiProcessController.GetGlobalController()
if controller and controller.IsA("vtkMPIController"):
from mpi4py import MPI
if controller and controller.IsA("vtkMPIController") and controller.GetNumberOfProcesses() > 1:
try:
from mpi4py import MPI
except ImportError:
raise RuntimeError('MPI4Py is required to perform multi-rank operations')
comm = vtkMPI4PyCommunicator.ConvertToPython(controller.GetCommunicator())
max_dims, size = _reduce_dims(res, comm)
......
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