ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
blacs_exit_.c
Go to the documentation of this file.
1 #include "Bdef.h"
2 
3 #if (INTFACE == C_CALL)
4 void Cblacs_exit(int NotDone)
5 #else
6 F_VOID_FUNC blacs_exit_(int *NotDone)
7 #endif
8 {
9  void BI_UpdateBuffs(BLACBUFF *);
10  BLACBUFF *BI_GetBuff(int);
11  int BI_BuffIsFree(BLACBUFF *, int);
12  BLACBUFF *bp;
14  int i;
15  extern int BI_MaxNCtxt, BI_Np;
16  extern BLACSCONTEXT **BI_MyContxts;
17 /*
18  * Destroy all contexts
19  */
20  for (i=0; i < BI_MaxNCtxt; i++) if (BI_MyContxts[i]) Cblacs_gridexit(i);
21  free(BI_MyContxts);
22 
23  if (BI_ReadyB) free(BI_ReadyB);
24  while (BI_ActiveQ != NULL)
25  {
26  bp = BI_ActiveQ;
27  BI_BuffIsFree(bp, 1); /* wait for async sends to complete */
28  BI_ActiveQ = bp->next;
29  free(bp);
30  }
31  free (BI_AuxBuff.Aops);
32 
33 /*
34  * Reset parameters to initial values
35  */
36  BI_MaxNCtxt = 0;
37  BI_MyContxts = NULL;
38  BI_Np = -1;
39  if (!Mpval(NotDone))
40  {
41  MPI_Finalize();
42  }
43  BI_ReadyB = NULL;
44 }
BI_GetBuff
BLACBUFF * BI_GetBuff(int length)
Definition: BI_GetBuff.c:36
bLaCbUfF::next
BLACBUFF * next
Definition: Bdef.h:62
blacs_exit_
F_VOID_FUNC blacs_exit_(int *NotDone)
Definition: blacs_exit_.c:6
bLaCbUfF
Definition: Bdef.h:54
Cblacs_exit
void Cblacs_exit()
BI_ActiveQ
BLACBUFF * BI_ActiveQ
Definition: BI_GlobalVars.c:9
BI_ReadyB
BLACBUFF * BI_ReadyB
Definition: BI_GlobalVars.c:8
bLaCbUfF::Aops
MPI_Request * Aops
Definition: Bdef.h:59
Mpval
#define Mpval(para)
Definition: Bdef.h:261
bLaCsCoNtExT
Definition: Bdef.h:23
BI_Np
int BI_Np
Definition: BI_GlobalVars.c:7
BI_MaxNCtxt
int BI_MaxNCtxt
Definition: BI_GlobalVars.c:5
F_VOID_FUNC
#define F_VOID_FUNC
Definition: Bdef.h:232
Cblacs_gridexit
void Cblacs_gridexit()
Bdef.h
BI_AuxBuff
BLACBUFF BI_AuxBuff
Definition: BI_GlobalVars.c:10
BI_MyContxts
BLACSCONTEXT ** BI_MyContxts
Definition: BI_GlobalVars.c:11
BI_UpdateBuffs
void BI_UpdateBuffs(BLACBUFF *Newbp)
Definition: BI_UpdateBuffs.c:3
BI_BuffIsFree
int BI_BuffIsFree(BLACBUFF *bp, int Wait)
Definition: BI_BuffIsFree.c:3