pygsti.tools.mpitools.gather_slices_by_owner#
- gather_slices_by_owner(current_slices, ar_to_fill, ar_to_fill_inds, axes, comm, max_buffer_size=None)#
Gathers data within a numpy array, ar_to_fill, according to given slices.
Upon entry it is assumed that the different processors within comm have computed different parts of ar_to_fill, namely different slices of the axes indexed by axes. At exit, data has been gathered such that all processors have the results for the entire ar_to_fill (or at least for all the slices given).
- Parameters:
current_slices (list) – A list of all the slices computed by the current processor. Each element of slices may be either a single slice or a tuple of slices (when gathering across multiple dimensions).
ar_to_fill (numpy.ndarray) – The array which contains partial data upon entry and the gathered data upon exit.
ar_to_fill_inds (list) – A list of slice or index-arrays specifying the (fixed) sub-array of ar_to_fill that should be gathered into. The elements of ar_to_fill_inds are taken to be indices for the leading dimension first, and any unspecified dimensions or None elements are assumed to be unrestricted (as if slice(None,None)). Note that the combination of ar_to_fill and ar_to_fill_inds is essentially like passing ar_to_fill[ar_to_fill_inds] to this function, except it will work with index arrays as well as slices.
axes (int or tuple of ints) – The axis or axes of ar_to_fill on which the slices apply (which axis do the slices in slices refer to?). Note that len(axes) must be equal to the number of slices (i.e. the tuple length) of each element of slices.
comm (mpi4py.MPI.Comm or None) – The communicator specifying the processors involved and used to perform the gather operation.
max_buffer_size (int or None) – The maximum buffer size in bytes that is allowed to be used for gathering data. If None, there is no limit.
- Return type:
None