[Trilinos-Users] Implicit Barriers in Trilinos / Epetra

Chris Siefert csiefer at sandia.gov
Wed Oct 15 08:12:06 MDT 2014


Corey,

There is no race condition in the code you sent.  The Norm2 routine has 
an MPI_Allreduce, which is a blocking collective,
each MPI rank waits until every other MPI rank has finished the filling 
of x before the norm can be reported.

As for documentation as to which routines have communication (collective 
or otherwise), that should be documented in the
Trilinos Doxygen, but in many cases (e.g. Norm2) it is not.  This is an 
area we should improve in the future.

-Chris


On 10/14/2014 01:39 PM, Corey A. Henderson wrote:
> Hello,
>
> I am experimenting with Trilinos and doing the Epetra hands-on. I have 
> tried Google to learn if there is a reference indicating which methods 
> have implicit MPI Barriers.
>
> It seems obvious to me that there must be some, especially since no 
> barrier is suggested in lesson 2 here:
>
>     // Use local indices to access the entries of x_data.
>     const int localLength = x.MyLength ();
>     for (int localIndex = 0; localIndex < localLength; ++localIndex) {
>       // Add the value of the local index to every entry of x.
>       x[localIndex] += static_cast<double> (localIndex);
>     }
>
>     // Print the norm of x.
>     theNorm = 0.0;
>     (void) x.Norm2 (&theNorm);
>     out << "Norm of x (modified random numbers): " << theNorm << endl;
>
> It seems to me without a barrier before the Norm2 call (or in Norm2() 
> itself) we'd get unexpected results.
>
> Are these barriers documented somewhere that I can use as a reference?
>
> Thanks,
>
> Corey A. Henderson
> PhD Candidate / NSF Graduate Fellow
> Dept. of Engineering Physics
> Univ. of Wisconsin - Madison
>
>
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
> https://software.sandia.gov/mailman/listinfo/trilinos-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://software.sandia.gov/pipermail/trilinos-users/attachments/20141015/d35d487d/attachment.html>


More information about the Trilinos-Users mailing list