diff options
author | Albert Cheng <acheng@hdfgroup.org> | 1998-04-13 04:31:23 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 1998-04-13 04:31:23 (GMT) |
commit | 33a49221fccc5adc7ec9c5a556be4f6cb72f4e34 (patch) | |
tree | 9eab81feeb1694e8700bcb2e282d4df673bc2dbd /src/H5D.c | |
parent | 1a7e4bcd6c61b8f89001b8de9946995e579e1e79 (diff) | |
download | hdf5-33a49221fccc5adc7ec9c5a556be4f6cb72f4e34.zip hdf5-33a49221fccc5adc7ec9c5a556be4f6cb72f4e34.tar.gz hdf5-33a49221fccc5adc7ec9c5a556be4f6cb72f4e34.tar.bz2 |
[svn-r343] First implementation of collective access support.
H5D.c
Changed H5D_write and H5D_read to recognize collective transfer
requests. Current algorithm puts the xfer-mode in the file->mpio
structure. Not thread safe. Need to revise it to pass transfer
parameter as a function parameters to the lower levels.
H5Dprivate.h
H5Dpublic.h
Added xfer_mode to the transfer property list structure.
Added defination of transfer modes, H5D_XFER_INDEPENDENT and
H5D_XFER_COLLECTIVE.
H5Farray.c
Added code to handle collective access requests. Currently
works for one contiguous block at a time. Need to revise
it with the MPIO low level calls to combine all blocks as
one truely collective call.
H5P.c
H5Ppublic.h
Added H5Pset_xfer and H5Pget_xfer routines that can set and get
the transfer mode of a data transfer property list.
Diffstat (limited to 'src/H5D.c')
-rw-r--r-- | src/H5D.c | 120 |
1 files changed, 120 insertions, 0 deletions
@@ -67,6 +67,9 @@ const H5D_xfer_t H5D_xfer_dflt = { NULL, /* Type conversion buffer or NULL */ NULL, /* Background buffer or NULL */ H5T_BKG_NO, /* Type of background buffer needed */ +#ifdef HAVE_PARALLEL + H5D_XFER_INDEPENDENT, /* Independent data transfer */ +#endif }; /* Interface initialization? */ @@ -1108,6 +1111,9 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, size_t target_size; /*desired buffer size */ size_t request_nelmts; /*requested strip mine */ H5T_bkg_t need_bkg; /*type of background buf*/ +#ifdef HAVE_PARALLEL + int access_mode_saved = -1; +#endif FUNC_ENTER(H5D_read, FAIL); @@ -1149,6 +1155,52 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, "unable to convert from file to memory data space"); } +#ifdef HAVE_PARALLEL + /* + * Check if collective data transfer requested. + */ + if (xfer_parms->xfer_mode == H5D_XFER_COLLECTIVE){ + /* verify that the file can support collective access. */ + /* The check may not be necessarily since collective access */ + /* can always be simulated by independent access. */ + /* Nevertheless, must check driver is MPIO before using those */ + /* access_mode which exists only for MPIO case. */ + if (dataset->ent.file->shared->access_parms.driver == H5F_LOW_MPIO){ + /* Supports only no conversion, type or space, for now. */ + if (H5T_conv_noop==tconv_func && + NULL!=sconv_func->read) { + /* + * -AKC- + * "plant" the collective access mode into the file information + * so that the lower level mpio routines know to use collective + * access. + * This is not thread-safe, is a klutch for now. + * Should change all the I/O routines to pass along the xfer + * property list to the low level I/O for proper execution. + * Make it to work now. Must fix it later. + * -AKC- + */ +#ifdef AKC + printf("%s: collective access requested\n", FUNC); + printf("%s: current f->access_mode = %x\n", FUNC, + dataset->ent.file->shared->access_parms.u.mpio.access_mode); +#endif + access_mode_saved = dataset->ent.file->shared->access_parms.u.mpio.access_mode; + dataset->ent.file->shared->access_parms.u.mpio.access_mode = H5ACC_COLLECTIVE; + status = (sconv_func->read)(dataset->ent.file, &(dataset->layout), + &(dataset->create_parms->efl), + H5T_get_size (dataset->type), file_space, + mem_space, buf/*out*/); + if (status>=0) goto succeed; + HGOTO_ERROR (H5E_DATASET, H5E_READERROR, FAIL, + "collective read failed"); + } + } + HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, + "collective access not permissible"); + } +#endif /*HAVE_PARALLEL*/ + /* * If there is no type conversion then try reading directly into the @@ -1293,6 +1345,15 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, if (bkg_buf && NULL==xfer_parms->bkg_buf) { H5MM_xfree (bkg_buf); } +#ifdef HAVE_PARALLEL + /* + * Check if collective data transfer requested. + * If so, need to restore the access mode. Shouldnot needed. + */ + if (xfer_parms->xfer_mode == H5D_XFER_COLLECTIVE){ + dataset->ent.file->shared->access_parms.u.mpio.access_mode = access_mode_saved; + } +#endif /*HAVE_PARALLEL*/ FUNC_LEAVE(ret_value); } @@ -1335,6 +1396,9 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, size_t target_size; /*desired buffer size */ size_t request_nelmts; /*requested strip mine */ H5T_bkg_t need_bkg; /*type of background buf*/ +#ifdef HAVE_PARALLEL + int access_mode_saved = -1; +#endif FUNC_ENTER(H5D_write, FAIL); @@ -1376,6 +1440,53 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, "unable to convert from memory to file data space"); } +#ifdef HAVE_PARALLEL + /* + * Check if collective data transfer requested. + */ + if (xfer_parms->xfer_mode == H5D_XFER_COLLECTIVE){ + /* verify that the file can support collective access. */ + /* The check may not be necessarily since collective access */ + /* can always be simulated by independent access. */ + /* Nevertheless, must check driver is MPIO before using those */ + /* access_mode which exists only for MPIO case. */ + if (dataset->ent.file->shared->access_parms.driver == H5F_LOW_MPIO){ + /* Supports only no conversion, type or space, for now. */ + if (H5T_conv_noop==tconv_func && + NULL!=sconv_func->write) { + /* + * -AKC- + * "plant" the collective access mode into the file information + * so that the lower level mpio routines know to use collective + * access. + * This is not thread-safe, is a klutch for now. + * Should change all the I/O routines to pass along the xfer + * property list to the low level I/O for proper execution. + * Make it to work now. Must fix it later. + * -AKC- + */ +#ifdef AKC + printf("%s: collective access requested\n", FUNC); + printf("%s: current f->access_mode = %x\n", FUNC, + dataset->ent.file->shared->access_parms.u.mpio.access_mode); +#endif + access_mode_saved = dataset->ent.file->shared->access_parms.u.mpio.access_mode; + dataset->ent.file->shared->access_parms.u.mpio.access_mode = H5ACC_COLLECTIVE; + status = (sconv_func->write)(dataset->ent.file, &(dataset->layout), + &(dataset->create_parms->efl), + H5T_get_size (dataset->type), file_space, + mem_space, buf); + if (status>=0) goto succeed; + HGOTO_ERROR (H5E_DATASET, H5E_WRITEERROR, FAIL, + "collective write failed"); + } + } + HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, + "collective access not permissible"); + } +#endif /*HAVE_PARALLEL*/ + + /* * If there is no type conversion then try writing directly from * application buffer to file. @@ -1522,6 +1633,15 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, if (bkg_buf && NULL==xfer_parms->bkg_buf) { H5MM_xfree (bkg_buf); } +#ifdef HAVE_PARALLEL + /* + * Check if collective data transfer requested. + * If so, need to restore the access mode. Shouldnot needed. + */ + if (xfer_parms->xfer_mode == H5D_XFER_COLLECTIVE){ + dataset->ent.file->shared->access_parms.u.mpio.access_mode = access_mode_saved; + } +#endif /*HAVE_PARALLEL*/ FUNC_LEAVE(ret_value); } |