A = MPI_Bcast(A, Root)
A = MPI_Bcast(A, Root, Comm)
| Parameter | Description |
|---|---|
| A | a nelson variable. |
| Root | a integer value: rank of broadcast root. |
| Comm | a MPI_Comm object. |
| Parameter | Description |
|---|---|
| A | broadcasted array. |
This function is used to broadcast an array to all group members.
if ~MPI_Initialized()
MPI_Init();
end
my_rank = MPI_Comm_rank();
num_ranks = MPI_Comm_size();
root = 0;
if (my_rank == 0)
buff = 777;
else
buff = 0;
end
disp(['rank: ', int2str(my_rank), ': before Bcast, buff is ', int2str(buff)])
buff = MPI_Bcast(buff, root);
disp(['rank: ', int2str(my_rank), ': after Bcast, buff is ', int2str(buff)])
if MPI_Initialized()
MPI_Finalize();
end
| Version | Description |
|---|---|
| 1.0.0 | initial version |