All nonblocking calls in MPI return a request handle in lieu of a status variable. The purpose of the handle is to let you check on the status of your message at a later time. In MPI, the status variable becomes defined only after your message data is ready.

You can think of the request handle as being like a numbered ticket at a fast-food restaurant: you take a number so that you don't have to keep waiting in line for your food. In this analogy, the request handle is like your numbered ticket; it allows you to check back from time to time to see if the message data (your food) is ready.

A fast-food restaurant usually asks its customers to give up their numbered tickets in exchange for their food. Likewise, MPI wants every nonblocking call to be matched with a completion. That way, unclaimed messages don't pile up, and the request handles can be recycled. In fact, in an MPI program, if you don't match every nonblocking call with a follow-up call to a completion function, then MPI may eventually run out of handles, which will cause your program to crash.

MPI provides three functions to complete a nonblocking communication call. Turning once again to our restaurant analogy, here are the actions at the imaginary service counter that correspond to each function:

  • MPI_Test - You go to the counter ask the guy if your order number is ready. (If it isn't, then you can go back to your table and talk some more with your friends.)
  • MPI_Wait - You hang around the counter until your order number is definitely ready. (Maybe your friends won't talk to you until you bring them some food!)
  • MPI_Request_free - You turn in your order number without learning the status of your food. (Perhaps you've canceled your order; or perhaps the order is obviously ready and you already know what's in it, so you can just grab it without further checking.)

The next section covers all three MPI functions in depth.

 
©   Cornell University  |  Center for Advanced Computing  |  Copyright Statement  |  Inclusivity Statement