While trying error-related functionality of OMPI, I came across a situation where when I use MPI_ERRORS_RETURN error handler, the errors do not come out correctly from WAIT calls.

The program below correctly terminates with a fatal “message truncated” error, but when the line setting the error handler to MPI_ERRORS_RETURN is uncommented, it silently completes. I expected the print out that checks the status after WAIT call to be executed, but it wasn’t.

The issue didn’t happen when using blocking recv.


A bug or my incorrect usage?




// mpic++ -o test test.cpp

// mpirun -np2 ./test

#include "mpi.h"

#include <iostream>

using namespace std;


int main (int argc, char *argv[])


    int rank;

    char buf[100] = "hmmmm";

    MPI::Status stat;


    MPI::Init(argc, argv);

    rank = MPI::COMM_WORLD.Get_rank();


//    MPI::COMM_WORLD.Set_errhandler(MPI::ERRORS_RETURN);


    if (rank == 0)


        MPI::Request r = MPI::COMM_WORLD.Irecv(buf, 1, MPI_CHAR, MPI::ANY_SOURCE, MPI::ANY_TAG);


        if (stat.Get_error() != MPI::SUCCESS)


            cout << "0: Error during recv" << endl;





        MPI::COMM_WORLD.Send(buf, 2, MPI_CHAR, 0, 0);




    return (0);




Jacob M. Katz | jacob.katz@intel.com | Work: +972-4-865-5726 | iNet: (8)-465-5726


Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.