If you are hoping for a return on timeout, almost zero CPU use while waiting and fast response you will need to be pretty creative. Here is a simple solution that may be OK if you do not need both fast response and low CPU load.
flag = false;
for ( ; ! is_time_up(); )
MPI_Test( ........ &flag, ......);
if (flag) break;
Make the sleep short or leave it out and you hog CPU, make it long and your lag time for detecting a message that arrives after you enter the loop will average 1/2 the sleep plus a bit.
Dick Treumann - MPI Team
IBM Systems & Technology Group
Dept X2ZA / MS P963 -- 2455 South Road -- Poughkeepsie, NY 12601
Tele (845) 433-7846 Fax (845) 433-8363
firstname.lastname@example.org wrote on 12/04/2009 01:38:05 PM:
> [image removed]
> Re: [OMPI users] Mimicking timeout for MPI_Wait
> Jeff Squyres
> Open MPI Users
> 12/04/2009 01:38 PM
> Sent by:
> Please respond to Open MPI Users
> On Dec 3, 2009, at 3:31 AM, Katz, Jacob wrote:
> > I wonder if there is a BKM (efficient and portable) to mimic a
> timeout with a call to MPI_Wait, i.e. to interrupt it once a given
> time period has passed if it hasn’t returned by then yet.
> Pardon my ignorance, but what does BKM stand for?
> Open MPI does not currently implement a timeout-capable MPI_WAIT.
> Such functionality probably could be implemented (e.g., in the MPIX
> "experimental" namespace), especially since Open MPI polls for
> progress -- it could check a timer every so often while polling --
> but no one has done so.
> Jeff Squyres
> users mailing list