F_VOID_FUNC ztrsd2d_(int *ConTxt, F_CHAR uplo, F_CHAR diag, int *m, int *n, double *A, int *lda, int *rdest, int *cdest) #endif /* * -- V1.1 BLACS routine -- * University of Tennessee, May 1, 1996 * Written by Clint Whaley. * * Purpose * ======= * Locally-blocking point-to-point trapezoidal double complex send. * * Arguments * ========= * * ConTxt (input) Ptr to int * Index into MyConTxts00 (my contexts array). * * UPLO (input) Ptr to char * Specifies the part of the matrix to be sent. * = 'U': Upper trapezoidal part * ELSE : Lower trapezoidal part * * DIAG (input) Ptr to char * Specifies whether the matrix is unit diagonal or not. * = 'U': Matrix is unit diagonal, diagonal not communicated. * ELSE : Matrix is not unit diagonal, diagonal is communicated. * * M (input) Ptr to int * The number of rows of the matrix A. M >= 0. * * N (input) Ptr to int * The number of columns of the matrix A. N >= 0. * * A (input) Ptr to double complex two dimensional array * The m by n matrix A. Fortran77 (column-major) storage * assumed. * If UPLO = 'U', only the upper trapezoid is accessed; * if UPLO = 'L', only the lower trapezoid is accessed. * * LDA (input) Ptr to int * The leading dimension of the array A. LDA >= M. * * RDEST (input) Ptr to int * The process row of the destination process. * * CDEST (input) Ptr to int * The process column of the destination process. * * ------------------------------------------------------------------------ */ { void BI_ArgCheck(int, int, char *, char, char, char, int, int, int, int, int *, int *); MPI_Datatype BI_GetMpiTrType(BLACSCONTEXT *, char, char, int, int, int, MPI_Datatype, int *); BLACBUFF *BI_Pack(BLACSCONTEXT *, BVOID *, BLACBUFF *, MPI_Datatype); void BI_Ssend(BLACSCONTEXT *, int, int, BLACBUFF *); void BI_Asend(BLACSCONTEXT *, int, int, BLACBUFF *); void BI_UpdateBuffs(BLACBUFF *); BLACBUFF *BI_GetBuff(int); int BI_BuffIsFree(BLACBUFF *, int); char tuplo, tdiag; int dest, length, tlda, ierr; BLACBUFF *bp; BLACSCONTEXT *ctxt; MPI_Datatype MatTyp; extern BLACBUFF BI_AuxBuff, *BI_ActiveQ; MGetConTxt(Mpval(ConTxt), ctxt); tuplo = F2C_CharTrans(uplo); tdiag = F2C_CharTrans(diag); tuplo = Mlowcase(tuplo); tdiag = Mlowcase(tdiag); #if (BlacsDebugLvl > 0) BI_ArgCheck(Mpval(ConTxt), RT_SD, "ZTRSD2D", 'a', tuplo, tdiag, Mpval(m), Mpval(n), Mpval(lda), 1, Mpaddress(rdest), Mpaddress(cdest)); #endif if (Mpval(lda) < Mpval(m)) tlda = Mpval(m); else tlda = Mpval(lda); dest = Mvkpnum(ctxt, Mpval(rdest), Mpval(cdest)); ctxt->scp = &ctxt->pscp; MatTyp = BI_GetMpiTrType(ctxt, tuplo, tdiag, Mpval(m), Mpval(n), tlda, MPI_DOUBLE_COMPLEX, &BI_AuxBuff.N); #ifdef SndIsLocBlk BI_AuxBuff.Buff = (char *) A; BI_AuxBuff.dtype = MatTyp; BI_Ssend(ctxt, dest, PT2PTID, &BI_AuxBuff); #else bp = BI_Pack(ctxt, (BVOID *) A, NULL, MatTyp); BI_Asend(ctxt, Mkpnum(ctxt, Mpval(rdest), Mpval(cdest)), PT2PTID, bp); #endif ierr=MPI_Type_free(&MatTyp); /* * Having started the async send, update the buffers (reform links, check if * active buffers have become inactive, etc.) */ #ifdef SndIsLocBlk if (BI_ActiveQ) BI_UpdateBuffs(NULL); #else BI_UpdateBuffs(bp); #endif } /* end of ztrsd2d */
void BI_MringComb(BLACSCONTEXT *ctxt, BLACBUFF *bp, BLACBUFF *bp2, int N, VVFUNPTR Xvvop, int dest, int nrings) { void BI_Ssend(BLACSCONTEXT *, int, int, BLACBUFF *); void BI_Srecv(BLACSCONTEXT *, int, int, BLACBUFF *); void BI_MpathBS(BLACSCONTEXT *, BLACBUFF *, SDRVPTR, int); void BI_MpathBR(BLACSCONTEXT *, BLACBUFF *, SDRVPTR, int, int); int Np, Iam, msgid, i, inc, mysrc, mydest, Np_1; int mydist, ringlen, myring; int nearedge, faredge; /* edge closest and farthest from dest */ int REBS; /* Is result leave-on-all? */ Np = ctxt->scp->Np; if (Np < 2) return; Iam = ctxt->scp->Iam; msgid = Mscopeid(ctxt); //WCC if (REBS = (dest == -1)) dest = 0; if ((REBS = (dest == -1))) dest = 0; if (nrings > 0) { mydist = (Np + dest - Iam) % Np; inc = 1; } else { mydist = (Np + Iam - dest) % Np; inc = -1; nrings = -nrings; } Np_1 = Np - 1; if (nrings > Np_1) nrings = Np_1; /* * If I'm not the destination */ if (Iam != dest) { ringlen = Np_1 / nrings; myring = (mydist-1) / ringlen; if (myring >= nrings) myring = nrings - 1; nearedge = (myring*ringlen) + 1; faredge = nearedge + ringlen - 1; if (myring == nrings-1) faredge += Np_1 % nrings; if (mydist == nearedge) mydest = dest; else mydest = (Np + Iam + inc) % Np; if (mydist != faredge) { BI_Srecv(ctxt, (Np + Iam - inc) % Np, msgid, bp2); Xvvop(N, bp->Buff, bp2->Buff); } BI_Ssend(ctxt, mydest, msgid, bp); if (REBS) BI_MpathBR(ctxt, bp, BI_Ssend, dest, nrings); } /* * If I'm the destination process */ else { if (!ctxt->TopsRepeat) { for(i=nrings; i; i--) { BI_Srecv(ctxt, BANYNODE, msgid, bp2); Xvvop(N, bp->Buff, bp2->Buff); } } else { ringlen = Np_1 / nrings; if (inc == 1) mysrc = (Np + Iam - 1) % Np; else mysrc = (Iam + 1) % Np; for(i=nrings; i; i--) { BI_Srecv(ctxt, mysrc, msgid, bp2); Xvvop(N, bp->Buff, bp2->Buff); if (inc == 1) mysrc = (Np + mysrc - ringlen) % Np; else mysrc = (mysrc + ringlen) % Np; } } if (REBS) BI_MpathBS(ctxt, bp, BI_Ssend, nrings); } } /* end BI_MringComb */
F_VOID_FUNC igesd2d_(int *ConTxt, int *m, int *n, int *A, int *lda, int *rdest, int *cdest) #endif /* * -- V1.1 BLACS routine -- * University of Tennessee, May 1, 1996 * Written by Clint Whaley. * * Purpose * ======= * Locally-blocking point-to-point general integer send. * * Arguments * ========= * * ConTxt (input) Ptr to int * Index into MyConTxts00 (my contexts array). * * M (input) Ptr to int * The number of rows of the matrix A. M >= 0. * * N (input) Ptr to int * The number of columns of the matrix A. N >= 0. * * A (input) Ptr to integer two dimensional array * The m by n matrix A. Fortran77 (column-major) storage * assumed. * * LDA (input) Ptr to int * The leading dimension of the array A. LDA >= M. * * RDEST (input) Ptr to int * The process row of the destination process. * * CDEST (input) Ptr to int * The process column of the destination process. * * ------------------------------------------------------------------------ */ { void BI_ArgCheck(int, int, char *, char, char, char, int, int, int, int, int *, int *); MPI_Datatype BI_GetMpiGeType(BLACSCONTEXT *, int, int, int, MPI_Datatype, int *); BLACBUFF *BI_Pack(BLACSCONTEXT *, BVOID *, BLACBUFF *, MPI_Datatype); void BI_Ssend(BLACSCONTEXT *, int, int, BLACBUFF *); void BI_Asend(BLACSCONTEXT *, int, int, BLACBUFF *); void BI_UpdateBuffs(BLACBUFF *); BLACBUFF *BI_GetBuff(int); int BI_BuffIsFree(BLACBUFF *, int); int dest, tlda, ierr; BLACBUFF *bp; BLACSCONTEXT *ctxt; MPI_Datatype MatTyp; extern BLACBUFF BI_AuxBuff, *BI_ActiveQ; MGetConTxt(Mpval(ConTxt), ctxt); #if (BlacsDebugLvl > 0) BI_ArgCheck(Mpval(ConTxt), RT_SD, "IGESD2D", 'a', 'u', 'u', Mpval(m), Mpval(n), Mpval(lda), 1, Mpaddress(rdest), Mpaddress(cdest)); #endif if (Mpval(lda) < Mpval(m)) tlda = Mpval(m); else tlda = Mpval(lda); dest = Mvkpnum(ctxt, Mpval(rdest), Mpval(cdest)); ctxt->scp = &ctxt->pscp; MatTyp = BI_GetMpiGeType(ctxt, Mpval(m), Mpval(n), tlda, MPI_INT, &BI_AuxBuff.N); #ifdef SndIsLocBlk BI_AuxBuff.Buff = (char *) A; BI_AuxBuff.dtype = MatTyp; BI_Ssend(ctxt, dest, PT2PTID, &BI_AuxBuff); #else bp = BI_Pack(ctxt, (BVOID *) A, NULL, MatTyp); BI_Asend(ctxt, Mkpnum(ctxt, Mpval(rdest), Mpval(cdest)), PT2PTID, bp); #endif ierr=MPI_Type_free(&MatTyp); /* * Having started the async send, update the buffers (reform links, check if * active buffers have become inactive, etc.) */ #ifdef SndIsLocBlk if (BI_ActiveQ) BI_UpdateBuffs(NULL); #else BI_UpdateBuffs(bp); #endif } /* end of igesd2d */