From: Benjamin K. <ben...@na...> - 2007-09-27 12:44:26
|
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: http://libmesh.sourceforge.net/doxygen/mesh__communication_8C-source.php 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 communication. 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; -Ben On 9/26/07 1:40 PM, "Bin" <xub...@gm...> wrote: > Hi, > > 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. |