[Trilinos-Users] Printing Objects Causes Hangs

Michael A Heroux maherou at sandia.gov
Sun Sep 4 21:51:02 MDT 2005


Ammar,

The use of "cout <<" with Epetra distributed objects requires all processors
to participate in the operation, even if some have no elements of the
object.  If you move the "cout << x;" statement outside the if block, then
this code should work.  In fact, you can remove the if statement altogether
since the Random() method will work just fine without it.

Mike

> -----Original Message-----
> From: trilinos-users-bounces at software.sandia.gov 
> [mailto:trilinos-users-bounces at software.sandia.gov] On Behalf 
> Of Ammar T. Al-Sayegh
> Sent: Saturday, September 03, 2005 9:35 PM
> To: trilinos-users at software.sandia.gov
> Subject: [Trilinos-Users] Printing Objects Causes Hangs
> 
> Hi All,
> 
> When I try to print objects to standard output from a single 
> processor, the program hangs. Consider the following code 
> with two processors, for example:
> 
>     // create the map. all global elements are in P0
>     int nge = 0;
>     if(Comm.MyPID() == 0)
>         nge = 4;
>     Epetra_Map Map(-1, nge, 0, Comm);
> 
>     // create the vector, populate it, and print it from P0
>     Epetra_Vector x(Map);
>     if(Comm.MyPID() == 0)
>     {
>         x.Random();
>         cout << x;
>     }
> 
> The program hangs after printing x to standard output as P1 
> terminates successfully while P0 doesn't terminate. Anyone 
> experienced the same problem? How can it be resolved?
> 
> Thanks.
> 
> 
> -ammar
> 
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
> http://software.sandia.gov/mailman/listinfo/trilinos-users
> 




More information about the Trilinos-Users mailing list