SCALAPACK
2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
free_handle_.c
Go to the documentation of this file.
1
#include "
Bdef.h
"
2
3
#if (INTFACE == C_CALL)
4
void
Cfree_blacs_system_handle(
Int
ISysCtxt)
5
#else
6
void
free_blacs_system_handle_
(
Int
*ISysCxt)
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
16
if
( (ISysCtxt <
BI_MaxNSysCtxt
) && (ISysCtxt > 0) )
17
{
18
if
(
BI_SysContxts
[ISysCtxt] != MPI_COMM_NULL)
19
BI_SysContxts
[ISysCtxt] = MPI_COMM_NULL;
20
else
BI_BlacsWarn
(-1, __LINE__, __FILE__,
21
"Trying to free non-existent system context handle %d"
, ISysCtxt);
22
}
23
else
if
(ISysCtxt == 0)
return
;
/* never free MPI_COMM_WORLD */
24
else
BI_BlacsWarn
(-1, __LINE__, __FILE__,
25
"Trying to free non-existent system context handle %d"
, ISysCtxt);
26
27
/*
28
* See if we have freed enough space to decrease the size of our table
29
*/
30
for
(i=j=0; i <
BI_MaxNSysCtxt
; i++)
31
if
(
BI_SysContxts
[i] == MPI_COMM_NULL) j++;
32
/*
33
* If needed, get a smaller system context array
34
*/
35
if
(j > 2*
MAXNSYSCTXT
)
36
{
37
j =
BI_MaxNSysCtxt
-
MAXNSYSCTXT
;
38
tSysCtxt = (MPI_Comm *) malloc(j *
sizeof
(MPI_Comm));
39
for
(i=j=0; i <
BI_MaxNSysCtxt
; i++)
40
{
41
if
(
BI_SysContxts
[i] != MPI_COMM_NULL)
42
tSysCtxt[j++] =
BI_SysContxts
[i];
43
}
44
BI_MaxNSysCtxt
-=
MAXNSYSCTXT
;
45
for
(; j <
BI_MaxNSysCtxt
; j++) tSysCtxt[j] = MPI_COMM_NULL;
46
free(
BI_SysContxts
);
47
BI_SysContxts
= tSysCtxt;
48
}
49
#endif
50
}
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
MAXNSYSCTXT
#define MAXNSYSCTXT
Definition
Bdef.h:80
BI_BlacsWarn
void BI_BlacsWarn(Int ConTxt, Int line, char *file, char *form,...)
Definition
BI_BlacsWarn.c:3
Bdef.h
free_blacs_system_handle_
void free_blacs_system_handle_(Int *ISysCxt)
Definition
free_handle_.c:6
BLACS
SRC
free_handle_.c
Generated on Sun Jan 12 2025 15:58:37 for SCALAPACK by
1.9.8