MPI question

Julian julvar at
Sun Oct 15 21:15:14 CDT 2006

I am using petsc in my fem program on the supercomputer we have here at
texas a&m univ. I configured petsc to build the libraries with mpi. 
So, I ran  'mpirun -np 2 /home/j0v1008/bin/alphampi a.alpha' in order to use
2 processors.
Till the point where petsc is initialized, everything looks normal. From the
point petsc in initialized, I get duplicates of everything that is written
to cout (at the very least, maybe it's doing duplicates of other things as
I understand that all the petsc functions might be called twice or so
depending on how it parallelizes, but I don't understand why it executes
lines that are outside of the petsc world, that have nothing to do with mpi.

Maybe this would clear things up:

void main()
Cout << "line1"
//insert code to initialize mpi
Cout << "line2"
Cout << "line3"
//insert code to finalizeMPI

Say I run this program with 2 processors, will "line2" be printed twice ? If
yes, can you explain why it does that when I didn't ask for that line to be
If no, then why is my fea program behaving so?


More information about the petsc-users mailing list