Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] printing text fixes a problem?
From: David Zhang (solarbikedz_at_[hidden])
Date: 2011-02-01 03:57:24

According to the mpi_finalize documentation, a call to mpi_finalize
terminate all processes. I have ran into this problem before where one
process calls mpi_finalize before other processes reach the same line of
code and cause errors/hang ups. Put a mpi_barrier(mpi_comm_world) before
mpi_finalize would do the trick.

On Mon, Jan 31, 2011 at 11:40 PM, abc def <cannonjunk_at_[hidden]> wrote:

> Hello,
> I'm having trouble with some MPI programming in Fortran, using openmpi.
> It seems that my program doesn't work unless I print some unrelated text to
> the screen. For example, if I have this situation:
> *** hundreds of lines cut ***
> IF (irank .eq. 0) THEN
> CALL print_results1(variable)
> CALL print_results2(more_variable)
> print *, "done", irank
> END PROGRAM calculation
> The results are not printed unless I include this "print done irank"
> penultimate line.
> Also, despite seeing that all ranks reach the print statement, the program
> hangs, as if they have not all reached MPI_FINALIZE.
> Can anyone help me? Why does it do this?
> I also had many times where the program would crash if I didn't include a
> print statement in a loop. I've been doing Fortran programming for a while,
> and this is my nightmare debugging scenario since I've never been able to
> figure out why the simple printing of statements magically fixes the
> program, and I usually end up having to go back to a serial solution, which
> is really slow.
> If anyone might be able to help me, I would be really really grateful!!
> Thank you.
> Tom
> _______________________________________________
> users mailing list
> users_at_[hidden]

David Zhang
University of California, San Diego