72#define BI_DistType unsigned short
73#define BI_MpiDistType MPI_UNSIGNED_SHORT
76#define BANYNODE MPI_ANY_SOURCE
78#define NOTINCONTEXT -1
81#define AOPDONE MPI_REQUEST_NULL
114#define SGET_SYSCONTXT 0
116#define SGET_DEBUGLVL 2
117#define SGET_BLACSCONTXT 10
122#define SGET_TOPSREPEAT 15
123#define SGET_TOPSCOHRNT 16
145#define Mlowcase(C) ( ((C) > 64 && (C) < 91) ? (C) | 32 : (C) )
150#define Mgridinfo(ctxt, Ng0, nprow0, npcol0, myrow0, mycol0)\
152 (Ng0) = (ctxt)->ascp.Np;\
153 (nprow0) = (ctxt)->cscp.Np;\
154 (npcol0) = (ctxt)->rscp.Np;\
155 (myrow0) = (ctxt)->cscp.Iam;\
156 (mycol0) = (ctxt)->rscp.Iam;\
165#define Mpcoord(ctxt, node, prow, pcol)\
167 (prow) = (node) / (ctxt)->rscp.Np;\
168 (pcol) = (node) % (ctxt)->rscp.Np;\
170#define Mvpcoord(ctxt, node, prow, pcol) \
171 Mpcoord((ctxt), (node), (prow), (pcol));
173#define Mkpnum(ctxt, prow, pcol) ( (prow)*(ctxt)->rscp.Np+(pcol) )
174#define Mvkpnum(ctxt, prow, pcol) ( (prow)*(ctxt)->rscp.Np+(pcol) )
179#define Mscopeid(ctxt) (ctxt)->scp->ScpId; \
180 if (++(ctxt)->scp->ScpId == (ctxt)->scp->MaxId) \
181 (ctxt)->scp->ScpId = (ctxt)->scp->MinId;
186#if (BlacsDebugLvl > 0)
187#define MGetConTxt(Context, ctxtptr)\
189 extern BLACSCONTEXT **BI_MyContxts;\
190 extern Int BI_MaxNCtxt;\
191 if ( ((Context) >= BI_MaxNCtxt) || ((Context) < 0) )\
192 BI_BlacsErr(-1, __LINE__, __FILE__, "Invalid context handle: %d",\
194 else if (BI_MyContxts[(Context)] == NULL)\
195 BI_BlacsErr(-1, __LINE__, __FILE__, "Invalid context, handle=%d",\
197 (ctxtptr) = BI_MyContxts[(Context)];\
200#define MGetConTxt(Context, ctxtptr)\
202 extern BLACSCONTEXT **BI_MyContxts;\
203 (ctxtptr) = BI_MyContxts[(Context)];\
209#if(BlacsDebugLvl > 0)
210#define Mmpierror(ierr, rout, ctxt, line, file) \
212 if ( (ierr) != BI_MPI_SUCCESS )\
213 BI_BlacsErr(BI_ContxtNum((ctxt)), (line), (file), \
214 "MPI error %d on call to %s", (ierr), (rout)); \
217#define Mmpierror(ierr, rout, ctxt, line, file)
225 fprintf(stderr, "%d: line %d of file %s\n", BI_Iam, __LINE__, __FILE__); \
232#define F_VOID_FUNC void
233#define F_INT_FUNC Int
234#define F_DOUBLE_FUNC double
236#if (INTFACE == C_CALL)
238#define F2C_CharTrans(c) *(c)
243#define F2C_CharTrans(c) *( _fcdtocp((c)) )
246#define F2C_CharTrans(c) *(c)
256#if (INTFACE == C_CALL)
257#define Mpval(para) (para)
258#define Mpaddress(para) (&(para))
259#define Mwalltime Cdwalltime00
261#define Mpval(para) (*(para))
262#define Mpaddress(para) (para)
263#define Mwalltime dwalltime00_
269#define Rabs(x) ( (x) < 0 ? (x) * -1 : (x) )
270#define Cabs(z) ( (((z).i) < 0 ? ((z).i) * -1 : ((z).i)) + (((z).r) < 0 ? ((z).r) * -1 : ((z).r)) )
275#define trsize(diag, m, n, bytes, length)\
277 if ( (diag) == 'u' ) (length) = 1;\
280 (length) = ( (n) * ( (m) - (n) ) + ( (n)*(n) ) - ( (n)*(n) )/2 +\
281 (n)/2 - (n) * (length) ) * (bytes);\
283 (length) = ( (m) * ( (n) - (m) ) + ( (m)*(m) ) - ( (m)*(m) )/2 +\
284 (m)/2 - (m) * (length) ) * (bytes);\
290#define BI_cmvcopy(m, n, A, lda, buff) \
291 BI_smvcopy(2*(m), (n), (float *) (A), 2*(lda), (float *) (buff))
292#define BI_cvmcopy(m, n, A, lda, buff) \
293 BI_svmcopy(2*(m), (n), (float *) (A), 2*(lda), (float *) (buff))
294#define BI_zmvcopy(m, n, A, lda, buff) \
295 BI_dmvcopy(2*(m), (n), (double *) (A), 2*(lda), (double *) (buff))
296#define BI_zvmcopy(m, n, A, lda, buff) \
297 BI_dvmcopy(2*(m), (n), (double *) (A), 2*(lda), (double *) (buff))
302#ifdef ZeroByteTypeBug
303#define BI_MPI_TYPE_FREE(t) (*(t) != MPI_BYTE ? MPI_Type_free(t) : 0)
305#define BI_MPI_TYPE_FREE(t) MPI_Type_free(t)
308#if (FORTRAN_CALL_C == NOCHANGE)
320#define blacs_pinfo_ blacs_pinfo
321#define blacs_setup_ blacs_setup
322#define setpvmtids_ setpvmtids
323#define blacs_set_ blacs_set
324#define blacs_get_ blacs_get
325#define blacs_gridinit_ blacs_gridinit
326#define blacs_gridmap_ blacs_gridmap
327#define ksendid_ ksendid
328#define krecvid_ krecvid
331#define blacs_freebuff_ blacs_freebuff
332#define blacs_gridexit_ blacs_gridexit
333#define blacs_abort_ blacs_abort
334#define blacs_exit_ blacs_exit
335#define blacs_gridinfo_ blacs_gridinfo
336#define blacs_pnum_ blacs_pnum
337#define blacs_pcoord_ blacs_pcoord
338#define dcputime00_ dcputime00
339#define dwalltime00_ dwalltime00
340#define blacs_barrier_ blacs_barrier
345#define igesd2d_ igesd2d
346#define igerv2d_ igerv2d
347#define igebs2d_ igebs2d
348#define igebr2d_ igebr2d
349#define itrsd2d_ itrsd2d
350#define itrrv2d_ itrrv2d
351#define itrbs2d_ itrbs2d
352#define itrbr2d_ itrbr2d
353#define igsum2d_ igsum2d
354#define igamx2d_ igamx2d
355#define igamn2d_ igamn2d
356#define sgesd2d_ sgesd2d
357#define sgerv2d_ sgerv2d
358#define sgebs2d_ sgebs2d
359#define sgebr2d_ sgebr2d
360#define strsd2d_ strsd2d
361#define strrv2d_ strrv2d
362#define strbs2d_ strbs2d
363#define strbr2d_ strbr2d
364#define sgsum2d_ sgsum2d
365#define sgamx2d_ sgamx2d
366#define sgamn2d_ sgamn2d
367#define dgesd2d_ dgesd2d
368#define dgerv2d_ dgerv2d
369#define dgebs2d_ dgebs2d
370#define dgebr2d_ dgebr2d
371#define dtrsd2d_ dtrsd2d
372#define dtrrv2d_ dtrrv2d
373#define dtrbs2d_ dtrbs2d
374#define dtrbr2d_ dtrbr2d
375#define dgsum2d_ dgsum2d
376#define dgamx2d_ dgamx2d
377#define dgamn2d_ dgamn2d
378#define cgesd2d_ cgesd2d
379#define cgerv2d_ cgerv2d
380#define cgebs2d_ cgebs2d
381#define cgebr2d_ cgebr2d
382#define ctrsd2d_ ctrsd2d
383#define ctrrv2d_ ctrrv2d
384#define ctrbs2d_ ctrbs2d
385#define ctrbr2d_ ctrbr2d
386#define cgsum2d_ cgsum2d
387#define cgamx2d_ cgamx2d
388#define cgamn2d_ cgamn2d
389#define zgesd2d_ zgesd2d
390#define zgerv2d_ zgerv2d
391#define zgebs2d_ zgebs2d
392#define zgebr2d_ zgebr2d
393#define ztrsd2d_ ztrsd2d
394#define ztrrv2d_ ztrrv2d
395#define ztrbs2d_ ztrbs2d
396#define ztrbr2d_ ztrbr2d
397#define zgsum2d_ zgsum2d
398#define zgamx2d_ zgamx2d
399#define zgamn2d_ zgamn2d
401#elif (FORTRAN_CALL_C == UPCASE)
412#define blacs_pinfo_ BLACS_PINFO
413#define blacs_setup_ BLACS_SETUP
414#define setpvmtids_ SETPVMTIDS
415#define blacs_set_ BLACS_SET
416#define blacs_get_ BLACS_GET
417#define blacs_gridinit_ BLACS_GRIDINIT
418#define blacs_gridmap_ BLACS_GRIDMAP
419#define ksendid_ KSENDID
420#define krecvid_ KRECVID
423#define blacs_freebuff_ BLACS_FREEBUFF
424#define blacs_gridexit_ BLACS_GRIDEXIT
425#define blacs_abort_ BLACS_ABORT
426#define blacs_exit_ BLACS_EXIT
427#define blacs_gridinfo_ BLACS_GRIDINFO
428#define blacs_pnum_ BLACS_PNUM
429#define blacs_pcoord_ BLACS_PCOORD
430#define dcputime00_ DCPUTIME00
431#define dwalltime00_ DWALLTIME00
432#define blacs_barrier_ BLACS_BARRIER
437#define igesd2d_ IGESD2D
438#define igerv2d_ IGERV2D
439#define igebs2d_ IGEBS2D
440#define igebr2d_ IGEBR2D
441#define itrsd2d_ ITRSD2D
442#define itrrv2d_ ITRRV2D
443#define itrbs2d_ ITRBS2D
444#define itrbr2d_ ITRBR2D
445#define igsum2d_ IGSUM2D
446#define igamx2d_ IGAMX2D
447#define igamn2d_ IGAMN2D
448#define sgesd2d_ SGESD2D
449#define sgerv2d_ SGERV2D
450#define sgebs2d_ SGEBS2D
451#define sgebr2d_ SGEBR2D
452#define strsd2d_ STRSD2D
453#define strrv2d_ STRRV2D
454#define strbs2d_ STRBS2D
455#define strbr2d_ STRBR2D
456#define sgsum2d_ SGSUM2D
457#define sgamx2d_ SGAMX2D
458#define sgamn2d_ SGAMN2D
459#define dgesd2d_ DGESD2D
460#define dgerv2d_ DGERV2D
461#define dgebs2d_ DGEBS2D
462#define dgebr2d_ DGEBR2D
463#define dtrsd2d_ DTRSD2D
464#define dtrrv2d_ DTRRV2D
465#define dtrbs2d_ DTRBS2D
466#define dtrbr2d_ DTRBR2D
467#define dgsum2d_ DGSUM2D
468#define dgamx2d_ DGAMX2D
469#define dgamn2d_ DGAMN2D
470#define cgesd2d_ CGESD2D
471#define cgerv2d_ CGERV2D
472#define cgebs2d_ CGEBS2D
473#define cgebr2d_ CGEBR2D
474#define ctrsd2d_ CTRSD2D
475#define ctrrv2d_ CTRRV2D
476#define ctrbs2d_ CTRBS2D
477#define ctrbr2d_ CTRBR2D
478#define cgsum2d_ CGSUM2D
479#define cgamx2d_ CGAMX2D
480#define cgamn2d_ CGAMN2D
481#define zgesd2d_ ZGESD2D
482#define zgerv2d_ ZGERV2D
483#define zgebs2d_ ZGEBS2D
484#define zgebr2d_ ZGEBR2D
485#define ztrsd2d_ ZTRSD2D
486#define ztrrv2d_ ZTRRV2D
487#define ztrbs2d_ ZTRBS2D
488#define ztrbr2d_ ZTRBR2D
489#define zgsum2d_ ZGSUM2D
490#define zgamx2d_ ZGAMX2D
491#define zgamn2d_ ZGAMN2D
493#elif (FORTRAN_CALL_C == FCISF2C)
503#define blacs_pinfo_ blacs_pinfo__
504#define blacs_setup_ blacs_setup__
505#define blacs_set_ blacs_set__
506#define blacs_get_ blacs_get__
507#define blacs_gridinit_ blacs_gridinit__
508#define blacs_gridmap_ blacs_gridmap__
512#define blacs_freebuff_ blacs_freebuff__
513#define blacs_gridexit_ blacs_gridexit__
514#define blacs_abort_ blacs_abort__
515#define blacs_exit_ blacs_exit__
519#define blacs_gridinfo_ blacs_gridinfo__
520#define blacs_pnum_ blacs_pnum__
521#define blacs_pcoord_ blacs_pcoord__
522#define blacs_barrier_ blacs_barrier__
void BI_BlacsErr(Int ConTxt, Int line, char *file, char *form,...)
void(* VVFUNPTR)(Int, char *, char *)
Int BI_ContxtNum(BLACSCONTEXT *ctxt)
void(* SDRVPTR)(BLACSCONTEXT *, Int, Int, BLACBUFF *)
void BI_BlacsWarn(Int ConTxt, Int line, char *file, char *form,...)