MPI question
Matthew Knepley
knepley at gmail.com
Sun Oct 15 21:35:08 CDT 2006
On 10/15/06, Julian <julvar at tamu.edu> wrote:
>
> 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
> well).
> 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"
> MyfunctionusingMPI()
> 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
> parallelized?
Yes. MPI is an SPMD model. There are multiple running copies of the same
program. I suggest "Using MPI" by Gropp, et. al. for a better understading
of parallel code.
Matt
If no, then why is my fea program behaving so?
>
> Thanks,
> Julian.
>
>
--
"Failure has a thousand explanations. Success doesn't need one" -- Sir Alec
Guiness
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20061015/19bef6b3/attachment.htm>
More information about the petsc-users
mailing list