ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
ztrsd2d_.c
Go to the documentation of this file.
1 #include "Bdef.h"
2 
3 #if (INTFACE == C_CALL)
4 void Cztrsd2d(int ConTxt, char *uplo, char *diag, int m, int n, double *A,
5  int lda, int rdest, int cdest)
6 #else
7 F_VOID_FUNC ztrsd2d_(int *ConTxt, F_CHAR uplo, F_CHAR diag, int *m, int *n,
8  double *A, int *lda, int *rdest, int *cdest)
9 #endif
10 /*
11  * -- V1.1 BLACS routine --
12  * University of Tennessee, May 1, 1996
13  * Written by Clint Whaley.
14  *
15  * Purpose
16  * =======
17  * Locally-blocking point-to-point trapezoidal double complex send.
18  *
19  * Arguments
20  * =========
21  *
22  * ConTxt (input) Ptr to int
23  * Index into MyConTxts00 (my contexts array).
24  *
25  * UPLO (input) Ptr to char
26  * Specifies the part of the matrix to be sent.
27  * = 'U': Upper trapezoidal part
28  * ELSE : Lower trapezoidal part
29  *
30  * DIAG (input) Ptr to char
31  * Specifies whether the matrix is unit diagonal or not.
32  * = 'U': Matrix is unit diagonal, diagonal not communicated.
33  * ELSE : Matrix is not unit diagonal, diagonal is communicated.
34  *
35  * M (input) Ptr to int
36  * The number of rows of the matrix A. M >= 0.
37  *
38  * N (input) Ptr to int
39  * The number of columns of the matrix A. N >= 0.
40  *
41  * A (input) Ptr to double complex two dimensional array
42  * The m by n matrix A. Fortran77 (column-major) storage
43  * assumed.
44  * If UPLO = 'U', only the upper trapezoid is accessed;
45  * if UPLO = 'L', only the lower trapezoid is accessed.
46  *
47  * LDA (input) Ptr to int
48  * The leading dimension of the array A. LDA >= M.
49  *
50  * RDEST (input) Ptr to int
51  * The process row of the destination process.
52  *
53  * CDEST (input) Ptr to int
54  * The process column of the destination process.
55  *
56  * ------------------------------------------------------------------------
57  */
58 {
59  void BI_ArgCheck(int, int, char *, char, char, char, int, int, int, int,
60  int *, int *);
61  MPI_Datatype BI_GetMpiTrType(BLACSCONTEXT *, char, char, int, int, int,
62  MPI_Datatype, int *);
63  BLACBUFF *BI_Pack(BLACSCONTEXT *, BVOID *, BLACBUFF *, MPI_Datatype);
64  void BI_Ssend(BLACSCONTEXT *, int, int, BLACBUFF *);
65  void BI_Asend(BLACSCONTEXT *, int, int, BLACBUFF *);
66  void BI_UpdateBuffs(BLACBUFF *);
67  BLACBUFF *BI_GetBuff(int);
68  int BI_BuffIsFree(BLACBUFF *, int);
69 
70  char tuplo, tdiag;
71  int dest, length, tlda, ierr;
72  BLACBUFF *bp;
73  BLACSCONTEXT *ctxt;
74  MPI_Datatype MatTyp;
76 
77  MGetConTxt(Mpval(ConTxt), ctxt);
78  tuplo = F2C_CharTrans(uplo);
79  tdiag = F2C_CharTrans(diag);
80  tuplo = Mlowcase(tuplo);
81  tdiag = Mlowcase(tdiag);
82 
83 #if (BlacsDebugLvl > 0)
84  BI_ArgCheck(Mpval(ConTxt), RT_SD, "ZTRSD2D", 'a', tuplo, tdiag, Mpval(m),
85  Mpval(n), Mpval(lda), 1, Mpaddress(rdest), Mpaddress(cdest));
86 #endif
87  if (Mpval(lda) < Mpval(m)) tlda = Mpval(m);
88  else tlda = Mpval(lda);
89  dest = Mvkpnum(ctxt, Mpval(rdest), Mpval(cdest));
90  ctxt->scp = &ctxt->pscp;
91 
92  MatTyp = BI_GetMpiTrType(ctxt, tuplo, tdiag, Mpval(m), Mpval(n), tlda,
93  MPI_DOUBLE_COMPLEX, &BI_AuxBuff.N);
94 #ifdef SndIsLocBlk
95  BI_AuxBuff.Buff = (char *) A;
96  BI_AuxBuff.dtype = MatTyp;
97  BI_Ssend(ctxt, dest, PT2PTID, &BI_AuxBuff);
98 #else
99  bp = BI_Pack(ctxt, (BVOID *) A, NULL, MatTyp);
100  BI_Asend(ctxt, Mkpnum(ctxt, Mpval(rdest), Mpval(cdest)), PT2PTID, bp);
101 #endif
102  ierr=BI_MPI_TYPE_FREE(&MatTyp);
103 
104 /*
105  * Having started the async send, update the buffers (reform links, check if
106  * active buffers have become inactive, etc.)
107  */
108 #ifdef SndIsLocBlk
109  if (BI_ActiveQ) BI_UpdateBuffs(NULL);
110 #else
111  BI_UpdateBuffs(bp);
112 #endif
113 } /* end of ztrsd2d */
BI_Pack
BLACBUFF * BI_Pack(BLACSCONTEXT *ctxt, BVOID *A, BLACBUFF *bp, MPI_Datatype Dtype)
Definition: BI_Pack.c:2
BI_GetBuff
BLACBUFF * BI_GetBuff(int length)
Definition: BI_GetBuff.c:36
bLaCbUfF::Buff
char * Buff
Definition: Bdef.h:56
BI_GetMpiTrType
MPI_Datatype BI_GetMpiTrType(BLACSCONTEXT *ctxt, char uplo, char diag, int m, int n, int lda, MPI_Datatype Dtype, int *N)
Definition: BI_GetMpiTrType.c:4
Cztrsd2d
void Cztrsd2d()
BI_Asend
void BI_Asend(BLACSCONTEXT *ctxt, int dest, int msgid, BLACBUFF *bp)
Definition: BI_Asend.c:3
BI_Ssend
void BI_Ssend(BLACSCONTEXT *ctxt, int dest, int msgid, BLACBUFF *bp)
Definition: BI_Ssend.c:3
F_CHAR
char * F_CHAR
Definition: pblas.h:109
MGetConTxt
#define MGetConTxt(Context, ctxtptr)
Definition: Bdef.h:200
bLaCsCoNtExT::pscp
BLACSSCOPE pscp
Definition: Bdef.h:25
BVOID
#define BVOID
Definition: Bdef.h:136
bLaCbUfF
Definition: Bdef.h:54
BI_ActiveQ
BLACBUFF * BI_ActiveQ
Definition: BI_GlobalVars.c:9
RT_SD
#define RT_SD
Definition: Bdef.h:105
bLaCbUfF::N
int N
Definition: Bdef.h:61
F2C_CharTrans
#define F2C_CharTrans(c)
Definition: Bdef.h:246
Mpval
#define Mpval(para)
Definition: Bdef.h:261
Mlowcase
#define Mlowcase(C)
Definition: Bdef.h:145
bLaCsCoNtExT
Definition: Bdef.h:23
Mkpnum
#define Mkpnum(ctxt, prow, pcol)
Definition: Bdef.h:173
Mpaddress
#define Mpaddress(para)
Definition: Bdef.h:262
F_VOID_FUNC
#define F_VOID_FUNC
Definition: Bdef.h:232
bLaCsCoNtExT::scp
BLACSSCOPE * scp
Definition: Bdef.h:26
Bdef.h
PT2PTID
#define PT2PTID
Definition: Bdef.h:77
BI_AuxBuff
BLACBUFF BI_AuxBuff
Definition: BI_GlobalVars.c:10
bLaCbUfF::dtype
MPI_Datatype dtype
Definition: Bdef.h:60
BI_ArgCheck
void BI_ArgCheck(int ConTxt, int RoutType, char *routine, char scope, char uplo, char diag, int m, int n, int lda, int nprocs, int *prows, int *pcols)
Definition: BI_ArgCheck.c:4
ztrsd2d_
F_VOID_FUNC ztrsd2d_(int *ConTxt, F_CHAR uplo, F_CHAR diag, int *m, int *n, double *A, int *lda, int *rdest, int *cdest)
Definition: ztrsd2d_.c:7
BI_MPI_TYPE_FREE
#define BI_MPI_TYPE_FREE(t)
Definition: Bdef.h:305
Mvkpnum
#define Mvkpnum(ctxt, prow, pcol)
Definition: Bdef.h:174
BI_UpdateBuffs
void BI_UpdateBuffs(BLACBUFF *Newbp)
Definition: BI_UpdateBuffs.c:3
BI_BuffIsFree
int BI_BuffIsFree(BLACBUFF *bp, int Wait)
Definition: BI_BuffIsFree.c:3