ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
blacs_grid_.c
Go to the documentation of this file.
1 #include "Bdef.h"
2 
3 #if (INTFACE == C_CALL)
4 void Cblacs_gridexit(int ConTxt)
5 #else
7 #endif
8 {
9  int i;
10  BLACSCONTEXT *ctxt;
11  extern int BI_MaxNCtxt;
12  extern BLACSCONTEXT **BI_MyContxts;
13 
14  if ( (Mpval(ConTxt) < 0) || (Mpval(ConTxt) >= BI_MaxNCtxt) )
15  BI_BlacsErr(Mpval(ConTxt), __LINE__, __FILE__,
16  "Trying to exit non-existent context");
17 
18  if (BI_MyContxts[Mpval(ConTxt)] == NULL)
19  BI_BlacsErr(Mpval(ConTxt), __LINE__, __FILE__,
20  "Trying to exit an already freed context");
21 
22  MGetConTxt(Mpval(ConTxt), ctxt);
23 /*
24  * Destroy context
25  */
26  MPI_Comm_free(&ctxt->pscp.comm);
27  MPI_Comm_free(&ctxt->ascp.comm);
28  MPI_Comm_free(&ctxt->rscp.comm);
29  MPI_Comm_free(&ctxt->cscp.comm);
30  free(ctxt);
31  BI_MyContxts[Mpval(ConTxt)] = NULL;
32 }
bLaCsCoNtExT::rscp
BLACSSCOPE rscp
Definition: Bdef.h:25
bLaCsCoNtExT::ascp
BLACSSCOPE ascp
Definition: Bdef.h:25
MGetConTxt
#define MGetConTxt(Context, ctxtptr)
Definition: Bdef.h:200
bLaCsCoNtExT::pscp
BLACSSCOPE pscp
Definition: Bdef.h:25
blacs_gridexit_
F_VOID_FUNC blacs_gridexit_(int *ConTxt)
Definition: blacs_grid_.c:6
Mpval
#define Mpval(para)
Definition: Bdef.h:261
bLaCsCoNtExT
Definition: Bdef.h:23
BI_MaxNCtxt
int BI_MaxNCtxt
Definition: BI_GlobalVars.c:5
F_VOID_FUNC
#define F_VOID_FUNC
Definition: Bdef.h:232
bLaCsCoNtExT::cscp
BLACSSCOPE cscp
Definition: Bdef.h:25
Cblacs_gridexit
void Cblacs_gridexit()
Bdef.h
bLaCsScOpE::comm
MPI_Comm comm
Definition: Bdef.h:15
BI_MyContxts
BLACSCONTEXT ** BI_MyContxts
Definition: BI_GlobalVars.c:11
BI_BlacsErr
void BI_BlacsErr(int ConTxt, int line, char *file, char *form,...)
Definition: BI_BlacsErr.c:3