As Roy mentioned, there is no wrapper for this. The right way to do it, for
example, is MPI_Bcast and may be seen in mesh_communiation.C:
This code broadcasts several vectors.
If we implement a broadcast wrapper I would rather do it for the general
case of a vector. This raises an observation about message-passing
programming: in general it is better to have fewer, large messages than
more, small ones since latency is a considerable factor in initiating
As a result, you may come across weird, non-obvious hacks. Say I want to
compute a global min and max of scalar values...
This would work
MPI_Allreduce (my_min, global_min, ..., MPI_MIN)
MPI_Allreduce (my_max, global_max, ..., MPI_MAX)
But this will perform better:
MPI_Allreduce ([-my_min my_max], [global_min, global_max], ..., MPI_MAX);
global_min = -global_min;
On 9/26/07 1:40 PM, "Bin" <xubinbin2004@...> wrote:
> In my codes, I have to broadcast a scalar value to all the processors in
> order to form the scaled element stiffness matrix. Can you tell me how to do
> it in libmesh? Is there any build-in function in libmesh which can do it?
> Thank you.