1 #include "Bdef.h"
2 
BI_Arecv(BLACSCONTEXT * ctxt,int src,int msgid,BLACBUFF * bp)3 void BI_Arecv(BLACSCONTEXT *ctxt, int src, int msgid, BLACBUFF *bp)
4 {
5    int i, info, errclass;
6 
7    BI_MPI_Irecv(bp->Buff, bp->N, bp->dtype, src, msgid, ctxt->scp->comm,
8                 &bp->Aops[bp->nAops], info);
9    while(info != BI_MPI_SUCCESS)
10    {
11       BI_MPI_Error_class(info, &errclass, i);
12       if ( (errclass != BI_MPI_ERR_UNKNOWN) && (errclass != BI_MPI_ERR_OTHER) &&
13            (errclass != BI_MPI_ERR_INTERN) )
14       {
15 	  Mmpierror(info, "MPI_Irecv", ctxt, __LINE__, __FILE__);
16 	  BI_BlacsErr(BI_ContxtNum(ctxt), __LINE__, __FILE__,
17 		      "MPI error %d on call to MPI_Irecv", info);
18       }
19 #if (BlacsDebugLvl > 0)
20       else BI_BlacsWarn(BI_ContxtNum(ctxt), __LINE__, __FILE__,
21 "MPI error %d assumed to mean out of non-blocking resources on call to MPI_Irecv",
22                      info);
23 #endif
24       BI_MPI_Irecv(bp->Buff, bp->N, bp->dtype, src, msgid, ctxt->scp->comm,
25                    &bp->Aops[bp->nAops], info);
26    }
27    bp->nAops++;
28 /*
29  * Signal if we need to use status to figure out true length of received message
30  * We only need do this if we are doing our own buffering
31  */
32 #ifndef MpiBuffGood
33    if (bp->dtype == BI_MPI_PACKED) bp->N = -bp->nAops;
34 #endif
35 }
36