82{
83 void BI_ArgCheck(
Int,
Int,
char *,
char,
char,
char,
Int,
Int,
Int,
Int,
103
104
105
109 char ttop, tscope;
110 Int i, j, N, dest, idist, length, tlda, tldia, trdest, ierr;
112 MPI_Aint disp[2];
113 MPI_Datatype dtypes[2];
114 MPI_Op BlacComb;
115 MPI_Datatype IntTyp, MyType;
119
120 MPI_Type_match_size(MPI_TYPECLASS_INTEGER,
sizeof(
Int), &IntTyp);
121
127
128
129
130
131#ifdef DefCombTop
132 if (ttop == ' ') ttop = DefCombTop;
133#endif
134 if (
Mpval(cdest) == -1) trdest = -1;
135 else trdest =
Mpval(rdest);
136#if (BlacsDebugLvl > 0)
140 {
141 if (
Mpval(ldia) != -1)
143 "LDIA too small (LDIA=%d, but M=%d)",
Mpval(ldia),
145 }
146#endif
148 else tlda =
Mpval(m);
150 else tldia =
Mpval(ldia);
151 switch(tscope)
152 {
153 case 'r':
155 if (trdest == -1) dest = -1;
156 else dest =
Mpval(cdest);
157 break;
158 case 'c':
160 dest = trdest;
161 break;
162 case 'a':
164 if (trdest == -1) dest = -1;
166 break;
167 default:
169 tscope);
170 }
171
172
173
174
175
176
177 if (ttop == ' ')
180
181
182
183
184 if (
Mpval(ldia) != -1)
185 {
190 idist = length;
192
193
194
195 j = 8;
197 i = length % j;
198 if (i) length += j - i;
199 i = 2 * length;
200
205
206
207
208 if (dest == -1) mydist = ctxt->
scp->
Iam;
211 for (i=0; i < N; i++) dist[i] = mydist;
212
213
214
215
216 len[0] = len[1] = N;
217 disp[0] = 0;
218 disp[1] = idist;
219 dtypes[0] = MPI_COMPLEX;
221#ifdef ZeroByteTypeBug
222 if (N > 0)
223 {
224#endif
225 i = 2;
226 ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
227 ierr=MPI_Type_commit(&MyType);
230#ifdef ZeroByteTypeBug
231 }
232 else
233 {
236 }
237#endif
238 }
239 else
240 {
243
244
245
247 {
249 bp->
Buff = (
char *) A;
251 }
252 else
253 {
258 }
261 }
262
263 switch(ttop)
264 {
265 case ' ':
266 i = 1;
267 if (
Mpval(ldia) == -1)
268 {
270 }
271 else
272 {
275 }
276
277 if (trdest != -1)
278 {
279 ierr=MPI_Reduce(bp->
Buff, bp2->
Buff, bp->
N, bp->
dtype, BlacComb, dest,
281 if (ctxt->
scp->
Iam == dest)
282 {
284 if (
Mpval(ldia) != -1)
287 trdest,
Mpval(cdest));
288 }
289 }
290 else
291 {
292 ierr=MPI_Allreduce(bp->
Buff, bp2->
Buff, bp->
N, bp->
dtype, BlacComb,
295 if (
Mpval(ldia) != -1)
298 trdest,
Mpval(cdest));
299 }
300 ierr=MPI_Op_free(&BlacComb);
301 if (
Mpval(ldia) != -1)
302#ifdef ZeroByteTypeBug
303 if (N > 0)
304#endif
307 return;
308 break;
309 case 'i':
311 break;
312 case 'd':
314 break;
315 case 's':
317 break;
318 case 'm':
320 break;
321 case '1':
322 case '2':
323 case '3':
324 case '4':
325 case '5':
326 case '6':
327 case '7':
328 case '8':
329 case '9':
330 BI_TreeComb(ctxt, bp, bp2, N, vvop, dest, ttop-47);
331 break;
332 case 'f':
334 break;
335 case 't':
337 break;
338 case 'h':
339
340
341
344 else
346 break;
347 default :
349 ttop);
350 }
351
352 if (
Mpval(ldia) != -1)
353#ifdef ZeroByteTypeBug
354 if (N > 0)
355#endif
357
358
359
360 if ( (ctxt->
scp->
Iam == dest) || (dest == -1) )
361 {
362
363
364
365
366
367 if (
Mpval(ldia) != -1)
369 dist, trdest,
Mpval(cdest));
370
371
372
374 }
375}
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)
void BI_BeComb(BLACSCONTEXT *ctxt, BLACBUFF *bp, BLACBUFF *bp2, Int N, VVFUNPTR Xvvop)
Int BI_BuffIsFree(BLACBUFF *bp, Int Wait)
BLACBUFF * BI_GetBuff(Int length)
MPI_Datatype BI_GetMpiGeType(BLACSCONTEXT *ctxt, Int m, Int n, Int lda, MPI_Datatype Dtype, Int *N)
void BI_MringComb(BLACSCONTEXT *ctxt, BLACBUFF *bp, BLACBUFF *bp2, Int N, VVFUNPTR Xvvop, Int dest, Int nrings)
BLACBUFF * BI_Pack(BLACSCONTEXT *ctxt, BVOID *A, BLACBUFF *bp, MPI_Datatype Dtype)
void BI_TransDist(BLACSCONTEXT *ctxt, char scope, Int m, Int n, Int *rA, Int *cA, Int ldrc, BI_DistType *dist, Int rdest, Int cdest)
void BI_TreeComb(BLACSCONTEXT *ctxt, BLACBUFF *bp, BLACBUFF *bp2, Int N, VVFUNPTR Xvvop, Int dest, Int nbranches)
void BI_Unpack(BLACSCONTEXT *ctxt, BVOID *A, BLACBUFF *bp, MPI_Datatype Dtype)
void BI_UpdateBuffs(BLACBUFF *Newbp)
void BI_cMPI_amx2(void *in, void *inout, MpiInt *N, MPI_Datatype *dtype)
void BI_cMPI_amx(void *in, void *inout, MpiInt *N, MPI_Datatype *dtype)
void BI_cvvamx2(Int N, char *vec1, char *vec2)
void BI_cvvamx(Int N, char *vec1, char *vec2)
void BI_BlacsErr(Int ConTxt, Int line, char *file, char *form,...)
#define BI_cvmcopy(m, n, A, lda, buff)
#define BI_MPI_TYPE_FREE(t)
#define Mvkpnum(ctxt, prow, pcol)
#define MGetConTxt(Context, ctxtptr)
void(* VVFUNPTR)(Int, char *, char *)
#define BI_cmvcopy(m, n, A, lda, buff)
void BI_BlacsWarn(Int ConTxt, Int line, char *file, char *form,...)