What happens when I MPI_Send to a terminated process?

What happens when I MPI_Send for a terminated process?

I am studying MPI and writing a small simulation of the distribution of sugar in C. When factories stop production, these processes are over. When the warehouses are empty, they run out. Can I somehow find out if the store order to the warehouse failed (because the warehouse process ended) by looking at the return value MPI_Send? The documentation doesn't mention a specific error code for this situation, but there is no error for success.

Is it possible:

if (MPI_Send(...)) {
    ...
    /* destination has ended */
    ...
}

      

And ignore the error code?

thanks

+2


a source to share


2 answers


Recording code with unmatched calls to MPI_Send is not permitted by the standard. Among other things, this means that the resulting behavior will be implementation-dependent. The range of possible behaviors includes several "obvious" options: exit, hang / deadlock, memory corruption, etc.

Most implementations have some level of debug output that can be helpful in tracking down such a logic programming error. You can use MPI_Wait * to protect against all MPI_Send / MPI_Recv pairs. In general, it is impossible to know that MPI_Send will not match until the recving node goes into MPI_Finalize. On the other hand, using a barrier in this state will freeze the program.



This will be an error condition for MPI_Finalize anyway. The destination rank for MPI_Send must be detected as complete ... so MPI_Send can never be matched. However, this error condition can result in the MPI job being unable to clean up all ranked processes.

+1


a source


As far as I know, the MPI standard does not define the return value and does not output parameters for MPI_Send (): it does not provide any information about the message sending event, perhaps because message buffering can make it so that no information is available on the result during the call ...

If you want one process to see when another finishes, you have to send a message from the finishing process with the specified tag and in front of me send notblocking receives in another process to see if the exit notification has been sent.



Or, if you want the entire program to be interrupted when one process stops, the easiest way is to simply call MPI_Abort () during the finalization process with MPI_COMM_WORLD as the communicator, which is guaranteed to kill all processes.

Edit. To answer the question in the title: "What happens when I MPI_Send to a terminated process?": As I understand it, it depends on whether buffering is used or not. If buffering is not used, the program will hang. If buffering is used, MPI_Send () will buffer the message and the process will continue to execute, but since no matching receive will ever be posted, the message will never leave the buffer. As a result, this will cause the program to run out of memory.

0


a source







All Articles