Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] RFC: assert() to ensure OBJ_CONSTRUCT'ed objects don't get destroyed
From: Jeff Squyres (jsquyres) (jsquyres_at_[hidden])
Date: 2013-03-08 10:38:42

On Mar 8, 2013, at 10:20 AM, George Bosilca <bosilca_at_[hidden]> wrote:

>> If the app REQUEST_FREE'd a nonblocking send/receive, don't we block in ompi_mpi_finalize() before the call to pml_base_close(), such that the PMLs will be drained before we get to destroying the PMLs?
> We don't, as we have no way of knowing there are pending requests in the pipeline. There is a separation between who create the requests and who release them. They are created by the selected PML, and are destroyed by the base, after the selected PML has been turned off.

Here's an interesting case -- do you think that this is a valid MPI application? And if it is, what is the expected behavior?

#include <stdio.h>
#include <mpi.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>

#define SIZE 33554432

int main(int argc, char *argv[])
    int i, rank;
    char *buf;
    MPI_Request req;

    MPI_Init(NULL, NULL);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);

    buf = malloc(SIZE);
    memset(buf, rank, SIZE);
    if (0 == rank) {
        MPI_Isend(buf, SIZE, MPI_CHAR, 1, 123, MPI_COMM_WORLD, &req);
    } else if (1 == rank) {
        MPI_Irecv(buf, SIZE, MPI_CHAR, 0, 123, MPI_COMM_WORLD, &req);


    if (1 == rank) {
        for (i = 0; i < SIZE; ++i) {
            assert(1 == buf[i]);

    return 0;

On the SVN trunk, this application will fail the assert(1 == buf[i]).

MPI-3 p360 shows a *similar* case, but it's not exactly the same (example 8.7 shows Request_free one *one* side, not *both* sides).

Jeff Squyres
For corporate legal information go to: