1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
#include "Bdef.h"
#if (INTFACE == C_CALL)
void Cdtrsd2d(Int ConTxt, char *uplo, char *diag, Int m, Int n, double *A,
Int lda, Int rdest, Int cdest)
#else
F_VOID_FUNC dtrsd2d_(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 precision 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 precision 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, "DTRSD2D", '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, &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=BI_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 dtrsd2d */
|