gather function performs the inverse of the
scatter functionality. In this case, all processes send data to a root process that collects the data received. The
gather function implemented in
mpi4py is, as follows:
recvbuf = comm.gather(sendbuf, rank_of_root_process)
sendbuf is the data that is sent and
rank_of_root_process represents the process receiver of all the data:
In the following example, we wanted to represent just the condition shown in the preceding figure. Each process builds its own data that is to be sent to the root processes that are ...