Collective communication using Alltoall

The Alltoall collective communication combines the scatter and gather functionality. In mpi4py, there are three types of Alltoall collective communication:

  • comm .Alltoall(sendbuf, recvbuf): The all-to-all scatter/gather sends data from all-to-all processes in a group
  • comm.Alltoallv(sendbuf, recvbuf): The all-to-all scatter/gather vector sends data from all-to-all processes in a group, providing different amount of data and displacements
  • comm.Alltoallw(sendbuf, recvbuf): Generalized all-to-all communication allows different counts, displacements, and datatypes for each partner

How to do it…

In the following example, we'll see a mpi4py implementation of comm.Alltoall. We consider a communicator group of processes, ...

Get Python Parallel Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.