MPI_BCAST(buffer, count, datatype, root, comm) | |
INOUT buffer | starting address of buffer (choice) |
IN count | number of entries in buffer (non-negative integer) |
IN datatype | datatype of buffer (handle) |
IN root | rank of the root (integer) |
IN comm | communicator (handle) |
If comm is an intra-communicator, MPI_BCAST broadcasts a message from the MPI process with rank root to all MPI processes of the group, itself included. It is called by all members of the group using the same arguments for comm and root. On return, the content of the root's buffer is copied to all other MPI processes.
General, derived datatypes are allowed for datatype. The type signature of count, datatype on any MPI process must be equal to the type signature of count, datatype at the root. This implies that the amount of data sent must be equal to the amount received, pairwise between each MPI process and the root. MPI_BCAST and all other data-movement collective routines make this restriction. Distinct type maps between sender and receiver are still allowed.
The ``in place'' option is not meaningful here.
If comm is an inter-communicator, then the call involves all MPI processes in the inter-communicator, but with one group (group A) defining the root. All MPI processes in the other group (group B) pass the same value in argument root, which is the rank of the root in group A. The root passes the value MPI_ROOT in root. All other MPI processes in group A pass the value MPI_PROC_NULL in root. Data is broadcast from the root to all MPI processes in group B. The buffer arguments of the MPI processes in group B must be consistent with the buffer argument of the root.