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

◆ igebs2d_()

F_VOID_FUNC igebs2d_ ( Int ConTxt,
F_CHAR  scope,
F_CHAR  top,
Int m,
Int n,
Int A,
Int lda 
)

Definition at line 6 of file igebs2d_.c.

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