Commit b79064a6 authored by Deike Kleberg's avatar Deike Kleberg
Browse files

Bugfix, removed free of communicator not allocated.

parent da48aac1
......@@ -105,8 +105,8 @@ int main (int argc, char *argv[])
enum {
nProcsIO = 3,
//IOMode = PIO_NONE,
IOMode = PIO_MPI,
//IOMode = PIO_FPGUARD,
//IOMode = PIO_MPI,
IOMode = PIO_FPGUARD,
//IOMode = PIO_ASYNCH,
//IOMode = PIO_WRITER,
nNamespaces = 1 };
......@@ -116,12 +116,13 @@ int main (int argc, char *argv[])
#ifdef USE_MPI
MPI_Comm commGlob, commModel;
int sizeGlob;
int rankDebug;
int rankGlob;
xmpi ( MPI_Init ( &argc, &argv));
xmpi ( MPI_Comm_dup ( MPI_COMM_WORLD, &commGlob ));
xmpi ( MPI_Comm_set_errhandler ( commGlob, MPI_ERRORS_RETURN ));
xmpi ( MPI_Comm_size ( commGlob, &sizeGlob ));
xmpi ( MPI_Comm_rank ( commGlob, &rankGlob ));
commModel = pioInit_c ( commGlob, nProcsIO, IOMode, nNamespaces, hasLocalFile );
#endif
......
......@@ -80,13 +80,7 @@ void commDestroy ( void )
free ( info->commsIO );
info->commsIO = NULL;
}
if ( info->commCalc != MPI_COMM_NULL )
{
xmpi ( MPI_Comm_free ( &info->commCalc ));
info->commCalc = MPI_COMM_NULL;
}
if ( info->commColl != MPI_COMM_NULL )
{
xmpi ( MPI_Comm_free ( &info->commColl ));
......
......@@ -209,11 +209,12 @@ static
memcpy ( filename + filenamesz, endname, 1 );
getBufferGetFromEnd ( __func__, __LINE__,
root, &filetype, sizeof ( filetype ));
xassert ( filetype >= MINFILETYPE && filetype <= MAXFILETYPE );
streamID = streamOpenWrite ( filename, filetype );
free ( filename );
xdebug ( "READ FUNCTION CALL FROM WIN: %s, filenamesz=%d,"
" filename=%s, filetype=%d, opened stream %d",
" filename=%s, filetype=%d, OPENED STREAM %d",
funcMap[funcID], filenamesz, filename, filetype, streamID );
free ( filename );
}
break;
case STREAMDEFVLIST:
......@@ -418,19 +419,19 @@ void IOServer ()
tag = status.MPI_TAG;
switch ( tag )
{
case FINALIZE:
xdebugMsg ( tag, source, nfinished );
{
case FINALIZE:
xdebugMsg ( tag, source, nfinished );
iBuffer = xmalloc ( sizeof ( int ));
xmpi ( MPI_Recv ( iBuffer, 1, MPI_INTEGER, source,
xmpi ( MPI_Recv ( iBuffer, 1, MPI_INTEGER, source,
tag, commCalc, &status ));
xdebug ( "RECEIVED MESSAGE WITH TAG \"FINALIZE\"" );
free ( iBuffer );
nfinished++;
nfinished++;
xdebug ( "nfinished=%d, nProcsModel=%d",
nfinished, nProcsModel );
if ( nfinished == nProcsModel )
nfinished, nProcsModel );
if ( nfinished == nProcsModel )
{
{
int nStreams = streamSize ();
......@@ -450,12 +451,12 @@ void IOServer ()
backendCleanup ();
serverWinCleanup ();
arrayDestroy();
return;
}
break;
break;
case RESOURCES:
xdebugMsg ( tag, source, nfinished );
xmpi ( MPI_Get_count ( &status, MPI_CHAR, &size ));
......
......@@ -25,10 +25,12 @@ void pcdiAssert ( bool assumption, const char * filename,
MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
fprintf ( stderr, "ERROR, ASSUMPTION FALSE: PE%d in %s, %s, line %d\n",
rank, functionname, filename, line );
fflush ( stderr );
MPI_Abort ( MPI_COMM_WORLD, 1 );
#else
fprintf ( stderr, "ERROR ASSUMPTION FALSE, %s, %s, line %d\n",
functionname, filename, line );
fflush ( stderr );
abort();
#endif
}
......@@ -179,16 +181,17 @@ void pcdiDebugComm ( const char *filename, const char *functionname, int line, M
/****************************************************/
#ifdef USE_MPI
void pcdiDebugMsg ( const char *filename, const char *functionname, int line,
int tag, int source, int nfinished )
void pcdiDebugMsg ( const char * cdiPioDebugString, const char *filename,
const char *functionname, int line, int tag, int source,
int nfinished )
{
int rank;
MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
fprintf ( stdout,
"pe%d in %s, %s, line %d: command %s, source %d, finalized=%d\n",
rank, functionname, filename, line,
"%s pe%d in %s, %s, line %d: command %s, source %d, finalized=%d\n",
cdiPioDebugString, rank, functionname, filename, line,
&commands[tag][0], source, nfinished );
}
#endif
......@@ -253,8 +256,8 @@ double xchecksum ( int type, int count, void * buffer )
/****************************************************/
void printArray ( char * ps, const void * array, int n, int datatype,
const char * funname, const char * filename, int line )
void printArray ( const char * cdiPioDebugString, char * ps, const void * array, int n,
int datatype, const char * funname, const char * filename, int line )
{
int i, rank;
int * iArray;
......@@ -262,11 +265,11 @@ void printArray ( char * ps, const void * array, int n, int datatype,
#ifdef USE_MPI
MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
fprintf ( stdout, "pe%d in %s, %s, line %d: %s = ",
rank, funname, filename, line, ps );
fprintf ( stdout, "%s pe%d in %s, %s, line %d: %s = ",
cdiPioDebugString, rank, funname, filename, line, ps );
#else
fprintf ( stdout, "%s, %s, line %d: %s = ",
funname, filename, line, ps );
fprintf ( stdout, "%s %s, %s, line %d: %s = ",
cdiPioDebugString, funname, filename, line, ps );
#endif
switch ( datatype )
......
......@@ -32,9 +32,12 @@
#define MAXGHBUFFERSIZE_1 10
#define MAXSTRING 256
#define MINFILETYPE 1
#define MAXFILETYPE 9
#define ddebug 0
#define ddebug 0
static char * debugString = "#####";
void pcdiAssert ( bool, const char *, const char *, int );
......@@ -45,8 +48,8 @@ void pcdiAssert ( bool, const char *, const char *, int );
if ( ddebug ){ \
int rank; \
MPI_Comm_rank ( MPI_COMM_WORLD, &rank ); \
fprintf ( stderr, "pe%d in %s, %s, line %d: " fmt "\n", \
rank, __func__, __FILE__, __LINE__, \
fprintf ( stderr, "%s pe%d in %s, %s, line %d: " fmt "\n", \
debugString, rank, __func__, __FILE__, __LINE__, \
## __VA_ARGS__ ); \
}
......@@ -137,11 +140,11 @@ void pcdiDebugComm ( const char *filename, const char *functionname, int line, \
if ( ddebug ) pcdiDebugComm ( __FILE__, __func__, __LINE__, comm )
#endif
void pcdiDebugMsg ( const char *filename, const char *functionname, int line, \
void pcdiDebugMsg ( const char * cdiDebugString, const char *filename, const char *functionname, int line, \
int tag, int source, int nfinished );
#define xdebugMsg(tag,source,nfinished) \
if ( ddebug ) \
pcdiDebugMsg ( __FILE__, __func__, __LINE__, tag, source, nfinished )
pcdiDebugMsg ( debugString, __FILE__, __func__, __LINE__, tag, source, nfinished )
void pcdiDebugMsg2 ( const char *filename, const char *functionname, int line, \
int tag, int source, char * text );
......@@ -154,14 +157,14 @@ int xsum ( int, int * );
double xchecksum ( int, int, void * );
void printArray ( char *, const void *, int, int, const char *, const char *, int );
void printArray ( const char *, char *, const void *, int, int, const char *, const char *, int );
#define xprintArray(ps,array,n,datatype) \
if ( ddebug ) \
printArray ( ps, array, n, datatype, __func__, __FILE__, __LINE__ )
printArray ( debugString, ps, array, n, datatype, __func__, __FILE__, __LINE__ )
#define xprintArray3(ps,array,n,datatype) \
if ( ddebug == MAXDEBUG ) \
printArray ( ps, array, n, datatype, __func__, __FILE__, __LINE__ )
printArray ( debugString, ps, array, n, datatype, __func__, __FILE__, __LINE__ )
void reshArrayPrint ( char * );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment