O'Reilly logo

Python Parallel Programming Cookbook by Giancarlo Zaccone

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required