80{
81 void BI_ArgCheck(
Int,
Int,
char *,
char,
char,
char,
Int,
Int,
Int,
Int,
101
102
103
107 char ttop, tscope;
108 Int i, j, N, dest, idist, length, tlda, tldia, trdest, ierr;
110 MPI_Aint disp[2];
111 MPI_Datatype dtypes[2];
112 MPI_Op BlacComb;
113 MPI_Datatype IntTyp, MyType;
117
118 MPI_Type_match_size(MPI_TYPECLASS_INTEGER,
sizeof(
Int), &IntTyp);
119
125
126
127
128
129#ifdef DefCombTop
130 if (ttop == ' ') ttop = DefCombTop;
131#endif
132 if (
Mpval(cdest) == -1) trdest = -1;
133 else trdest =
Mpval(rdest);
134#if (BlacsDebugLvl > 0)
138 {
139 if (
Mpval(ldia) != -1)
141 "LDIA too small (LDIA=%d, but M=%d)",
Mpval(ldia),
143 }
144#endif
146 else tlda =
Mpval(m);
148 else tldia =
Mpval(ldia);
149 switch(tscope)
150 {
151 case 'r':
153 if (trdest == -1) dest = -1;
154 else dest =
Mpval(cdest);
155 break;
156 case 'c':
158 dest = trdest;
159 break;
160 case 'a':
162 if (trdest == -1) dest = -1;
164 break;
165 default:
167 tscope);
168 }
169
170
171
172
173
174
175 if (ttop ==
' ')
if ( (
Mpval(m) < 1) || (
Mpval(n) < 1) ) ttop =
'1';
177
178
179
180
181 if (
Mpval(ldia) != -1)
182 {
184 length = N *
sizeof(
Int);
187 idist = length;
189
190
191
192 j = 8;
193 if (
sizeof(
Int) > j) j =
sizeof(
Int);
194 i = length % j;
195 if (i) length += j - i;
196 i = 2 * length;
197
202
203
204
205 if (dest == -1) mydist = ctxt->
scp->
Iam;
208 for (i=0; i < N; i++) dist[i] = mydist;
209
210
211
212
213 len[0] = len[1] = N;
214 disp[0] = 0;
215 disp[1] = idist;
216 dtypes[0] = IntTyp;
218#ifdef ZeroByteTypeBug
219 if (N > 0)
220 {
221#endif
222 i = 2;
223 ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
224 ierr=MPI_Type_commit(&MyType);
227#ifdef ZeroByteTypeBug
228 }
229 else
230 {
233 }
234#endif
235 }
236 else
237 {
239 length = N *
sizeof(
Int);
240
241
242
244 {
246 bp->
Buff = (
char *) A;
248 }
249 else
250 {
255 }
258 }
259
260 switch(ttop)
261 {
262 case ' ':
263 i = 1;
264 if (
Mpval(ldia) == -1)
265 {
267 }
268 else
269 {
272 }
273
274 if (trdest != -1)
275 {
276 ierr=MPI_Reduce(bp->
Buff, bp2->
Buff, bp->
N, bp->
dtype, BlacComb, dest,
278 if (ctxt->
scp->
Iam == dest)
279 {
281 if (
Mpval(ldia) != -1)
284 trdest,
Mpval(cdest));
285 }
286 }
287 else
288 {
289 ierr=MPI_Allreduce(bp->
Buff, bp2->
Buff, bp->
N, bp->
dtype, BlacComb,
292 if (
Mpval(ldia) != -1)
295 trdest,
Mpval(cdest));
296 }
297 ierr=MPI_Op_free(&BlacComb);
298 if (
Mpval(ldia) != -1)
299#ifdef ZeroByteTypeBug
300 if (N > 0)
301#endif
304 return;
305 break;
306 case 'i':
308 break;
309 case 'd':
311 break;
312 case 's':
314 break;
315 case 'm':
317 break;
318 case '1':
319 case '2':
320 case '3':
321 case '4':
322 case '5':
323 case '6':
324 case '7':
325 case '8':
326 case '9':
327 BI_TreeComb(ctxt, bp, bp2, N, vvop, dest, ttop-47);
328 break;
329 case 'f':
331 break;
332 case 't':
334 break;
335 case 'h':
336
337
338
341 else
343 break;
344 default :
346 ttop);
347 }
348
349 if (
Mpval(ldia) != -1)
350#ifdef ZeroByteTypeBug
351 if (N > 0)
352#endif
354
355
356
357 if ( (ctxt->
scp->
Iam == dest) || (dest == -1) )
358 {
359
360
361
362
363
364 if (
Mpval(ldia) != -1)
366 dist, trdest,
Mpval(cdest));
367
368
369
371 }
372}
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_iMPI_amx2(void *in, void *inout, MpiInt *N, MPI_Datatype *dtype)
void BI_iMPI_amx(void *in, void *inout, MpiInt *N, MPI_Datatype *dtype)
void BI_imvcopy(Int m, Int n, Int *A, Int lda, Int *buff)
void BI_ivmcopy(Int m, Int n, Int *A, Int lda, Int *buff)
void BI_ivvamx2(Int N, char *vec1, char *vec2)
void BI_ivvamx(Int N, char *vec1, char *vec2)
void BI_BlacsErr(Int ConTxt, Int line, char *file, char *form,...)
#define BI_MPI_TYPE_FREE(t)
#define Mvkpnum(ctxt, prow, pcol)
#define MGetConTxt(Context, ctxtptr)
void(* VVFUNPTR)(Int, char *, char *)
void BI_BlacsWarn(Int ConTxt, Int line, char *file, char *form,...)