The mpi4py library provides two other functions that are used to scatter data:
- comm.scatter(sendbuf, recvbuf, root=0): This function sends data from one process to all other processes in a communicator.
- comm.scatterv(sendbuf, recvbuf, root=0): This function scatters data from one process to all other processes in a given group that provide a different amount of data and displacements at the sending side.
The sendbuf and recvbuf arguments must be given in terms of a list (as in the comm.send point-to-point function):
buf = [data, data_size, data_type]
Here, data must be a buffer-like object of the data_size size and of the data_type type.