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

◆ ctrbr2d_()

F_VOID_FUNC ctrbr2d_ ( Int ConTxt,
F_CHAR  scope,
F_CHAR  top,
F_CHAR  uplo,
F_CHAR  diag,
Int m,
Int n,
float *  A,
Int lda,
Int rsrc,
Int csrc 
)

Definition at line 7 of file ctrbr2d_.c.

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