diff options
-rw-r--r-- | src/H5D.c | 71 | ||||
-rw-r--r-- | src/H5S.c | 28 | ||||
-rw-r--r-- | src/H5Sprivate.h | 6 |
3 files changed, 57 insertions, 48 deletions
@@ -23,7 +23,7 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* Object headers */ #include "H5Pprivate.h" /* Property lists */ -#include "H5Sprivate.h" /* Dataspace functions rky 980813 */ +#include "H5Sprivate.h" /* Dataspace functions */ #include "H5Vprivate.h" /* Vector and array functions */ #include "H5Zprivate.h" /* Data filters */ @@ -2009,7 +2009,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, H5O_fill_t fill; H5P_genplist_t *dx_plist=NULL; /* Property list */ H5P_genplist_t *dc_plist; /* Property list */ - + unsigned sconv_flags=0; /* Flags for the space conversion */ FUNC_ENTER(H5D_read, FAIL); @@ -2052,9 +2052,18 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to retrieve data xfer info"); } /* end if */ /* Collective access is not permissible without the MPIO driver */ - if (doing_mpio && xfer_mode==H5FD_MPIO_COLLECTIVE && - !(IS_H5FD_MPIO(dataset->ent.file))) + if (doing_mpio && xfer_mode==H5FD_MPIO_COLLECTIVE && !(IS_H5FD_MPIO(dataset->ent.file))) HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPIO driver only"); + + /* Set the "parallel I/O possible" flag, for H5S_find() */ + if (H5_mpi_opt_types_g && IS_H5FD_MPIO(dataset->ent.file)) { + /* Only collective write should call this since it eventually + * calls MPI_File_set_view which is a collective call. + * See H5S_mpio_spaces_xfer() for details. + */ + if (doing_mpio && xfer_mode==H5FD_MPIO_COLLECTIVE) + sconv_flags |= H5S_CONV_PAR_IO_POSSIBLE; + } /* end if */ #endif #ifdef QAK @@ -2081,26 +2090,9 @@ printf("%s: check 1.0, nelmts=%d, H5S_get_select_npoints(file_space)=%d\n",FUNC, } /* end if */ /* Get dataspace functions */ - if (NULL==(sconv=H5S_find(mem_space, file_space))) + if (NULL==(sconv=H5S_find(mem_space, file_space, sconv_flags))) HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert from file to memory data space"); -#ifdef H5_HAVE_PARALLEL - /* rky 980813 This is a temporary KLUGE. - * The sconv functions should be set by H5S_find, - * or we should use a different way to call the MPI-IO - * mem-and-file-dataspace-xfer functions - * (the latter in case the arguments to sconv_funcs - * turn out to be inappropriate for MPI-IO). */ - if (H5_mpi_opt_types_g && IS_H5FD_MPIO(dataset->ent.file)) { - /* Only collective write should call this since it eventually - * calls MPI_File_set_view which is a collective call. - * See H5S_mpio_spaces_xfer() for details. - */ - if (doing_mpio && xfer_mode==H5FD_MPIO_COLLECTIVE) - sconv->read = H5S_mpio_spaces_read; - } /* end if */ -#endif /*H5_HAVE_PARALLEL*/ - #ifdef QAK printf("%s: check 1.1, \n",FUNC); #endif /* QAK */ @@ -2472,6 +2464,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, H5O_fill_t fill; H5P_genplist_t *dx_plist=NULL; /* Property list */ H5P_genplist_t *dc_plist; /* Property list */ + unsigned sconv_flags=0; /* Flags for the space conversion */ FUNC_ENTER(H5D_write, FAIL); @@ -2540,7 +2533,17 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, if (doing_mpio && xfer_mode==H5FD_MPIO_COLLECTIVE && !(IS_H5FD_MPIO(dataset->ent.file))) HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPIO driver only"); -#endif + + /* Set the "parallel I/O possible" flag, for H5S_find() */ + if (H5_mpi_opt_types_g && IS_H5FD_MPIO(dataset->ent.file)) { + /* Only collective write should call this since it eventually + * calls MPI_File_set_view which is a collective call. + * See H5S_mpio_spaces_xfer() for details. + */ + if (doing_mpio && xfer_mode==H5FD_MPIO_COLLECTIVE) + sconv_flags |= H5S_CONV_PAR_IO_POSSIBLE; + } /* end if */ +#endif /*H5_HAVE_PARALLEL*/ #ifdef QAK printf("%s: check 0.5, nelmts=%d, mem_space->rank=%d\n", FUNC, (int)nelmts, mem_space->extent.u.simple.rank); @@ -2569,27 +2572,9 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, #endif /* QAK */ /* Get dataspace functions */ - if (NULL==(sconv=H5S_find(mem_space, file_space))) + if (NULL==(sconv=H5S_find(mem_space, file_space, sconv_flags))) HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert from memory to file data space"); -#ifdef H5_HAVE_PARALLEL - /* rky 980813 This is a temporary KLUGE. - * The sconv functions should be set by H5S_find, - * or we should use a different way to call the MPI-IO - * mem-and-file-dataspace-xfer functions - * (the latter in case the arguments to sconv_funcs - * turn out to be inappropriate for MPI-IO). */ - if (H5_mpi_opt_types_g && - IS_H5FD_MPIO(dataset->ent.file)) { - /* Only collective write should call this since it eventually - * calls MPI_File_set_view which is a collective call. - * See H5S_mpio_spaces_xfer() for details. - */ - if (doing_mpio && xfer_mode==H5FD_MPIO_COLLECTIVE) - sconv->write = H5S_mpio_spaces_write; - } /* end if */ -#endif /*H5_HAVE_PARALLEL*/ - /* * If there is no type conversion then try writing directly from * application buffer to file. @@ -3800,5 +3785,3 @@ herr_t H5D_update_chunk( H5D_t *dset ) } - - @@ -1494,7 +1494,7 @@ H5S_set_extent_simple (H5S_t *space, unsigned rank, const hsize_t *dims, *------------------------------------------------------------------------- */ H5S_conv_t * -H5S_find (const H5S_t *mem_space, const H5S_t *file_space) +H5S_find (const H5S_t *mem_space, const H5S_t *file_space, unsigned flags) { H5S_conv_t *path; /* Space conversion path */ htri_t c1,c2; /* Flags whether a selection is contiguous */ @@ -1531,8 +1531,19 @@ H5S_find (const H5S_t *mem_space, const H5S_t *file_space) HRETURN_ERROR(H5E_DATASPACE, H5E_BADRANGE, NULL, "invalid check for contiguous dataspace "); if (c1==TRUE && c2==TRUE) { +#ifdef H5_HAVE_PARALLEL + if(flags&H5S_CONV_PAR_IO_POSSIBLE) { + H5S_conv_g[i]->read = H5S_mpio_spaces_read; + H5S_conv_g[i]->write = H5S_mpio_spaces_write; + } /* end if */ + else { + H5S_conv_g[i]->read = H5S_all_read; + H5S_conv_g[i]->write = H5S_all_write; + } /* end else */ +#else /* H5_HAVE_PARALLEL */ H5S_conv_g[i]->read = H5S_all_read; H5S_conv_g[i]->write = H5S_all_write; +#endif /* H5_HAVE_PARALLEL */ } else { H5S_conv_g[i]->read = NULL; @@ -1569,8 +1580,19 @@ H5S_find (const H5S_t *mem_space, const H5S_t *file_space) HRETURN_ERROR(H5E_DATASPACE, H5E_BADRANGE, NULL, "invalid check for contiguous dataspace "); if (c1==TRUE && c2==TRUE) { - path->read = H5S_all_read; - path->write = H5S_all_write; +#ifdef H5_HAVE_PARALLEL + if(flags&H5S_CONV_PAR_IO_POSSIBLE) { + H5S_conv_g[i]->read = H5S_mpio_spaces_read; + H5S_conv_g[i]->write = H5S_mpio_spaces_write; + } /* end if */ + else { + H5S_conv_g[i]->read = H5S_all_read; + H5S_conv_g[i]->write = H5S_all_write; + } /* end else */ +#else /* H5_HAVE_PARALLEL */ + H5S_conv_g[i]->read = H5S_all_read; + H5S_conv_g[i]->write = H5S_all_write; +#endif /* H5_HAVE_PARALLEL */ } /* end if */ /* diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 86a46bc..713d52f 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -30,6 +30,9 @@ #define H5S_VALID_MAX 0x01 #define H5S_VALID_PERM 0x02 +/* Flags for H5S_find */ +#define H5S_CONV_PAR_IO_POSSIBLE 0x0001 + /* Forward references of common typedefs */ typedef struct H5S_t H5S_t; typedef struct H5S_pnt_node_t H5S_pnt_node_t; @@ -192,7 +195,8 @@ __DLLVAR__ const H5S_mconv_t H5S_HYPER_MCONV[]; __DLL__ H5S_t *H5S_create(H5S_class_t type); __DLL__ H5S_t *H5S_copy(const H5S_t *src); __DLL__ herr_t H5S_close(H5S_t *ds); -__DLL__ H5S_conv_t *H5S_find(const H5S_t *mem_space, const H5S_t *file_space); +__DLL__ H5S_conv_t *H5S_find(const H5S_t *mem_space, const H5S_t *file_space, + unsigned flags); __DLL__ H5S_class_t H5S_get_simple_extent_type(const H5S_t *ds); __DLL__ hssize_t H5S_get_simple_extent_npoints(const H5S_t *ds); __DLL__ hsize_t H5S_get_npoints_max(const H5S_t *ds); |