SCALAPACK
2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
sys2blacs_.c
Go to the documentation of this file.
1
#include "
Bdef.h
"
2
3
#if (INTFACE == C_CALL)
4
Int
Csys2blacs_handle(MPI_Comm SysCtxt)
5
#else
6
Int
sys2blacs_handle_
(
Int
*SysCtxt)
7
#endif
8
{
9
#if (INTFACE == C_CALL)
10
Int
i, j, DEF_WORLD;
11
MPI_Comm *tSysCtxt;
12
extern
Int
BI_MaxNSysCtxt
;
13
extern
MPI_Comm *
BI_SysContxts
;
14
15
if
(
BI_COMM_WORLD
== NULL)
16
Cblacs_pinfo
(&i, &j);
17
if
(SysCtxt == MPI_COMM_NULL)
18
BI_BlacsErr
(-1, __LINE__, __FILE__,
19
"Cannot define a BLACS system handle based on MPI_COMM_NULL"
);
20
/*
21
* See if we already have this system handle stored
22
*/
23
for
(i=0; i <
BI_MaxNSysCtxt
; i++)
24
if
(
BI_SysContxts
[i] == SysCtxt)
return
(i);
25
/*
26
* The first time in this routine, we need to define MPI_COMM_WORLD, if it isn't
27
* what is already being defined.
28
*/
29
DEF_WORLD = ( (!
BI_SysContxts
) && (SysCtxt != MPI_COMM_WORLD) );
30
/*
31
* Find free slot in system context array
32
*/
33
for
(i=0; i <
BI_MaxNSysCtxt
; i++)
34
if
(
BI_SysContxts
[i] == MPI_COMM_NULL)
break
;
35
/*
36
* If needed, get a bigger system context array
37
*/
38
if
(i ==
BI_MaxNSysCtxt
)
39
{
40
j =
BI_MaxNSysCtxt
+
MAXNSYSCTXT
;
41
if
( (
MAXNSYSCTXT
== 1) && (DEF_WORLD) ) j++;
42
tSysCtxt = (MPI_Comm *) malloc(j *
sizeof
(MPI_Comm));
43
for
(i=0; i <
BI_MaxNSysCtxt
; i++) tSysCtxt[i] =
BI_SysContxts
[i];
44
BI_MaxNSysCtxt
= j;
45
for
(j=i; j <
BI_MaxNSysCtxt
; j++) tSysCtxt[j] = MPI_COMM_NULL;
46
if
(
BI_SysContxts
) free(
BI_SysContxts
);
47
BI_SysContxts
= tSysCtxt;
48
}
49
if
(DEF_WORLD)
BI_SysContxts
[i++] = MPI_COMM_WORLD;
50
BI_SysContxts
[i] = SysCtxt;
51
return
(i);
52
#else
53
return
(*SysCtxt);
54
#endif
55
}
BI_MaxNSysCtxt
Int BI_MaxNSysCtxt
Definition
BI_GlobalVars.c:6
BI_SysContxts
MPI_Comm * BI_SysContxts
Definition
BI_GlobalVars.c:12
Int
#define Int
Definition
Bconfig.h:22
BI_BlacsErr
void BI_BlacsErr(Int ConTxt, Int line, char *file, char *form,...)
Definition
BI_BlacsErr.c:3
BI_COMM_WORLD
Int * BI_COMM_WORLD
Definition
BI_GlobalVars.c:13
MAXNSYSCTXT
#define MAXNSYSCTXT
Definition
Bdef.h:80
Bdef.h
Cblacs_pinfo
void Cblacs_pinfo()
sys2blacs_handle_
Int sys2blacs_handle_(Int *SysCtxt)
Definition
sys2blacs_.c:6
BLACS
SRC
sys2blacs_.c
Generated on Sun Jan 12 2025 15:58:37 for SCALAPACK by
1.9.8