Is the following a standards-conformant MPI-3 C program?

#include <mpi.h>
int main(int argc, char** argv)
  int dlocalouter=1, dglobalouter=0, dlocalinner=1, dglobalinner=0;
  MPI_Request router, rinner;
  return 0;
  • 2
    $\begingroup$ Without having tried it myself, that should work. What problem are you having? $\endgroup$
    – Bill Barth
    Apr 21, 2015 at 14:54
  • 1
    $\begingroup$ The second MPI_Wait does not return using one MPI implementation, yet the code runs as expected with a different implementation, so I was curious whether the of code above might not be guaranteed to work by the standard, or if I should start looking for other reasons for the difference. $\endgroup$ Apr 21, 2015 at 16:07
  • 3
    $\begingroup$ Sounds like you might have found a bug. MPI-3 is relatively new, and I suspect all the bugs haven't been worked out in all the libraries. I say contact the developers of the one that doesn't return. $\endgroup$
    – Bill Barth
    Apr 21, 2015 at 16:12
  • $\begingroup$ You should probably initialize the accumulators dglobalouter and dglobalinner. It probably doesn't affect the ability of the code to run to completion, but it will affect the answer. Also, you should grab ierr and check it from each MPI call. Most stacks abort on error by default, but who knows what you've got there. $\endgroup$
    – Bill Barth
    Apr 21, 2015 at 16:14
  • $\begingroup$ I will try with the initialization. I actually had checks on ierr in there but took them out to make this post more concise! $\endgroup$ Apr 21, 2015 at 16:17

1 Answer 1



The reason I asked was that with a particular implementation (cray-mpich 7.0.4), in a particular environment on a particular system, the second MPI_Wait call would not return. This was likely due to a bug somewhere in the MPI library or a dependent communication library, and was remedied by upgrading to a newer version of the MPI implementation (cray-mpich 7.1.1).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.