SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ BI_Pack()

BLACBUFF * BI_Pack ( BLACSCONTEXT ctxt,
BVOID A,
BLACBUFF bp,
MPI_Datatype  Dtype 
)

Definition at line 2 of file BI_Pack.c.

3{
5 MpiInt i, info, one=1;
6 MPI_Aint eltsiz;
7#ifdef ZeroByteTypeBug
8 char *cptr;
9 extern BLACBUFF BI_AuxBuff;
10 extern Int BI_Np;
11#endif
12
13/*
14 * Some versions of mpich and its derivitives cannot handle 0 byte typedefs,
15 * so we have set MPI_BYTE as a flag for a 0 byte message
16 */
17#ifdef ZeroByteTypeBug
18 if (Dtype == MPI_BYTE)
19 {
20 info = sizeof(BLACBUFF);
21 if (info % sizeof(MPI_Request))
22 info += sizeof(MPI_Request) - info % sizeof(MPI_Request);
23 i = info + BI_Np*sizeof(MPI_Request);
24 if (i % BUFFALIGN) i += BUFFALIGN - i % BUFFALIGN;
25 cptr = malloc(i);
26 if (cptr)
27 {
28 bp = (BLACBUFF *) cptr;
29 bp->Len = bp->N = bp->nAops = 0;
30 bp->Aops = (MPI_Request *) &cptr[info];
31 bp->Buff = (char *) &bp->Len;
32 bp->dtype = MPI_BYTE;
33 return(bp);
34 }
35 else BI_BlacsErr(BI_ContxtNum(ctxt), __LINE__, __FILE__,
36 "Not enough memory to allocate 0 byte buffer\n");
37 }
38#endif
39 if (bp == NULL)
40 {
41 info=MPI_Pack_size(one, Dtype, ctxt->scp->comm, &i);
42 bp = BI_GetBuff(i);
43 }
44
45 i = 0;
46 info=MPI_Pack(A, one, Dtype, bp->Buff, bp->Len, &i, ctxt->scp->comm);
47 bp->dtype = MPI_PACKED;
48 bp->N = i;
49
50 return(bp);
51}
BLACBUFF * BI_GetBuff(Int length)
Definition BI_GetBuff.c:37
Int BI_Np
BLACBUFF BI_AuxBuff
#define Int
Definition Bconfig.h:22
#define MpiInt
Definition Bconfig.h:25
void BI_BlacsErr(Int ConTxt, Int line, char *file, char *form,...)
Definition BI_BlacsErr.c:3
struct bLaCbUfF BLACBUFF
Definition Bdef.h:53
Int BI_ContxtNum(BLACSCONTEXT *ctxt)
Definition BI_ContxtNum.c:3
#define BUFFALIGN
Definition Bdef.h:75
Int Len
Definition Bdef.h:57
Int N
Definition Bdef.h:61
MPI_Request * Aops
Definition Bdef.h:59
MPI_Datatype dtype
Definition Bdef.h:60
Int nAops
Definition Bdef.h:58
char * Buff
Definition Bdef.h:56
BLACSSCOPE * scp
Definition Bdef.h:26
MPI_Comm comm
Definition Bdef.h:15
Here is the call graph for this function:
Here is the caller graph for this function: