wrap#

classmethod caput.mpiarray.MPIArray.wrap(array: numpy.typing.NDArray, axis: int, comm: mpi4py.MPI.Comm | None = None) MPIArray[source]#

Turn ndarray`s spread across ranks into a distributed :py:class:.MPIArray` object.

Parameters:
arrayndarray

Array to wrap.

axisint

Axis over which the array is distributed. The lengths are checked to try and ensure this is correct.

commMPI.Comm | None, optional

The communicator over which the array is distributed. If None (default), use MPI.COMM_WORLD.

Returns:
wrapped_arrayMPIArray

MPIArray view of the input ndarray.

Raises:
AxisException

If the distributed axis is invalid.