ScaLAPACK 2.1
2.1
ScaLAPACK: Scalable Linear Algebra PACKage
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
}
BUFFALIGN
#define BUFFALIGN
Definition:
Bdef.h:75
bLaCbUfF::Buff
char * Buff
Definition:
Bdef.h:56
BI_EmergencyBuff
void BI_EmergencyBuff(int length)
Definition:
BI_EmergencyBuff.c:8
bLaCbUfF::Len
int Len
Definition:
Bdef.h:57
bLaCbUfF
Definition:
Bdef.h:54
BI_ActiveQ
BLACBUFF * BI_ActiveQ
Definition:
BI_GlobalVars.c:9
Mwalltime
#define Mwalltime
Definition:
Bdef.h:263
BI_ReadyB
BLACBUFF * BI_ReadyB
Definition:
BI_GlobalVars.c:8
bLaCbUfF::Aops
MPI_Request * Aops
Definition:
Bdef.h:59
BI_Np
int BI_Np
Definition:
BI_GlobalVars.c:7
BUFWAIT
#define BUFWAIT
Definition:
Bdef.h:82
bLaCbUfF::nAops
int nAops
Definition:
Bdef.h:58
Bdef.h
BLACBUFF
struct bLaCbUfF BLACBUFF
Definition:
Bdef.h:53
BI_BlacsErr
void BI_BlacsErr(int ConTxt, int line, char *file, char *form,...)
Definition:
BI_BlacsErr.c:3
BI_UpdateBuffs
void BI_UpdateBuffs(BLACBUFF *Newbp)
Definition:
BI_UpdateBuffs.c:3
BLACS
SRC
BI_EmergencyBuff.c
Generated by
1.8.16