pygsti.tools.mpitools.distribute_for_dot

pygsti.tools.mpitools.distribute_for_dot#

distribute_for_dot(a_shape, b_shape, comm)#

Prepares for one or multiple distributed dot products given the dimensions to be dotted.

The returned values should be passed as loc_slices to mpidot().

Parameters:
  • a_shape (tuple) – The shapes of the arrays that will be dotted together in ensuing mpidot() calls (see above).

  • b_shape (tuple) – The shapes of the arrays that will be dotted together in ensuing mpidot() calls (see above).

  • comm (mpi4py.MPI.Comm or ResourceAllocation or None) – The communicator used to perform the distribution.

Returns:

  • row_slice, col_slice (slice) – The “local” row slice of “A” and column slice of “B” belonging to the current processor, which computes result[row slice, col slice]. These should be passed to mpidot().

  • slice_tuples_by_rank (list) – A list of the (row_slice, col_slice) owned by each processor, ordered by rank. If a ResourceAllocation is given that utilizes shared memory, then this list is for the ranks in this processor’s inter-host communication group. This should be passed as the slice_tuples_by_rank argument of mpidot().