You could use MPI_Comm_disconnect. The description is in the 3.1 standard p. 398:

This function waits for all pending communication on comm to complete internally, deallocates the communicator object, and sets the handle to MPI_COMM_NULL. It is a collective operation. 


If you disconnect the communicator from MPI_Comm_get_parent before you call MPI_Finalize and the spawning processes do the same, you should synchronize around the disconnect.

On Feb 17, 2017, at 7:58 AM, Dorier, Matthieu <mdorier@anl.gov> wrote:

Hi,

If I have an application that calls MPI_Comm_spawn, is there a way to make the parent "wait" for the child application to have called MPI_Finalize (or terminated), at some point? The rational would be that MPI_Comm_spawn is sort of an MPI equivalent of "fork/execv", but I don't see an equivalent of "wait", in the standard. My feeling is that once a child application is spawned, it is supposed to stay alive until the parent calls MPI_Finalize as well. Am I mistaken?

Thanks,

Matthieu
_______________________________________________
discuss mailing list     discuss@mpich.org
To manage subscription options or unsubscribe:
https://lists.mpich.org/mailman/listinfo/discuss