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

◆ itrbs2d_()

F_VOID_FUNC itrbs2d_ ( Int ConTxt,
F_CHAR  scope,
F_CHAR  top,
F_CHAR  uplo,
F_CHAR  diag,
Int m,
Int n,
Int A,
Int lda 
)

Definition at line 7 of file itrbs2d_.c.

61{
62 void BI_ArgCheck(Int, Int, char *, char, char, char, Int, Int, Int, Int,
63 Int *, Int *);
72 MPI_Datatype BI_GetMpiTrType(BLACSCONTEXT *, char, char, Int, Int, Int,
73 MPI_Datatype, Int *);
74 BLACBUFF *BI_Pack(BLACSCONTEXT *, BVOID *, BLACBUFF *, MPI_Datatype);
77
78 char ttop, tscope, tuplo, tdiag;
79 Int error, tlda;
80 MPI_Datatype IntTyp, MatTyp;
81 SDRVPTR send;
82 BLACBUFF *bp;
83 BLACSCONTEXT *ctxt;
85/*
86 * get context, lowcase char variables, and perform parameter checking
87 */
88 MGetConTxt(Mpval(ConTxt), ctxt);
89 ttop = F2C_CharTrans(top);
90 ttop = Mlowcase(ttop);
91 tscope = F2C_CharTrans(scope);
92 tscope = Mlowcase(tscope);
93 tuplo = F2C_CharTrans(uplo);
94 tuplo = Mlowcase(tuplo);
95 tdiag = F2C_CharTrans(diag);
96 tdiag = Mlowcase(tdiag);
97#if (BlacsDebugLvl > 0)
98 BI_ArgCheck(Mpval(ConTxt), RT_BS, __FILE__, 'a', tuplo, tdiag, Mpval(m),
99 Mpval(n), Mpval(lda), 0, NULL, NULL);
100#endif
101/*
102 * If the user has set the default broadcast topology, use it instead of
103 * BLACS default
104 */
105#ifdef DefBSTop
106 if (ttop == ' ') ttop = DefBSTop;
107#endif
108 if (Mpval(lda) < Mpval(m)) tlda = Mpval(m);
109 else tlda = Mpval(lda);
110
111 switch(tscope)
112 {
113 case 'r':
114 ctxt->scp = &ctxt->rscp;
115 break;
116 case 'c':
117 ctxt->scp = &ctxt->cscp;
118 break;
119 case 'a':
120 ctxt->scp = &ctxt->ascp;
121 break;
122 default:
123 BI_BlacsErr(Mpval(ConTxt), __LINE__, __FILE__, "Unknown scope '%c'",
124 tscope);
125 }
126
127 MPI_Type_match_size(MPI_TYPECLASS_INTEGER, sizeof(Int), &IntTyp);
128 MatTyp = BI_GetMpiTrType(ctxt, tuplo, tdiag, Mpval(m), Mpval(n), tlda,
129 IntTyp, &BI_AuxBuff.N);
130/*
131 * If using default topology, use MPI native broadcast
132 */
133 if (ttop == ' ')
134 {
135 error=MPI_Bcast(A, BI_AuxBuff.N, MatTyp, ctxt->scp->Iam, ctxt->scp->comm);
136 error=BI_MPI_TYPE_FREE(&MatTyp);
137 if (BI_ActiveQ) BI_UpdateBuffs(NULL);
138 return;
139 }
140/*
141 * If MPI handles non-contiguous buffering well, always use MPI data types
142 * instead of packing
143 */
144#ifdef MpiBuffGood
145 send = BI_Ssend;
146 BI_AuxBuff.Buff = (char *) A;
147 BI_AuxBuff.dtype = MatTyp;
148 bp = &BI_AuxBuff;
149#endif
150/*
151 * Pack and use non-blocking sends for broadcast if MPI's data types aren't
152 * more efficient
153 */
154#ifndef MpiBuffGood
155 send = BI_Asend;
156 bp = BI_Pack(ctxt, (BVOID *) A, NULL, MatTyp);
157#endif
158
159/*
160 * Call correct topology for BS/BR
161 */
162 switch(ttop)
163 {
164 case 'h':
165 error = BI_HypBS(ctxt, bp, send);
166 if (error == NPOW2) BI_TreeBS(ctxt, bp, send, 2);
167 break;
168 case '1':
169 case '2':
170 case '3':
171 case '4':
172 case '5':
173 case '6':
174 case '7':
175 case '8':
176 case '9':
177 BI_TreeBS(ctxt, bp, send, ttop-47);
178 break;
179 case 't':
180 BI_TreeBS(ctxt, bp, send, ctxt->Nb_bs);
181 break;
182 case 'i':
183 BI_IdringBS(ctxt, bp, send, 1);
184 break;
185 case 'd':
186 BI_IdringBS(ctxt, bp, send, -1);
187 break;
188 case 's':
189 BI_SringBS(ctxt, bp, send);
190 break;
191 case 'f':
192 BI_MpathBS(ctxt, bp, send, FULLCON);
193 break;
194 case 'm':
195 BI_MpathBS(ctxt, bp, send, ctxt->Nr_bs);
196 break;
197 default :
198 BI_BlacsErr(Mpval(ConTxt), __LINE__, __FILE__, "Unknown topology '%c'",
199 ttop);
200 }
201
202 error=BI_MPI_TYPE_FREE(&MatTyp);
203 if (bp == &BI_AuxBuff)
204 {
205 if (BI_ActiveQ) BI_UpdateBuffs(NULL);
206 }
207 else BI_UpdateBuffs(bp);
208} /* end itrbs2d_ */
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_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: