httomo.data.mpiutil.alltoall

Contents

httomo.data.mpiutil.alltoall#

httomo.data.mpiutil.alltoall(arrays: List[ndarray], comm: mpi4py.MPI.Comm) List[ndarray][source]#

Distributes a list of contiguous numpy arrays from each rank to every other rank.

It also handles the case where the array sizes are larger than the max allowed by MPI (INT_MAX elements, i.e. 2*31), since all MPI calls use the C int data type for representing sizes. It fixes this with reslice in mind, so the input arrays in the list must:

  • be 3-dimensional

  • One of these dimensions must be the same lengths for all arrays across sent/received arrays (reslice maps from current slice dim to next slice dim and leaves the third dimension untouched)

It picks this consistently-sized dimension and creates a new contiguous MPI data type of that length. Then the sizes are divided by this length, which should make it fit in all practical cases. If not, MPI will raise an exception.

Parameters:

arrays (List[np.ndarray]) – List of 3D numpy arrays to be distributed. Length must be the full size of the given communicator.

Returns:

List of the numpy arrays received. Length is the full size of the given communicator.

Return type:

List[np.ndarray]