[MPICH] ensuring progress .... Get_status vs. Test

Harrison, Robert J. harrisonrj at ornl.gov
Fri Jan 19 10:18:10 CST 2007


With mpich2-1.0.3 on Cygwin I am finding that calling 
Get_status() does not make progress on non-blocking 
operations whereas Test() does.  An example program
is provided below.

Could a kind reader let me know if this is an error
in my example, or if the behaviour is MPI draft-standard 
compliant, or just a feature of the current implementation?

Thanks and best wishes to all,

  Robert


Robert J. Harrison - (865) 274-8544


#include <mpi.h>
#include <iostream>

using namespace std;

int main(int argc, char** argv) {
    MPI::Init(argc, argv);
    int np = MPI::COMM_WORLD.Get_size();
    if (np != 2) throw "2 only";
    
    int me = MPI::COMM_WORLD.Get_rank();
    int other = me? 0 : 1;

    int a=0, b=-1;
    MPI::Request rsend = MPI::COMM_WORLD.Isend(&a, sizeof(a), MPI::BYTE,
other, 1);
    MPI::Request rrecv = MPI::COMM_WORLD.Irecv(&b, sizeof(b), MPI::BYTE,
other, 1);

    MPI::Status status;

    while (!rsend.Get_status(status));
    while (!rrecv.Get_status(status));
    rsend.Test(status);
    rrecv.Test(status);
    
    //while (!rsend.Test(status)) ;
    //while (!rrecv.Test(status)) ;

    cout << me << " got " << b << endl;

    MPI::Finalize();
    return 0;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Harrison, Robert J..vcf
Type: text/x-vcard
Size: 392 bytes
Desc: Harrison, Robert J..vcf
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20070119/88f21129/attachment.vcf>


More information about the mpich-discuss mailing list