summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2002-04-03 04:44:26 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2002-04-03 04:44:26 (GMT)
commitad641fa7b617c8ca2ec11602cde0f72fa12696cd (patch)
tree8e08d800581c3c76c3339f50e7fc59d1b62405c8
parentc0ca09a89965e49df0cf1a1b11f955a7d1510a0f (diff)
downloadhdf5-ad641fa7b617c8ca2ec11602cde0f72fa12696cd.zip
hdf5-ad641fa7b617c8ca2ec11602cde0f72fa12696cd.tar.gz
hdf5-ad641fa7b617c8ca2ec11602cde0f72fa12696cd.tar.bz2
[svn-r5135] Purpose:
Features. Description: Error stack used to report only hdf5 predefined error messages because it takes only static strings. Runtime defined messages were not pushed to the stack. Added the means and macros to push MPI error strings onto the hdf5 error stack. Added a new minor error class as H5E_MPIERR for this class of messages. H5Epulbic.h, H5E.c: Added H5E_MPIERR and its minor class description. H5Eprivate.h: Added HMPI_XXX macros to push MPI error strings to the stack. H5FDmpio.c: Changed couple places to use the new macros to test the new macros. A more through changes to make use of these new macros will be done later. Platforms tested: eirene (serial, parallel) modi4(parallel)
-rw-r--r--src/H5E.c17
-rw-r--r--src/H5Eprivate.h22
-rw-r--r--src/H5Epublic.h3
-rw-r--r--src/H5FDmpio.c17
4 files changed, 48 insertions, 11 deletions
diff --git a/src/H5E.c b/src/H5E.c
index 19d1645..bf50045 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 1998-2001 NCSA HDF
- * All rights reserved.
+ * All rights reserved.
*
* Purpose: Provides error handling in the form of a stack. The
* FUNC_ENTER() macro clears the error stack whenever an API
@@ -29,7 +29,7 @@
*
*/
#include "H5private.h" /* Generic Functions */
-#include "H5Iprivate.h" /* IDs */
+#include "H5Iprivate.h" /* IDs */
#include "H5Eprivate.h" /* Private error routines */
#include "H5MMprivate.h" /* Memory management */
@@ -145,8 +145,9 @@ static const H5E_minor_mesg_t H5E_minor_mesg_g[] = {
{H5E_CANTGET, "Can't get value"},
{H5E_CANTSET, "Can't set value"},
- /* Parallel I/O errors */
- {H5E_MPI, "Some MPI function failed"}
+ /* Parallel MPI errors */
+ {H5E_MPI, "Some MPI function failed"},
+ {H5E_MPIERRSTR, "MPI Error String"}
};
/* Interface initialization? */
@@ -176,6 +177,14 @@ H5E_t H5E_stack_g[1];
#define H5E_get_my_stack() (H5E_stack_g+0)
#endif
+#ifdef H5_HAVE_PARALLEL
+/*
+ * variables used for MPI error reporting
+ */
+char H5E_mpi_error_str[MPI_MAX_ERROR_STRING];
+int H5E_mpi_error_str_len;
+#endif
+
/*
* Automatic error stack traversal occurs if the traversal callback function
* is non null and an API function is about to return an error. These should
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h
index a201111..e6f88f5 100644
--- a/src/H5Eprivate.h
+++ b/src/H5Eprivate.h
@@ -114,3 +114,25 @@ __DLL__ herr_t H5E_clear (void);
__DLL__ herr_t H5E_walk (H5E_direction_t dir, H5E_walk_t func,
void *client_data);
#endif
+
+#ifdef H5_HAVE_PARALLEL
+/*
+ * MPI error handling macros.
+ */
+
+extern char H5E_mpi_error_str[MPI_MAX_ERROR_STRING];
+extern int H5E_mpi_error_str_len;
+
+#define HMPI_ERROR(mpierr){ \
+ MPI_Error_string(mpierr, H5E_mpi_error_str, &H5E_mpi_error_str_len); \
+ HERROR(H5E_INTERNAL, H5E_MPIERRSTR, H5E_mpi_error_str); \
+}
+#define HMPI_GOTO_ERROR(retcode, str, mpierr){ \
+ HMPI_ERROR(mpierr); \
+ HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, retcode, str); \
+}
+#define HMPI_RETURN_ERROR(retcode, str, mpierr){ \
+ HMPI_ERROR(mpierr); \
+ HRETURN_ERROR(H5E_INTERNAL, H5E_MPI, retcode, str); \
+}
+#endif
diff --git a/src/H5Epublic.h b/src/H5Epublic.h
index e364b7e..254fa91 100644
--- a/src/H5Epublic.h
+++ b/src/H5Epublic.h
@@ -186,7 +186,8 @@ typedef enum H5E_minor_t {
H5E_CANTSET, /*Can't set value */
/* Parallel errors */
- H5E_MPI /*some MPI function failed */
+ H5E_MPI, /*some MPI function failed */
+ H5E_MPIERRSTR /*MPI Error String */
} H5E_minor_t;
/* Information about an error */
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 0888924..d6943f6 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -1,5 +1,5 @@
/*
- * Copyright © 1999-2001 NCSA
+ * Copyright (c) 1999-2002 NCSA
* All rights reserved.
*
* Programmer: Robb Matzke <matzke@llnl.gov>
@@ -719,6 +719,7 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id,
MPI_File fh;
int mpi_amode;
int mpi_rank;
+ int mpi_code; /* mpi return code */
MPI_Offset size;
const H5FD_mpio_fapl_t *fa=NULL;
H5FD_mpio_fapl_t _fa;
@@ -788,8 +789,9 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id,
#endif
/*OKAY: CAST DISCARDS CONST*/
- if (MPI_SUCCESS != MPI_File_open(fa->comm, (char*)name, mpi_amode, fa->info, &fh))
- HRETURN_ERROR(H5E_INTERNAL, H5E_MPI, NULL, "MPI_File_open failed");
+ if (MPI_SUCCESS !=
+ (mpi_code=MPI_File_open(fa->comm, (char*)name, mpi_amode, fa->info, &fh)))
+ HMPI_RETURN_ERROR(NULL, "MPI_File_open failed", mpi_code);
/* Following changes in handling file-truncation made be rkyates and ppweidhaas, sep 99 */
@@ -1551,9 +1553,11 @@ H5FD_mpio_flush(H5FD_t *_file)
{
H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
int mpi_rank=-1;
+ int mpi_code; /* mpi return code */
uint8_t byte=0;
MPI_Status mpi_stat = {0};
MPI_Offset mpi_off;
+ herr_t ret_value=SUCCEED;
FUNC_ENTER(H5FD_mpio_flush, FAIL);
@@ -1593,15 +1597,16 @@ H5FD_mpio_flush(H5FD_t *_file)
}
- if (MPI_SUCCESS != MPI_File_sync(file->f))
- HRETURN_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_File_sync failed");
+ if (MPI_SUCCESS != (mpi_code=MPI_File_sync(file->f)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_sync failed", mpi_code);
+done:
#ifdef H5FDmpio_DEBUG
if (H5FD_mpio_Debug[(int)'t'])
fprintf(stdout, "Leaving H5FD_mpio_flush\n" );
#endif
- FUNC_LEAVE(SUCCEED);
+ FUNC_LEAVE(ret_value);
}