Collective communication using the scatter function

The scatter functionality is very similar to a scatter broadcast, but with one major difference: while comm.bcast sends the same data to all listening processes, comm.scatter can send chunks of data in an array to different processes.

The following diagram illustrates the scatter functionality:

Scattering data from process 0 to processes 1, 2, 3, and 4

The comm.scatter function takes the elements of the array and distributes them to the processes according to their rank, for which the first element will be sent to process 0, the second element to process 1, and so on. The function implemented in mpi4py is as follows:

recvbuf  = comm.scatter(sendbuf, rank_of_root_process) 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset