pygsti.tools.mpitools.mpidot#
- mpidot(a, b, loc_row_slice, loc_col_slice, slice_tuples_by_rank, comm, out=None, out_shm=None)#
Performs a distributed dot product, dot(a,b).
- Parameters:
a (numpy.ndarray) – First array to dot together.
b (numpy.ndarray) – Second array to dot together.
loc_row_slice (slice) – Specify the row or column indices, respectively, of the resulting dot product that are computed by this processor (the rows of a and columns of b that are used). Obtained from
distribute_for_dot().loc_col_slice (slice) – Specify the row or column indices, respectively, of the resulting dot product that are computed by this processor (the rows of a and columns of b that are used). Obtained from
distribute_for_dot().slice_tuples_by_rank (list) – A list of (row_slice, col_slice) tuples, one per processor within this processors broadcast group, ordered by rank. Provided by
distribute_for_dot().comm (mpi4py.MPI.Comm or ResourceAllocation or None) – The communicator used to parallelize the dot product. If a
ResourceAllocationobject is given, then a shared memory result will be returned when appropriate.out (numpy.ndarray, optional) – If not None, the array to use for the result. This should be the same type of array (size, and whether it’s shared or not) as this function would have created if out were None.
out_shm (multiprocessing.shared_memory.SharedMemory, optional) – The shared memory object corresponding to out when it uses shared memory.
- Returns:
result (numpy.ndarray) – The resulting array
shm (multiprocessing.shared_memory.SharedMemory) – A shared memory object needed to cleanup the shared memory. If a normal array is created, this is None. Provide this to
cleanup_shared_ndarray()to ensure ar is deallocated properly.