Differences between MPI_Scatter and MPI_Bcast

Can someone explain what is the difference between MPI_Scatter and MPI_Bcast ? (Except that any process can be broadcast using MPI_Scatter , and only root can use MPI_Bcast )

When should I use the first over the other?

+6
source share
2 answers

MPI_Bcast() sends the same piece of data to everyone, and MPI_Scatter() sends each process a portion of the input array. MPI_Bcast() opposite of MPI_Reduce() , and MPI_Scatter() is the opposite of MPI_Gather() . A small circuit, such as this one , requires no explanation.

And both MPI_Scatter() and MPI_Bcast() have an argument named int root to indicate the root process.

+11
source

MPI_Bcast receives one data item in the root process (red field) and copies it to all other processes. MPI_Scatter takes an array of elements and distributes the elements in order of process rank.

the illustration

+2
source

Source: https://habr.com/ru/post/980457/


All Articles