diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2002-04-03 04:45:58 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2002-04-03 04:45:58 (GMT) |
commit | 7eb9f621767ab1f389fbfc151cd4123bc93ac01c (patch) | |
tree | 3d2623e91217dbc221c07ab493e5a28f30c465e7 | |
parent | 30eaf92786a6b3d07f00082f03a8215ed1335ff2 (diff) | |
download | hdf5-7eb9f621767ab1f389fbfc151cd4123bc93ac01c.zip hdf5-7eb9f621767ab1f389fbfc151cd4123bc93ac01c.tar.gz hdf5-7eb9f621767ab1f389fbfc151cd4123bc93ac01c.tar.bz2 |
[svn-r5136] 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.c | 47 | ||||
-rw-r--r-- | src/H5Eprivate.h | 22 | ||||
-rw-r--r-- | src/H5Epublic.h | 13 | ||||
-rw-r--r-- | src/H5FDmpio.c | 17 |
4 files changed, 79 insertions, 20 deletions
@@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 NCSA HDF + * Copyright (C) 1998-2001 NCSA HDF * All rights reserved. * * Purpose: Provides error handling in the form of a stack. The @@ -101,7 +101,9 @@ static const H5E_minor_mesg_t H5E_minor_mesg_g[] = { /* Object atom related errors */ {H5E_BADATOM, "Unable to find atom information (already closed?)"}, - {H5E_CANTREGISTER, "Unable to register new atom"}, + {H5E_CANTREGISTER, "Unable to register new atom"}, + {H5E_CANTINC, "Unable to increment reference count"}, + {H5E_CANTDEC, "Unable to decrement reference count"}, /* Cache related errors */ {H5E_CANTFLUSH, "Unable to flush data from cache"}, @@ -135,8 +137,17 @@ static const H5E_minor_mesg_t H5E_minor_mesg_g[] = { /* Datatype conversion errors */ {H5E_CANTCONVERT, "Can't convert datatypes"}, - /* Datatype conversion errors */ - {H5E_MPI, "Some MPI function failed"} + /* Dataspace errors */ + {H5E_CANTCLIP, "Can't clip hyperslab region"}, + {H5E_CANTCOUNT, "Can't count elements"}, + + /* Property list errors */ + {H5E_CANTGET, "Can't get value"}, + {H5E_CANTSET, "Can't set value"}, + + /* Parallel MPI errors */ + {H5E_MPI, "Some MPI function failed"}, + {H5E_MPIERRSTR, "MPI Error String"} }; /* Interface initialization? */ @@ -166,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 @@ -193,19 +212,19 @@ void *H5E_auto_data_g = NULL; * *------------------------------------------------------------------------- */ -H5E_t *H5E_get_stack() { - H5E_t *estack; +H5E_t *H5E_get_stack(void) +{ + H5E_t *estack = pthread_getspecific(H5TS_errstk_key_g); + + if (!estack) { + /* no associated value with current thread - create one */ + estack = (H5E_t *)H5MM_malloc(sizeof(H5E_t)); + pthread_setspecific(H5TS_errstk_key_g, (void *)estack); + } - if ((estack = pthread_getspecific(H5TS_errstk_key_g))!=NULL) { - return estack; - } else { - /* no associated value with current thread - create one */ - estack = (H5E_t *)malloc(sizeof(H5E_t)); - pthread_setspecific(H5TS_errstk_key_g, (void *)estack); return estack; - } } -#endif +#endif /* H5_HAVE_THREADSAFE */ /*------------------------------------------------------------------------- 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 f0b59c8..254fa91 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -142,6 +142,8 @@ typedef enum H5E_minor_t { /* Object atom related errors */ H5E_BADATOM, /*Can't find atom information */ H5E_CANTREGISTER, /*Can't register new atom */ + H5E_CANTINC, /*Can't increment reference count */ + H5E_CANTDEC, /*Can't decrement reference count */ /* Cache related errors */ H5E_CANTFLUSH, /*Can't flush object from cache */ @@ -175,8 +177,17 @@ typedef enum H5E_minor_t { /* Datatype conversion errors */ H5E_CANTCONVERT, /*Can't convert datatypes */ + /* Dataspace errors */ + H5E_CANTCLIP, /*Can't clip hyperslab region */ + H5E_CANTCOUNT, /*Can't count elements */ + + /* Property list errors */ + H5E_CANTGET, /*Can't get value */ + 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 890145b..d498a5f 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1,6 +1,6 @@ /* - * Copyright © 1999 NCSA - * All rights reserved. + * Copyright (c) 1999-2002 NCSA + * All rights reserved. * * Programmer: Robb Matzke <matzke@llnl.gov> * Thursday, July 29, 1999 @@ -699,6 +699,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; @@ -766,6 +767,9 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, #endif /*OKAY: CAST DISCARDS CONST*/ + 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); 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"); @@ -1507,9 +1511,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); @@ -1549,15 +1555,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); } |