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

◆ itrbr2d_()

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

Definition at line 7 of file itrbr2d_.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 IntTyp, 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 MPI_Type_match_size(MPI_TYPECLASS_INTEGER, sizeof(Int), &IntTyp);
138 MatTyp = BI_GetMpiTrType(ctxt, tuplo, tdiag, Mpval(m), Mpval(n), tlda,
139 IntTyp, &BI_AuxBuff.N);
140/*
141 * If using default topology, use MPI native broadcast
142 */
143 if (ttop == ' ')
144 {
145 error=MPI_Bcast(A, BI_AuxBuff.N, MatTyp, src, ctxt->scp->comm);
146 error=BI_MPI_TYPE_FREE(&MatTyp);
147 if (BI_ActiveQ) BI_UpdateBuffs(NULL);
148 return;
149 }
150/*
151 * If MPI handles non-contiguous buffering well, always use MPI data types
152 * instead of packing
153 */
154#ifdef MpiBuffGood
155 send = BI_Ssend;
156 BI_AuxBuff.Buff = (char *) A;
157 BI_AuxBuff.dtype = MatTyp;
158 bp = &BI_AuxBuff;
159#else
160
161 send = BI_Asend;
162 MPI_Pack_size(one, MatTyp, ctxt->scp->comm, &length);
163 bp = BI_GetBuff(length);
164 bp->N = length;
165 bp->dtype = MPI_PACKED;
166#if ZeroByteTypeBug
167 if (MatTyp == MPI_BYTE)
168 {
169 send = BI_Ssend;
170 bp->N = 0;
171 bp->dtype = MPI_BYTE;
172 }
173#endif
174
175#endif
176
177 switch(ttop)
178 {
179 case 'h':
180 error = BI_HypBR(ctxt, bp, send, src);
181 if (error == NPOW2) BI_TreeBR(ctxt, bp, send, src, 2);
182 break;
183 case '1':
184 case '2':
185 case '3':
186 case '4':
187 case '5':
188 case '6':
189 case '7':
190 case '8':
191 case '9':
192 BI_TreeBR(ctxt, bp, send, src, ttop-47);
193 break;
194 case 't':
195 BI_TreeBR(ctxt, bp, send, src, ctxt->Nb_bs);
196 break;
197 case 'i':
198 BI_IdringBR(ctxt, bp, send, src, 1);
199 break;
200 case 'd':
201 BI_IdringBR(ctxt, bp, send, src, -1);
202 break;
203 case 's':
204 BI_SringBR(ctxt, bp, send, src);
205 break;
206 case 'm':
207 BI_MpathBR(ctxt, bp, send, src, ctxt->Nr_bs);
208 break;
209 case 'f':
210 BI_MpathBR(ctxt, bp, send, src, FULLCON);
211 break;
212 default :
213 BI_BlacsErr(Mpval(ConTxt), __LINE__, __FILE__, "Unknown topology '%c'",
214 ttop);
215 }
216
217#ifdef MpiBuffGood
218 error=BI_MPI_TYPE_FREE(&MatTyp);
219 if (BI_ActiveQ) BI_UpdateBuffs(NULL);
220#endif
221#ifndef MpiBuffGood
222 BI_Unpack(ctxt, (BVOID *) A, bp, MatTyp);
223 BI_UpdateBuffs(bp);
224#endif
225}
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: