diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-10-01 23:00:55 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-10-01 23:00:55 (GMT) |
commit | c719c2d3b876a3ac6f0aec7d776d5aaebf5e1fef (patch) | |
tree | a97c1f7b170139dd54ca3f126d3bb8eb50291b5a /src/H5S.c | |
parent | d5d34def1ca98fdacc9b31d992a865f07104d379 (diff) | |
download | hdf5-c719c2d3b876a3ac6f0aec7d776d5aaebf5e1fef.zip hdf5-c719c2d3b876a3ac6f0aec7d776d5aaebf5e1fef.tar.gz hdf5-c719c2d3b876a3ac6f0aec7d776d5aaebf5e1fef.tar.bz2 |
[svn-r9356] Purpose:
Bug fix & code cleanup
Description:
More dataset cleanups to get to a point where we can fix the chunked I/O
bug.
Also fix a couple of errors in the recent file object resurrection changes
which should hopefully address the recent daily test failres (H5T.c)
Platforms tested:
FreeBSD 4.10 (sleipnir) w/parallel
Solaris 2.7 (arabica)
h5committest
Diffstat (limited to 'src/H5S.c')
-rw-r--r-- | src/H5S.c | 260 |
1 files changed, 33 insertions, 227 deletions
@@ -33,12 +33,6 @@ static herr_t H5S_set_extent_simple (H5S_t *space, unsigned rank, const hsize_t *dims, const hsize_t *max); static htri_t H5S_is_simple(const H5S_t *sdim); -#ifdef H5_HAVE_PARALLEL -htri_t H5S_get_collective_io_consensus(const H5F_t *file, - const htri_t local_opinion, - const unsigned flags); -#endif /* H5_HAVE_PARALLEL */ - /* Interface initialization */ #define INTERFACE_INIT H5S_init_interface static int interface_initialize_g = 0; @@ -49,12 +43,12 @@ static herr_t H5S_init_interface(void); static const char *H5S_sel_names[]={ "none", "point", "hyperslab", "all" }; -#endif /* H5S_DEBUG */ /* The path table, variable length */ -static H5S_conv_t **H5S_conv_g = NULL; -static size_t H5S_aconv_g = 0; /*entries allocated*/ -static size_t H5S_nconv_g = 0; /*entries used*/ +static H5S_iostats_t **H5S_iostats_g = NULL; +static size_t H5S_aiostats_g = 0; /*entries allocated*/ +static size_t H5S_niostats_g = 0; /*entries used*/ +#endif /* H5S_DEBUG */ #ifdef H5_HAVE_PARALLEL /* Global vars whose value can be set from environment variable also */ @@ -132,12 +126,11 @@ done: int H5S_term_interface(void) { - size_t i; int n=0; - #ifdef H5S_DEBUG + size_t i; int j, nprints=0; - H5S_conv_t *path=NULL; + H5S_iostats_t *path=NULL; char buf[256]; #endif @@ -152,8 +145,8 @@ H5S_term_interface(void) * Print statistics about each conversion path. */ if (H5DEBUG(S)) { - for (i=0; i<H5S_nconv_g; i++) { - path = H5S_conv_g[i]; + for (i=0; i<H5S_niostats_g; i++) { + path = H5S_iostats_g[i]; for (j=0; j<2; j++) { if (0==path->stats[j].gath_ncalls && 0==path->stats[j].scat_ncalls && @@ -262,16 +255,18 @@ H5S_term_interface(void) } } } -#endif +#endif /* H5S_DEBUG */ /* Free data types */ H5I_destroy_group(H5I_DATASPACE); +#ifdef H5S_DEBUG /* Clear/free conversion table */ - for (i=0; i<H5S_nconv_g; i++) - H5MM_xfree(H5S_conv_g[i]); - H5S_conv_g = H5MM_xfree(H5S_conv_g); - H5S_nconv_g = H5S_aconv_g = 0; + for (i=0; i<H5S_niostats_g; i++) + H5MM_xfree(H5S_iostats_g[i]); + H5S_iostats_g = H5MM_xfree(H5S_iostats_g); + H5S_niostats_g = H5S_aiostats_g = 0; +#endif /* H5S_DEBUG */ /* Shut down interface */ interface_initialize_g = 0; @@ -1380,103 +1375,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } - -/*------------------------------------------------------------------------- - * Function: H5S_get_collective_io_consensus - * - * Purpose: Compare notes with all other processes involved in this I/O - * and see if all are go for collective I/O. - * - * If all are, return TRUE. - * - * If any process can't manage collective I/O, then collective - * I/O is impossible, and we return FALSE. - * - * If the flags indicate that collective I/O is impossible, - * skip the interprocess communication and just return FALSE. - * - * In any error is detected, return FAIL. - * - * Return: Success: TRUE or FALSE - * - * Failure: FAIL - * - * Programmer: JRM -- 8/30/04 - * - * Modifications: - * - * None. - * - *------------------------------------------------------------------------- - */ - -#ifdef H5_HAVE_PARALLEL -htri_t -H5S_get_collective_io_consensus(const H5F_t *file, - const htri_t local_opinion, - const unsigned flags) -{ - htri_t ret_value = FAIL; /* will update if successful */ - MPI_Comm comm; - int int_local_opinion; - int consensus; - int mpi_result; - - FUNC_ENTER_NOAPI(H5S_get_collective_io_consensus, NULL); - - HDassert ( ( local_opinion == TRUE ) || ( local_opinion == FALSE ) ); - - /* Don't do the interprocess communication unless the Parallel I/O - * conversion flag is set -- there may not be other processes to - * talk to. - */ - if ( ! ( flags & flags&H5S_CONV_PAR_IO_POSSIBLE ) ) { - - HGOTO_DONE(FALSE); - } - - comm = H5F_mpi_get_comm(file); - - if ( comm == MPI_COMM_NULL ) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, \ - "can't retrieve MPI communicator") - - if ( local_opinion == TRUE ) { - - int_local_opinion = 1; - - } else { - - int_local_opinion = 0; - } - - mpi_result = MPI_Allreduce((void *)(&int_local_opinion), - (void *)(&consensus), - 1, - MPI_INT, - MPI_LAND, - comm); - - if ( mpi_result != MPI_SUCCESS ) - HMPI_GOTO_ERROR(FAIL, "MPI_Allreduce failed", mpi_result) - - if ( consensus ) { - - ret_value = TRUE; - - } else { - - ret_value = FALSE; - } - -done: - - FUNC_LEAVE_NOAPI(ret_value); - -} /* H5S_get_collective_io_consensus() */ - -#endif /* H5_HAVE_PARALLEL */ - +#ifdef H5S_DEBUG /*------------------------------------------------------------------------- * Function: H5S_find @@ -1512,35 +1411,12 @@ done: * *------------------------------------------------------------------------- */ -H5S_conv_t * -H5S_find (const H5F_t -#ifndef H5_HAVE_PARALLEL -UNUSED -#endif/* H5_HAVE_PARALLEL*/ -*file, -const H5S_t *mem_space, const H5S_t *file_space, unsigned -#ifndef H5_HAVE_PARALLEL -UNUSED -#endif /* H5_HAVE_PARALLEL */ -flags, hbool_t -#ifndef H5_HAVE_PARALLEL -UNUSED -#endif /* H5_HAVE_PARALLEL */ -*use_par_opt_io, -#ifndef H5_HAVE_PARALLEL -UNUSED -#endif -const H5O_layout_t *layout - -) +H5S_iostats_t * +H5S_find (const H5S_t *mem_space, const H5S_t *file_space) { - H5S_conv_t *path=NULL; /* Space conversion path */ -#ifdef H5_HAVE_PARALLEL - htri_t opt; /* Flag whether a selection is optimizable */ -#endif /* H5_HAVE_PARALLEL */ - size_t i; /* Index variable */ - H5S_conv_t *ret_value; /* Return value */ - + H5S_iostats_t *path=NULL; /* Space conversion path */ + size_t u; /* Index variable */ + H5S_iostats_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5S_find, NULL); @@ -1554,47 +1430,10 @@ const H5O_layout_t *layout * Is this path already present in the data space conversion path table? * If so then return a pointer to that entry. */ - for (i=0; i<H5S_nconv_g; i++) { - if (H5S_conv_g[i]->ftype==H5S_GET_SELECT_TYPE(file_space) && - H5S_conv_g[i]->mtype==H5S_GET_SELECT_TYPE(mem_space)) { - -#ifdef H5_HAVE_PARALLEL - /* - * Check if we can set direct MPI-IO read/write functions - */ - opt=H5S_mpio_opt_possible(file,mem_space,file_space,flags,layout); - if(opt==FAIL) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, NULL, "invalid check for direct IO dataspace "); - - opt = H5S_get_collective_io_consensus(file, opt, flags); - - if ( opt == FAIL ) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, NULL, \ - "check for collective I/O consensus failed."); - - /* Check if we can use the optimized parallel I/O routines */ - if(opt==TRUE) { - /* Set the pointers to the MPI-specific routines */ - H5S_conv_g[i]->read = H5D_mpio_spaces_read; - H5S_conv_g[i]->write = H5D_mpio_spaces_write; - - /* Indicate that the I/O will be parallel */ - *use_par_opt_io=TRUE; - } /* end if */ - else { - /* Indicate that the I/O will _NOT_ be parallel */ - *use_par_opt_io=FALSE; - -#endif /* H5_HAVE_PARALLEL */ - H5S_conv_g[i]->read = H5S_select_read; - H5S_conv_g[i]->write = H5S_select_write; -#ifdef H5_HAVE_PARALLEL - } /* end else */ -#endif /* H5_HAVE_PARALLEL */ - - HGOTO_DONE(H5S_conv_g[i]); - } - } + for (u=0; u<H5S_niostats_g; u++) + if (H5S_iostats_g[u]->ftype==H5S_GET_SELECT_TYPE(file_space) && + H5S_iostats_g[u]->mtype==H5S_GET_SELECT_TYPE(mem_space)) + HGOTO_DONE(H5S_iostats_g[u]); /* * The path wasn't found. Create a new path. @@ -1606,53 +1445,19 @@ const H5O_layout_t *layout path->ftype = H5S_GET_SELECT_TYPE(file_space); path->mtype = H5S_GET_SELECT_TYPE(mem_space); -#ifdef H5_HAVE_PARALLEL - /* - * Check if we can set direct MPI-IO read/write functions - */ - opt=H5S_mpio_opt_possible(file,mem_space,file_space,flags,layout); - if(opt==FAIL) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, NULL, "invalid check for direct IO dataspace "); - - opt = H5S_get_collective_io_consensus(file, opt, flags); - - if ( opt == FAIL ) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, NULL, \ - "check for collective I/O consensus failed."); - - /* Check if we can use the optimized parallel I/O routines */ - if(opt==TRUE) { - /* Set the pointers to the MPI-specific routines */ - path->read = H5D_mpio_spaces_read; - path->write = H5D_mpio_spaces_write; - - /* Indicate that the I/O will be parallel */ - *use_par_opt_io=TRUE; - } /* end if */ - else { - /* Indicate that the I/O will _NOT_ be parallel */ - *use_par_opt_io=FALSE; - -#endif /* H5_HAVE_PARALLEL */ - path->read = H5S_select_read; - path->write = H5S_select_write; -#ifdef H5_HAVE_PARALLEL - } /* end else */ -#endif /* H5_HAVE_PARALLEL */ - /* * Add the new path to the table. */ - if (H5S_nconv_g>=H5S_aconv_g) { - size_t n = MAX(10, 2*H5S_aconv_g); - H5S_conv_t **p = H5MM_realloc(H5S_conv_g, n*sizeof(H5S_conv_g[0])); + if (H5S_niostats_g>=H5S_aiostats_g) { + size_t n = MAX(10, 2*H5S_aiostats_g); + H5S_iostats_t **p = H5MM_realloc(H5S_iostats_g, n*sizeof(H5S_iostats_g[0])); if (NULL==p) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for data space conversion path table"); - H5S_aconv_g = n; - H5S_conv_g = p; + H5S_aiostats_g = n; + H5S_iostats_g = p; } /* end if */ - H5S_conv_g[H5S_nconv_g++] = path; + H5S_iostats_g[H5S_niostats_g++] = path; /* Set the return value */ ret_value=path; @@ -1664,7 +1469,8 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value); -} +} /* end H5S_find() */ +#endif /* H5S_DEBUG */ /*------------------------------------------------------------------------- |