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

◆ dgebs2d_()

F_VOID_FUNC dgebs2d_ ( Int ConTxt,
F_CHAR  scope,
F_CHAR  top,
Int m,
Int n,
double *  A,
Int lda 
)

Definition at line 6 of file dgebs2d_.c.

48{
49 void BI_ArgCheck(Int, Int, char *, char, char, char, Int, Int, Int, Int,
50 Int *, Int *);
59 MPI_Datatype BI_GetMpiGeType(BLACSCONTEXT *, Int, Int, Int,
60 MPI_Datatype, Int *);
61 BLACBUFF *BI_Pack(BLACSCONTEXT *, BVOID *, BLACBUFF *, MPI_Datatype);
64
65 char ttop, tscope;
66 Int error, tlda;
67 MPI_Datatype MatTyp;
68 SDRVPTR send;
69 BLACBUFF *bp;
70 BLACSCONTEXT *ctxt;
72/*
73 * get context, lowcase char variables, and perform parameter checking
74 */
75 MGetConTxt(Mpval(ConTxt), ctxt);
76 ttop = F2C_CharTrans(top);
77 ttop = Mlowcase(ttop);
78 tscope = F2C_CharTrans(scope);
79 tscope = Mlowcase(tscope);
80#if (BlacsDebugLvl > 0)
81 BI_ArgCheck(Mpval(ConTxt), RT_BS, __FILE__, 'a', 'u', 'u', Mpval(m),
82 Mpval(n), Mpval(lda), 0, NULL, NULL);
83#endif
84/*
85 * If the user has set the default broadcast topology, use it instead of
86 * BLACS default
87 */
88#ifdef DefBSTop
89 if (ttop == ' ') ttop = DefBSTop;
90#endif
91 if (Mpval(lda) < Mpval(m)) tlda = Mpval(m);
92 else tlda = Mpval(lda);
93
94 switch(tscope)
95 {
96 case 'r':
97 ctxt->scp = &ctxt->rscp;
98 break;
99 case 'c':
100 ctxt->scp = &ctxt->cscp;
101 break;
102 case 'a':
103 ctxt->scp = &ctxt->ascp;
104 break;
105 default:
106 BI_BlacsErr(Mpval(ConTxt), __LINE__, __FILE__, "Unknown scope '%c'",
107 tscope);
108 }
109
110 MatTyp = BI_GetMpiGeType(ctxt, Mpval(m), Mpval(n), tlda,
111 MPI_DOUBLE, &BI_AuxBuff.N);
112/*
113 * If using default topology, use MPI native broadcast
114 */
115 if (ttop == ' ')
116 {
117 error=MPI_Bcast(A, BI_AuxBuff.N, MatTyp, ctxt->scp->Iam, ctxt->scp->comm);
118 error=BI_MPI_TYPE_FREE(&MatTyp);
119 if (BI_ActiveQ) BI_UpdateBuffs(NULL);
120 return;
121 }
122/*
123 * If MPI handles non-contiguous buffering well, always use MPI data types
124 * instead of packing
125 */
126#ifndef MpiBuffGood
127/*
128 * If A is contiguous, send directly from it
129 */
130 else if ( (tlda == Mpval(m)) || (Mpval(n) == 1) )
131 {
132#endif
133 send = BI_Ssend;
134 BI_AuxBuff.Buff = (char *) A;
135 BI_AuxBuff.dtype = MatTyp;
136 bp = &BI_AuxBuff;
137#ifndef MpiBuffGood
138 }
139 else
140 {
141 send = BI_Asend;
142 bp = BI_Pack(ctxt, (BVOID *) A, NULL, MatTyp);
143 }
144#endif
145
146/*
147 * Call correct topology for BS/BR
148 */
149 switch(ttop)
150 {
151 case 'h':
152 error = BI_HypBS(ctxt, bp, send);
153 if (error == NPOW2) BI_TreeBS(ctxt, bp, send, 2);
154 break;
155 case '1':
156 case '2':
157 case '3':
158 case '4':
159 case '5':
160 case '6':
161 case '7':
162 case '8':
163 case '9':
164 BI_TreeBS(ctxt, bp, send, ttop-47);
165 break;
166 case 't':
167 BI_TreeBS(ctxt, bp, send, ctxt->Nb_bs);
168 break;
169 case 'i':
170 BI_IdringBS(ctxt, bp, send, 1);
171 break;
172 case 'd':
173 BI_IdringBS(ctxt, bp, send, -1);
174 break;
175 case 's':
176 BI_SringBS(ctxt, bp, send);
177 break;
178 case 'f':
179 BI_MpathBS(ctxt, bp, send, FULLCON);
180 break;
181 case 'm':
182 BI_MpathBS(ctxt, bp, send, ctxt->Nr_bs);
183 break;
184 default :
185 BI_BlacsErr(Mpval(ConTxt), __LINE__, __FILE__, "Unknown topology '%c'",
186 ttop);
187 }
188
189 error=BI_MPI_TYPE_FREE(&MatTyp);
190 if (bp == &BI_AuxBuff)
191 {
192 if (BI_ActiveQ) BI_UpdateBuffs(NULL);
193 }
194 else BI_UpdateBuffs(bp);
195} /* end dgebs2d_ */
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
void BI_Asend(BLACSCONTEXT *ctxt, Int dest, Int msgid, BLACBUFF *bp)
Definition BI_Asend.c:3
Int BI_BuffIsFree(BLACBUFF *bp, Int Wait)
BLACBUFF * BI_GetBuff(Int length)
Definition BI_GetBuff.c:37
MPI_Datatype BI_GetMpiGeType(BLACSCONTEXT *ctxt, Int m, Int n, Int lda, MPI_Datatype Dtype, Int *N)
BLACBUFF * BI_ActiveQ
BLACBUFF BI_AuxBuff
Int BI_HypBS(BLACSCONTEXT *ctxt, BLACBUFF *bp, SDRVPTR send)
Definition BI_HypBS.c:2
void BI_IdringBS(BLACSCONTEXT *ctxt, BLACBUFF *bp, SDRVPTR send, Int step)
Definition BI_IdringBS.c:3
void BI_MpathBS(BLACSCONTEXT *ctxt, BLACBUFF *bp, SDRVPTR send, Int npaths)
Definition BI_MpathBS.c:3
BLACBUFF * BI_Pack(BLACSCONTEXT *ctxt, BVOID *A, BLACBUFF *bp, MPI_Datatype Dtype)
Definition BI_Pack.c:2
void BI_SringBS(BLACSCONTEXT *ctxt, BLACBUFF *bp, SDRVPTR send)
Definition BI_SringBS.c:3
void BI_Ssend(BLACSCONTEXT *ctxt, Int dest, Int msgid, BLACBUFF *bp)
Definition BI_Ssend.c:3
void BI_TreeBS(BLACSCONTEXT *ctxt, BLACBUFF *bp, SDRVPTR send, Int nbranches)
Definition BI_TreeBS.c:37
void BI_UpdateBuffs(BLACBUFF *Newbp)
#define Int
Definition Bconfig.h:22
void BI_BlacsErr(Int ConTxt, Int line, char *file, char *form,...)
Definition BI_BlacsErr.c:3
#define BI_MPI_TYPE_FREE(t)
Definition Bdef.h:305
#define F2C_CharTrans(c)
Definition Bdef.h:246
#define MGetConTxt(Context, ctxtptr)
Definition Bdef.h:200
#define Mpval(para)
Definition Bdef.h:261
#define NPOW2
Definition Bdef.h:88
#define FULLCON
Definition Bdef.h:100
void(* SDRVPTR)(BLACSCONTEXT *, Int, Int, BLACBUFF *)
Definition Bdef.h:69
#define Mlowcase(C)
Definition Bdef.h:145
#define RT_BS
Definition Bdef.h:107
#define BVOID
Definition Bdef.h:136
Int N
Definition Bdef.h:61
MPI_Datatype dtype
Definition Bdef.h:60
char * Buff
Definition Bdef.h:56
Int Nb_bs
Definition Bdef.h:29
Int Nr_bs
Definition Bdef.h:29
BLACSSCOPE * scp
Definition Bdef.h:26
BLACSSCOPE ascp
Definition Bdef.h:25
BLACSSCOPE rscp
Definition Bdef.h:25
BLACSSCOPE cscp
Definition Bdef.h:25
MPI_Comm comm
Definition Bdef.h:15
Int Iam
Definition Bdef.h:17
Here is the call graph for this function: