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

◆ dgebr2d_()

F_VOID_FUNC dgebr2d_ ( Int ConTxt,
F_CHAR  scope,
F_CHAR  top,
Int m,
Int n,
double *  A,
Int lda,
Int rsrc,
Int csrc 
)

Definition at line 7 of file dgebr2d_.c.

57{
58 void BI_ArgCheck(Int, Int, char *, char, char, char, Int, Int, Int, Int,
59 Int *, Int *);
68 MPI_Datatype BI_GetMpiGeType(BLACSCONTEXT *, Int, Int, Int,
69 MPI_Datatype, Int *);
70 void BI_Unpack(BLACSCONTEXT *, BVOID *, BLACBUFF *, MPI_Datatype);
73
74 BLACSCONTEXT *ctxt;
75 BLACBUFF *bp=NULL;
76 SDRVPTR send;
77 MPI_Datatype MatTyp;
78 Int length, src, tlda, error, one=1;
79 char ttop, tscope;
81
82 MGetConTxt(Mpval(ConTxt), ctxt);
83 ttop = F2C_CharTrans(top);
84 ttop = Mlowcase(ttop);
85 tscope = F2C_CharTrans(scope);
86 tscope = Mlowcase(tscope);
87#if (BlacsDebugLvl > 0)
88 BI_ArgCheck(Mpval(ConTxt), RT_BR, __FILE__, tscope, 'u', 'u', Mpval(m),
89 Mpval(n), Mpval(lda), 1, Mpaddress(rsrc), Mpaddress(csrc));
90#endif
91/*
92 * If the user has set the default broadcast topology, use it instead of
93 * BLACS default
94 */
95#ifdef DefBSTop
96 if (ttop == ' ') ttop = DefBSTop;
97#endif
98 if (Mpval(m) <= Mpval(lda)) tlda = Mpval(lda);
99 else tlda = Mpval(m);
100
101 switch(tscope)
102 {
103 case 'r':
104 ctxt->scp = &ctxt->rscp;
105 src = Mpval(csrc);
106 break;
107 case 'c':
108 ctxt->scp = &ctxt->cscp;
109 src = Mpval(rsrc);
110 break;
111 case 'a':
112 ctxt->scp = &ctxt->ascp;
113 src = Mvkpnum(ctxt, Mpval(rsrc), Mpval(csrc));
114 break;
115 default:
116 BI_BlacsErr(Mpval(ConTxt), __LINE__, __FILE__, "Unknown scope '%c'",
117 tscope);
118 }
119
120 MatTyp = BI_GetMpiGeType(ctxt, Mpval(m), Mpval(n), tlda,
121 MPI_DOUBLE, &BI_AuxBuff.N);
122/*
123 * If using default topology, use MPI native broadcast
124 */
125 if (ttop == ' ')
126 {
127 error=MPI_Bcast(A, BI_AuxBuff.N, MatTyp, src, ctxt->scp->comm);
128 error=BI_MPI_TYPE_FREE(&MatTyp);
129 if (BI_ActiveQ) BI_UpdateBuffs(NULL);
130 return;
131 }
132/*
133 * If MPI handles non-contiguous buffering well, always use MPI data types
134 * instead of packing
135 */
136#ifndef MpiBuffGood
137/*
138 * If A is contiguous, receive and send directly to/from it
139 */
140 else if ( (tlda == Mpval(m)) || (Mpval(n) == 1) )
141 {
142#endif
143 send = BI_Ssend;
144 BI_AuxBuff.Buff = (char *) A;
145 BI_AuxBuff.dtype = MatTyp;
146 bp = &BI_AuxBuff;
147#ifndef MpiBuffGood
148 }
149/*
150 * If A is not contiguous, we receive message as packed so it can be
151 * forwarded without further system intervention
152 */
153 else
154 {
155 send = BI_Asend;
156 error=MPI_Pack_size(one, MatTyp, ctxt->scp->comm, &length);
157 bp = BI_GetBuff(length);
158 bp->N = length;
159 bp->dtype = MPI_PACKED;
160#if ZeroByteTypeBug
161 if (MatTyp == MPI_BYTE)
162 {
163 send = BI_Ssend;
164 bp->N = 0;
165 bp->dtype = MPI_BYTE;
166 }
167#endif
168 }
169#endif
170
171 switch(ttop)
172 {
173 case 'h':
174 error = BI_HypBR(ctxt, bp, send, src);
175 if (error == NPOW2) BI_TreeBR(ctxt, bp, send, src, 2);
176 break;
177 case '1':
178 case '2':
179 case '3':
180 case '4':
181 case '5':
182 case '6':
183 case '7':
184 case '8':
185 case '9':
186 BI_TreeBR(ctxt, bp, send, src, ttop-47);
187 break;
188 case 't':
189 BI_TreeBR(ctxt, bp, send, src, ctxt->Nb_bs);
190 break;
191 case 'i':
192 BI_IdringBR(ctxt, bp, send, src, 1);
193 break;
194 case 'd':
195 BI_IdringBR(ctxt, bp, send, src, -1);
196 break;
197 case 's':
198 BI_SringBR(ctxt, bp, send, src);
199 break;
200 case 'm':
201 BI_MpathBR(ctxt, bp, send, src, ctxt->Nr_bs);
202 break;
203 case 'f':
204 BI_MpathBR(ctxt, bp, send, src, FULLCON);
205 break;
206 default :
207 BI_BlacsErr(Mpval(ConTxt), __LINE__, __FILE__, "Unknown topology '%c'",
208 ttop);
209 }
210
211/*
212 * If we buffered, unpack.
213 */
214#ifndef MpiBuffGood
215 if (bp != &BI_AuxBuff)
216 {
217 BI_Unpack(ctxt, (BVOID *) A, bp, MatTyp);
218 BI_UpdateBuffs(bp);
219 }
220 else
221#endif
222 {
223 error=BI_MPI_TYPE_FREE(&MatTyp);
224 if (BI_ActiveQ) BI_UpdateBuffs(NULL);
225 }
226}
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_HypBR(BLACSCONTEXT *ctxt, BLACBUFF *bp, SDRVPTR send, Int src)
Definition BI_HypBR.c:3
void BI_IdringBR(BLACSCONTEXT *ctxt, BLACBUFF *bp, SDRVPTR send, Int src, Int step)
Definition BI_IdringBR.c:3
void BI_MpathBR(BLACSCONTEXT *ctxt, BLACBUFF *bp, SDRVPTR send, Int src, Int npaths)
Definition BI_MpathBR.c:3
void BI_SringBR(BLACSCONTEXT *ctxt, BLACBUFF *bp, SDRVPTR send, Int src)
Definition BI_SringBR.c:3
void BI_Ssend(BLACSCONTEXT *ctxt, Int dest, Int msgid, BLACBUFF *bp)
Definition BI_Ssend.c:3
void BI_TreeBR(BLACSCONTEXT *ctxt, BLACBUFF *bp, SDRVPTR send, Int src, Int nbranches)
Definition BI_TreeBR.c:3
void BI_Unpack(BLACSCONTEXT *ctxt, BVOID *A, BLACBUFF *bp, MPI_Datatype Dtype)
Definition BI_Unpack.c:3
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 Mvkpnum(ctxt, prow, pcol)
Definition Bdef.h:174
#define MGetConTxt(Context, ctxtptr)
Definition Bdef.h:200
#define RT_BR
Definition Bdef.h:108
#define Mpaddress(para)
Definition Bdef.h:262
#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 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
Here is the call graph for this function: