reset password
Author Message
mvalenc3
Posts: 4
Posted 10:46 Nov 03, 2011 |

Anything before MPI_Rank() or after MPI_Finalize() gets repeated. I thought that any output statements before the MPI_Rank() or after MPI_Finalize() would only be output once. Am i missing something?

Redalb
Posts: 22
Posted 11:21 Nov 03, 2011 |

Here's my understanding of this.

I think you have it backwards. MPI_Rank() will create the new processes, anything after that line is run by all the nodes. MPI_Finalize() waits for the nodes to finish, anything after that line is run by node 0 only. 

mvalenc3
Posts: 4
Posted 12:01 Nov 03, 2011 |

That was my understanding but when i do that in code everything gets repeated(unless a function is in an if statement).

aortega
Posts: 4
Posted 12:19 Nov 03, 2011 |

See:

http://www.mcs.anl.gov/research/projects/mpi/www/www3/MPI_Finalize.html

The behavior after a call to MPI_Finalize is undefined. It cleans up the MPI environment, but processes may or may not continue running after a call to it. It's best to put as little code as possible after a call to MPI_Finalize due to this undefined behavior.