Commit 4cd3f512 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Clarify error-handling by decreasing redundant symbols.

parent 56a045a6
...@@ -112,25 +112,24 @@ void * pcdiXrealloc ( void *p, size_t size, const char *functionname, ...@@ -112,25 +112,24 @@ void * pcdiXrealloc ( void *p, size_t size, const char *functionname,
#ifdef USE_MPI #ifdef USE_MPI
void pcdiXMPI ( int iret, const char *filename, int line ) void pcdiXMPI ( int iret, const char *filename, int line )
{ {
char errorString1[MPI_MAX_ERROR_STRING + 1]; char errorString[2][MPI_MAX_ERROR_STRING + 1];
char errorString2[MPI_MAX_ERROR_STRING + 1];
int len, errorClass, rank; int len, errorClass, rank;
MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
if ( iret != MPI_SUCCESS ) if ( iret != MPI_SUCCESS )
{ {
MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
MPI_Error_class ( iret, &errorClass ); MPI_Error_class ( iret, &errorClass );
MPI_Error_string ( errorClass, errorString1, &len ); MPI_Error_string ( errorClass, errorString[0], &len );
errorString1[len] = '\0'; errorString[0][len] = '\0';
MPI_Error_string ( iret, errorString2, &len); MPI_Error_string ( iret, errorString[1], &len);
errorString2[len] = '\0'; errorString[1][len] = '\0';
fprintf ( stderr, "MPI ERROR, pe%d, %s, line %d," fprintf ( stderr, "MPI ERROR, pe%d, %s, line %d,"
"errorClass: \"%s\"" "errorClass: \"%s\""
"errorString: \"%s\"\n", "errorString: \"%s\"\n",
rank, filename, line, rank, filename, line,
errorString1, errorString2); errorString[0], errorString[1]);
MPI_Abort ( MPI_COMM_WORLD, iret ); MPI_Abort ( MPI_COMM_WORLD, iret );
} }
......
Markdown is supported
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