SCALAPACK
2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
BI_EmergencyBuff.c
Go to the documentation of this file.
1
#include "
Bdef.h
"
2
3
/***************************************************************************
4
* If there is insufficient space to allocate a needed buffer, this *
5
* routine is called. It moniters active buffers for the time defined by *
6
* the user-changeable macro value BUFWAIT. If in that time no active *
7
* buffer becomes inactive, a hang is assumed, and the grid is killed. *
8
***************************************************************************/
9
void
BI_EmergencyBuff
(
Int
length)
10
{
11
void
BI_UpdateBuffs
(
BLACBUFF
*);
12
13
char
*cptr;
14
Int
i, j;
15
double
Mwalltime
(
void
);
16
double
t1;
17
extern
Int
BI_Np
;
18
extern
BLACBUFF
*
BI_ReadyB
, *
BI_ActiveQ
;
19
20
j =
sizeof
(
BLACBUFF
);
21
if
(j %
sizeof
(MPI_Request))
22
j +=
sizeof
(MPI_Request) - j %
sizeof
(MPI_Request);
23
i = j +
BI_Np
*
sizeof
(MPI_Request);
24
if
(i %
BUFFALIGN
) i +=
BUFFALIGN
- i %
BUFFALIGN
;
25
t1 =
Mwalltime
();
26
while
( (
BI_ActiveQ
) && (
Mwalltime
() - t1 <
BUFWAIT
) && !(
BI_ReadyB
) )
27
{
28
BI_UpdateBuffs
(NULL);
29
if
(
BI_ReadyB
)
30
{
31
if
(
BI_ReadyB
->
Len
< length)
32
{
33
free(
BI_ReadyB
);
34
cptr = malloc(length + i);
35
BI_ReadyB
= (
BLACBUFF
*) cptr;
36
if
(
BI_ReadyB
)
37
{
38
BI_ReadyB
->
nAops
= 0;
39
BI_ReadyB
->
Aops
= (MPI_Request *) &cptr[j];
40
BI_ReadyB
->
Buff
= &cptr[i];
41
BI_ReadyB
->
Len
= length;
42
}
43
}
44
}
45
}
46
if
(
BI_ReadyB
== NULL)
47
{
48
BI_BlacsErr
(-1, __LINE__, __FILE__,
"BLACS out of buffer space"
);
49
}
50
}
BI_EmergencyBuff
void BI_EmergencyBuff(Int length)
Definition
BI_EmergencyBuff.c:9
BI_ReadyB
BLACBUFF * BI_ReadyB
Definition
BI_GlobalVars.c:8
BI_Np
Int BI_Np
Definition
BI_GlobalVars.c:7
BI_ActiveQ
BLACBUFF * BI_ActiveQ
Definition
BI_GlobalVars.c:9
BI_UpdateBuffs
void BI_UpdateBuffs(BLACBUFF *Newbp)
Definition
BI_UpdateBuffs.c:3
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
BUFWAIT
#define BUFWAIT
Definition
Bdef.h:82
BLACBUFF
struct bLaCbUfF BLACBUFF
Definition
Bdef.h:53
Mwalltime
#define Mwalltime
Definition
Bdef.h:263
BUFFALIGN
#define BUFFALIGN
Definition
Bdef.h:75
Bdef.h
bLaCbUfF::Len
Int Len
Definition
Bdef.h:57
bLaCbUfF::Aops
MPI_Request * Aops
Definition
Bdef.h:59
bLaCbUfF::nAops
Int nAops
Definition
Bdef.h:58
bLaCbUfF::Buff
char * Buff
Definition
Bdef.h:56
bLaCbUfF
Definition
Bdef.h:55
BLACS
SRC
BI_EmergencyBuff.c
Generated on Sun Jan 12 2025 15:58:37 for SCALAPACK by
1.9.8