I would suggest that if C receives some kind of quit command, it
should send that command to both A & B, and then call MPI_Finalize.
When A & B receive the quit command, they can complete whatever they
are currently doing (you'll have to set a flag so they know they
should do this), and then also call MPI_Finalize.
There is a barrier in MPI_Finalize, so nobody will actually terminate
until everyone gets there.
On Feb 22, 2009, at 8:49 PM, Tee Wen Kai wrote:
> I have three processes A,B & C. A will receive some data and process
> and after that will pass results to B. Thereafter, A will go back to
> get data and process and prepare to send them to B again. Same goes
> for B to C where C will provide the final output. As all the
> processes are running asynchronously, I can't find a method to quit
> all processes gracefully. I have tried to use C to issue MPI_Abort
> when quit command is received with processes A and B entering the
> SIGTERM handler to free all the allocated memories. However, the
> processes may be in the midst of a communication when SIGTERM signal
> is raise, resulting in some error msg like "remote connection close"
> etc. To prevent such error messages from displaying, I couldn't use
> I seek your advice on methods to quit asynchonous processes properly
> without all these error messages. And I would also like to find out
> what will be the outcome eventually if I don't close the processes
> with an MPI_Finalize command, will it lead to eventual memory leak
> Thank you very much.
> Get your preferred Email name!
> Now you can @ymail.com and
> users mailing list