ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
dgesd2d_.c
Go to the documentation of this file.
1 #include "Bdef.h"
2 
3 
4 #if (INTFACE == C_CALL)
5 void Cdgesd2d(int ConTxt, int m, int n, double *A, int lda,
6  int rdest, int cdest)
7 #else
8 F_VOID_FUNC dgesd2d_(int *ConTxt, int *m, int *n, double *A, int *lda,
9  int *rdest, int *cdest)
10 #endif
11 /*
12  * -- V1.1 BLACS routine --
13  * University of Tennessee, May 1, 1996
14  * Written by Clint Whaley.
15  *
16  * Purpose
17  * =======
18  * Locally-blocking point-to-point general double precision send.
19  *
20  * Arguments
21  * =========
22  *
23  * ConTxt (input) Ptr to int
24  * Index into MyConTxts00 (my contexts array).
25  *
26  * M (input) Ptr to int
27  * The number of rows of the matrix A. M >= 0.
28  *
29  * N (input) Ptr to int
30  * The number of columns of the matrix A. N >= 0.
31  *
32  * A (input) Ptr to double precision two dimensional array
33  * The m by n matrix A. Fortran77 (column-major) storage
34  * assumed.
35  *
36  * LDA (input) Ptr to int
37  * The leading dimension of the array A. LDA >= M.
38  *
39  * RDEST (input) Ptr to int
40  * The process row of the destination process.
41  *
42  * CDEST (input) Ptr to int
43  * The process column of the destination process.
44  *
45  * ------------------------------------------------------------------------
46  */
47 {
48  void BI_ArgCheck(int, int, char *, char, char, char, int, int, int, int,
49  int *, int *);
50  MPI_Datatype BI_GetMpiGeType(BLACSCONTEXT *, int, int, int,
51  MPI_Datatype, int *);
52  BLACBUFF *BI_Pack(BLACSCONTEXT *, BVOID *, BLACBUFF *, MPI_Datatype);
53  void BI_Ssend(BLACSCONTEXT *, int, int, BLACBUFF *);
54  void BI_Asend(BLACSCONTEXT *, int, int, BLACBUFF *);
55  void BI_UpdateBuffs(BLACBUFF *);
56  BLACBUFF *BI_GetBuff(int);
57  int BI_BuffIsFree(BLACBUFF *, int);
58 
59  int dest, tlda, ierr;
60  BLACBUFF *bp;
61  BLACSCONTEXT *ctxt;
62  MPI_Datatype MatTyp;
64 
65  MGetConTxt(Mpval(ConTxt), ctxt);
66 #if (BlacsDebugLvl > 0)
67  BI_ArgCheck(Mpval(ConTxt), RT_SD, "DGESD2D", 'a', 'u', 'u', Mpval(m),
68  Mpval(n), Mpval(lda), 1, Mpaddress(rdest), Mpaddress(cdest));
69 #endif
70  if (Mpval(lda) < Mpval(m)) tlda = Mpval(m);
71  else tlda = Mpval(lda);
72  dest = Mvkpnum(ctxt, Mpval(rdest), Mpval(cdest));
73  ctxt->scp = &ctxt->pscp;
74 
75  MatTyp = BI_GetMpiGeType(ctxt, Mpval(m), Mpval(n), tlda,
76  MPI_DOUBLE, &BI_AuxBuff.N);
77 #ifdef SndIsLocBlk
78  BI_AuxBuff.Buff = (char *) A;
79  BI_AuxBuff.dtype = MatTyp;
80  BI_Ssend(ctxt, dest, PT2PTID, &BI_AuxBuff);
81 #else
82  bp = BI_Pack(ctxt, (BVOID *) A, NULL, MatTyp);
83  BI_Asend(ctxt, Mkpnum(ctxt, Mpval(rdest), Mpval(cdest)), PT2PTID, bp);
84 #endif
85  ierr=BI_MPI_TYPE_FREE(&MatTyp);
86 
87 /*
88  * Having started the async send, update the buffers (reform links, check if
89  * active buffers have become inactive, etc.)
90  */
91 #ifdef SndIsLocBlk
92  if (BI_ActiveQ) BI_UpdateBuffs(NULL);
93 #else
94  BI_UpdateBuffs(bp);
95 #endif
96 } /* end of dgesd2d */
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_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
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
Cdgesd2d
void Cdgesd2d()
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
Mpval
#define Mpval(para)
Definition: Bdef.h:261
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
BI_GetMpiGeType
MPI_Datatype BI_GetMpiGeType(BLACSCONTEXT *ctxt, int m, int n, int lda, MPI_Datatype Dtype, int *N)
Definition: BI_GetMpiGeType.c:2
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
dgesd2d_
F_VOID_FUNC dgesd2d_(int *ConTxt, int *m, int *n, double *A, int *lda, int *rdest, int *cdest)
Definition: dgesd2d_.c:8
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
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