[Trilinos-Users] Epetra_MpiComm.Barrier() does not seem to work?

Matt G mgoodman at email.arizona.edu
Sat Jun 25 16:08:15 MDT 2011


If you add the time (and other information) into the print statements, you
will see that it is out of order, but properly serial in actual execution.
 There is a simple way to do that through most mpirun commands, but the
syntax depends on the flavor you are running.

Enjoy
--Matthew Goodman

=====================
Check Out My Website: http://craneium.net
Find me on LinkedIn: http://tinyurl.com/d6wlch



On Sat, Jun 25, 2011 at 10:03 AM, Heroux, Mike <MHeroux at csbsju.edu> wrote:

> Jack,
>
> Generally speaking, output does not respect communication barriers.  There
> are functions in Teuchos that serialize output, and might do what you want.
> Another approach is to send all output to a single process that is in
> charge
> of output.  However, these approaches are not scalable, so you need to be
> careful.
>
> I hope this helps.
>
> Mike
>
>
> On 6/24/11 2:25 PM, "Jack Chessa" <jfchessa at utep.edu> wrote:
>
> > Hello,  I am having issues (I believe) with the
> > Epetra_MpiComm.Barrier() member.  When I execute the following code
> > with three processors
> >
> > #ifdef HAVE_MPI
> > #include "mpi.h"
> > #include "Epetra_MpiComm.h"
> > #else
> > #include "Epetra_SerialComm.h"
> > #endif
> >
> >
> > int main(int argc, char* argv[])
> > {
> >
> > #ifdef HAVE_MPI
> > MPI_Init(&argc, &argv);
> > Epetra_MpiComm MyComm(MPI_COMM_WORLD);
> > #else
> > Epetra_SerialComm MyComm;
> > #endif
> >
> > if ( MyComm.MyPID()==0 )
> > std::cout << "\nHi there from processor " << MyComm.MyPID() << endl;
> >
> > if ( MyComm.MyPID()==1 )
> > std::cout << "\nHi there from processor " << MyComm.MyPID() << endl;
> >
> > if ( MyComm.MyPID()==2 )
> > std::cout << "\nHi there from processor " << MyComm.MyPID() << endl;
> >
> >
> >
> > MyComm.Barrier();
> >
> > if ( MyComm.MyPID()==0 )
> > std::cout << "\nfrom processor " << MyComm.MyPID() << endl;
> >
> > MyComm.Barrier();
> >
> > if ( MyComm.MyPID()==1 )
> > std::cout << "\nfrom processor " << MyComm.MyPID() << endl;
> >
> > MyComm.Barrier();
> >
> > if ( MyComm.MyPID()==2 )
> > std::cout << "\nfrom processor " << MyComm.MyPID() << endl;
> >
> > return 0;
> > }
> >
> > //------------------
> > I tend to get something as follows; that seems to indicate that the
> > barrier is being ignored.  Is there some trick I am missing?
> >
> > [jfchessa at virgo2 examples]$ mpirun -np 3 barrier_test
> >
> > Hi there from processor 1
> >
> > Hi there from processor 2
> >
> > Hi there from processor 0
> >
> > from processor 1
> >
> > from processor 2
> >
> > from processor 0
> >
> > Thanks for any information
> > Jack
> >
> >
> > Jack Chessa
> > Associate Professor
> > Mechancial Engineering
> > The University of Texas at El Paso
> > Voice: (915) 747-6900
> > Fax: (915) 747-5019
> > Email: jfchessa at utep.edu
> >
> >
> >
> >
> > _______________________________________________
> > Trilinos-Users mailing list
> > Trilinos-Users at software.sandia.gov
> > http://software.sandia.gov/mailman/listinfo/trilinos-users
> >
>
>
>
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
> http://software.sandia.gov/mailman/listinfo/trilinos-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20110625/7c55afcc/attachment.html 


More information about the Trilinos-Users mailing list