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

◆ ctrbs2d_()

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

Definition at line 7 of file ctrbs2d_.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 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 MatTyp = BI_GetMpiTrType(ctxt, tuplo, tdiag, Mpval(m), Mpval(n), tlda,
127 MPI_COMPLEX, &BI_AuxBuff.N);
128/*
129 * If using default topology, use MPI native broadcast
130 */
131 if (ttop == ' ')
132 {
133 error=MPI_Bcast(A, BI_AuxBuff.N, MatTyp, ctxt->scp->Iam, ctxt->scp->comm);
134 error=BI_MPI_TYPE_FREE(&MatTyp);
135 if (BI_ActiveQ) BI_UpdateBuffs(NULL);
136 return;
137 }
138/*
139 * If MPI handles non-contiguous buffering well, always use MPI data types
140 * instead of packing
141 */
142#ifdef MpiBuffGood
143 send = BI_Ssend;
144 BI_AuxBuff.Buff = (char *) A;
145 BI_AuxBuff.dtype = MatTyp;
146 bp = &BI_AuxBuff;
147#endif
148/*
149 * Pack and use non-blocking sends for broadcast if MPI's data types aren't
150 * more efficient
151 */
152#ifndef MpiBuffGood
153 send = BI_Asend;
154 bp = BI_Pack(ctxt, (BVOID *) A, NULL, MatTyp);
155#endif
156
157/*
158 * Call correct topology for BS/BR
159 */
160 switch(ttop)
161 {
162 case 'h':
163 error = BI_HypBS(ctxt, bp, send);
164 if (error == NPOW2) BI_TreeBS(ctxt, bp, send, 2);
165 break;
166 case '1':
167 case '2':
168 case '3':
169 case '4':
170 case '5':
171 case '6':
172 case '7':
173 case '8':
174 case '9':
175 BI_TreeBS(ctxt, bp, send, ttop-47);
176 break;
177 case 't':
178 BI_TreeBS(ctxt, bp, send, ctxt->Nb_bs);
179 break;
180 case 'i':
181 BI_IdringBS(ctxt, bp, send, 1);
182 break;
183 case 'd':
184 BI_IdringBS(ctxt, bp, send, -1);
185 break;
186 case 's':
187 BI_SringBS(ctxt, bp, send);
188 break;
189 case 'f':
190 BI_MpathBS(ctxt, bp, send, FULLCON);
191 break;
192 case 'm':
193 BI_MpathBS(ctxt, bp, send, ctxt->Nr_bs);
194 break;
195 default :
196 BI_BlacsErr(Mpval(ConTxt), __LINE__, __FILE__, "Unknown topology '%c'",
197 ttop);
198 }
199
200 error=BI_MPI_TYPE_FREE(&MatTyp);
201 if (bp == &BI_AuxBuff)
202 {
203 if (BI_ActiveQ) BI_UpdateBuffs(NULL);
204 }
205 else BI_UpdateBuffs(bp);
206} /* end ctrbs2d_ */
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: