<< MPI_Barrier | Message Passing Interface | MPI_Comm_delete >> |
A = MPI_Bcast(A, Root) |
A = MPI_Bcast(A, Root, Comm) |
a nelson variable.
a integer value: rank of broadcast root.
a MPI_Comm object.
broadcasted array.
This function is used to broadcast an array to all group members.
mpiexec([modulepath('mpi'), '/examples/help_examples/MPI_Bcast.m'], 4)
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 |
Allan CORNET