Thanks Berend and Matt, I'm gonna take a look at that book... Luckily, they have an e-book version through our library!
Julian. > -----Original Message----- > From: owner-petsc-users at mcs.anl.gov > [mailto:owner-petsc-users at mcs.anl.gov] On Behalf Of Berend van Wachem > Sent: Monday, October 16, 2006 1:35 AM > To: petsc-users at mcs.anl.gov > Subject: Re: MPI question > > Hi Julian, > > I am not affiliated to the petsc-team, but have been using > petsc a number of years. > The idea of MPI is that your whole program get executed on > each processor. So getting output twice on each processor is > quite normal. So not only PETSC functions are called by each > processor, every command you write will be called by each > processor. Because variables have different values upon each > processor, you can imply slightly different behaviour, or > have each processor work on an own data set. > > If you want output, I recommend you to use the PETSC > functions for IO: > PetscPrintf, or PetscSynchronizedPrintf. > > I found it helpful to read an introduction to MPI, "Using > MPI" by Gropp, Lusk, Skjellum. > > Good luck, > > Berend. > > > 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? > > If no, then why is my fea program behaving so? > > > > Thanks, > > Julian. > > >
