From dadb964ba64517ce3ae2628e6155555fc5542e65 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Sat, 6 Jun 1998 23:38:16 -0500 Subject: [svn-r411] Added data-transfer-mode to various function to specify which mode to use for data transfer. Currently, INDEPENDENT transfer is the default mode. Collective is supported for files opened via the MPIO driver. Specific changes to individual files follow. H5D.c: Replaced previous kludge of passing xfer_mode via the file access_mode with xfer_mode function parameter all the way to the low level I/O drivers. H5Dprivate.h: The H5D_xfer_t.xfer_mode is now used in serial and parallel modes. Removed the "HAVE_PARALLEL" macro condition to support it. H5Dpublic.h: Added H5D_XFER_DFLT as a new value for H5D_transfer_t and removed the HAVE_PARALLEL condition macro to make the H5D_transfer_t definition available to both serial and parallel version. H5B.c: H5F.c: H5Farray.c: H5Fcore.c: H5Ffamily.c: H5Fistore.c: H5Flow.c: H5Fmpio.c: H5Fsec2.c: H5Fsplit.c: H5Fstdio.c: H5Gnode.c: H5HG.c: H5HL.c: H5O.c: H5Sprivate.h: H5Ssimp.c: debug.c: Added xfer_mode to the argument lists of the following routines to specify data transfer mode. Then updated calls to these routines with appropriate transfer mode. Whenever cases that collective mode is inappropriate (e.g. object header read-write, flush), H5D_XFER_DFLT is used. The H5D_XFER_DFLT mode is currently acting the same as the independent mode. H5F_block_read H5F_block_write H5F_arr_read H5F_arr_write H5F_core_read H5F_core_write H5F_fam_read H5F_fam_write H5F_mpio_read H5F_mpio_write H5F_low_write H5F_low_read H5F_sec2_read H5F_sec2_write H5F_split_read H5F_split_write H5F_stdio_read H5F_stdio_write H5S_simp_fgath H5S_simp_fscat H5S_simp_read H5S_simp_write H5Fprivate.h: H5P.c: Removed access_mode field from struct H5F_access_t type. The access-mode was the initial design to control independent or collective I/O mode. It is now supported by the data transfer mode. --- src/H5B.c | 9 +++-- src/H5D.c | 109 ++++++++++++------------------------------------------- src/H5Distore.c | 5 ++- src/H5Dprivate.h | 2 - src/H5Dpublic.h | 5 +-- src/H5F.c | 26 ++++++++----- src/H5Farray.c | 36 ++++++------------ src/H5Fcore.c | 8 ++++ src/H5Ffamily.c | 16 ++++++-- src/H5Fistore.c | 5 ++- src/H5Flow.c | 20 +++++++--- src/H5Fmpio.c | 41 ++++++++++++--------- src/H5Fprivate.h | 20 ++++++---- src/H5Fsec2.c | 8 ++++ src/H5Fsplit.c | 14 ++++++- src/H5Fstdio.c | 8 ++++ src/H5Gnode.c | 4 +- src/H5HG.c | 8 ++-- src/H5HL.c | 10 +++-- src/H5O.c | 9 +++-- src/H5P.c | 6 ++- src/H5Sprivate.h | 20 ++++++---- src/H5Ssimp.c | 28 ++++++++++---- src/debug.c | 2 +- 24 files changed, 218 insertions(+), 201 deletions(-) diff --git a/src/H5B.c b/src/H5B.c index 69b64cb1..9ba878e 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -281,7 +281,7 @@ H5B_load(H5F_t *f, const haddr_t *addr, const void *_type, void *udata) bt->native = H5MM_xmalloc(total_nkey_size); bt->key = H5MM_xmalloc((2 * H5B_K(f, type) + 1) * sizeof(H5B_key_t)); bt->child = H5MM_xmalloc(2 * H5B_K(f, type) * sizeof(haddr_t)); - if (H5F_block_read(f, addr, (hsize_t)size, bt->page) < 0) { + if (H5F_block_read(f, addr, (hsize_t)size, H5D_XFER_DFLT, bt->page) < 0) { HRETURN_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree node"); } @@ -424,7 +424,8 @@ H5B_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5B_t *bt) * bother writing data for the child entries that don't exist or * for the final unchanged children. */ - if (H5F_block_write(f, addr, (hsize_t)size, bt->page) < 0) { + if (H5F_block_write(f, addr, (hsize_t)size, H5D_XFER_DFLT, + bt->page) < 0) { HRETURN_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree node to disk"); } @@ -828,11 +829,11 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, const haddr_t *addr, HRETURN_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to flush B-tree root node"); } - if (H5F_block_read(f, addr, (hsize_t)size, buf) < 0) { + if (H5F_block_read(f, addr, (hsize_t)size, H5D_XFER_DFLT, buf) < 0) { HRETURN_ERROR(H5E_BTREE, H5E_READERROR, FAIL, "unable to read B-tree root node"); } - if (H5F_block_write(f, &old_root, (hsize_t)size, buf) < 0) { + if (H5F_block_write(f, &old_root, (hsize_t)size, H5D_XFER_DFLT, buf) < 0) { HRETURN_ERROR(H5E_BTREE, H5E_WRITEERROR, FAIL, "unable to move B-tree root node"); } diff --git a/src/H5D.c b/src/H5D.c index 2141200..92fbccd 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -76,7 +76,7 @@ const H5D_xfer_t H5D_xfer_dflt = { NULL, /* Background buffer or NULL */ H5T_BKG_NO, /* Type of background buffer needed */ #ifdef HAVE_PARALLEL - H5D_XFER_INDEPENDENT, /* Independent data transfer */ + H5D_XFER_DFLT, /* Independent data transfer */ #endif }; @@ -1155,9 +1155,6 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, #ifdef H5T_DEBUG H5_timer_t timer; #endif -#ifdef HAVE_PARALLEL - int access_mode_saved = -1; -#endif FUNC_ENTER(H5D_read, FAIL); @@ -1180,29 +1177,9 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* 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){ - /* - * -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); -#endif - access_mode_saved = - dataset->ent.file->shared->access_parms->u.mpio.access_mode; - dataset->ent.file->shared->access_parms->u.mpio.access_mode = - H5D_XFER_COLLECTIVE; - }else{ + if (dataset->ent.file->shared->access_parms->driver != H5F_LOW_MPIO) HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access not permissible"); - } } #endif /*HAVE_PARALLEL*/ @@ -1241,18 +1218,19 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, * Check if collective data transfer requested. */ if (xfer_parms->xfer_mode == H5D_XFER_COLLECTIVE){ - /* Supports only no conversion, type or space, for now. */ - if (H5T_conv_noop==tconv_func && - NULL!=sconv_func->read) { - status = (sconv_func->read)(dataset->ent.file, &(dataset->layout), - &(dataset->create_parms->compress), - &(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"); - } + /* Supports only no conversion, type or space, for now. */ + if (H5T_conv_noop==tconv_func && + NULL!=sconv_func->read) { + status = (sconv_func->read)(dataset->ent.file, &(dataset->layout), + &(dataset->create_parms->compress), + &(dataset->create_parms->efl), + H5T_get_size (dataset->type), file_space, + mem_space, xfer_parms->xfer_mode, + buf/*out*/); + if (status>=0) goto succeed; + HGOTO_ERROR (H5E_DATASET, H5E_READERROR, FAIL, + "collective read failed"); + } } #endif /*HAVE_PARALLEL*/ @@ -1268,7 +1246,8 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, &(dataset->create_parms->compress), &(dataset->create_parms->efl), H5T_get_size (dataset->type), file_space, - mem_space, buf/*out*/); + mem_space, xfer_parms->xfer_mode, + buf/*out*/); if (status>=0) goto succeed; #ifdef H5D_DEBUG fprintf (stderr, "H5D: data space conversion could not be optimized " @@ -1356,6 +1335,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, &(dataset->create_parms->efl), H5T_get_size (dataset->type), file_space, &numbering, smine_start, smine_nelmts, + xfer_parms->xfer_mode, tconv_buf/*out*/)!=smine_nelmts) { HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file gather failed"); } @@ -1407,15 +1387,6 @@ 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); } @@ -1461,9 +1432,6 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, #ifdef H5T_DEBUG H5_timer_t timer; #endif -#ifdef HAVE_PARALLEL - int access_mode_saved = -1; -#endif FUNC_ENTER(H5D_write, FAIL); @@ -1486,30 +1454,9 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* 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){ - /* - * -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); -#endif - access_mode_saved = - dataset->ent.file->shared->access_parms->u.mpio.access_mode; - dataset->ent.file->shared->access_parms->u.mpio.access_mode = - H5D_XFER_COLLECTIVE; - } - else{ + if (dataset->ent.file->shared->access_parms->driver != H5F_LOW_MPIO) HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access not permissible"); - } } #endif /*HAVE_PARALLEL*/ @@ -1543,7 +1490,6 @@ 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 NO #ifdef HAVE_PARALLEL /* * Check if collective data transfer requested. @@ -1556,14 +1502,13 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, &(dataset->create_parms->compress), &(dataset->create_parms->efl), H5T_get_size (dataset->type), file_space, - mem_space, buf); + mem_space, xfer_parms->xfer_mode, buf); if (status>=0) goto succeed; HGOTO_ERROR (H5E_DATASET, H5E_WRITEERROR, FAIL, "collective write failed"); } } #endif /*HAVE_PARALLEL*/ -#endif /* @@ -1577,7 +1522,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, &(dataset->create_parms->compress), &(dataset->create_parms->efl), H5T_get_size (dataset->type), file_space, - mem_space, buf); + mem_space, xfer_parms->xfer_mode, buf); if (status>=0) goto succeed; #ifdef H5D_DEBUG fprintf (stderr, "H5D: data space conversion could not be optimized " @@ -1672,6 +1617,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, &(dataset->create_parms->efl), H5T_get_size (dataset->type), file_space, &numbering, smine_start, smine_nelmts, + xfer_parms->xfer_mode, bkg_buf/*out*/)!=smine_nelmts) { HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "file gather failed"); @@ -1703,7 +1649,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, &(dataset->create_parms->efl), H5T_get_size (dataset->type), file_space, &numbering, smine_start, smine_nelmts, - tconv_buf)<0) { + xfer_parms->xfer_mode, tconv_buf)<0) { HGOTO_ERROR (H5E_DATASET, H5E_WRITEERROR, FAIL, "scatter failed"); } } @@ -1720,15 +1666,6 @@ 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); } diff --git a/src/H5Distore.c b/src/H5Distore.c index 91c4e9d..54b797d 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -713,7 +713,7 @@ H5F_istore_flush_entry (H5F_t *f, H5F_rdcc_ent_t *ent) HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk"); } - if (H5F_block_write (f, &(udata.addr), nbytes, out_ptr)<0) { + if (H5F_block_write (f, &(udata.addr), nbytes, H5D_XFER_DFLT, out_ptr)<0) { HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); } @@ -1026,7 +1026,8 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout, * the entire chunk size -- it reduces strain on the malloc() * subsystem. */ - if (H5F_block_read (f, &(udata.addr), udata.key.nbytes, chunk)<0) { + if (H5F_block_read (f, &(udata.addr), udata.key.nbytes, + H5D_XFER_DFLT, chunk)<0) { HGOTO_ERROR (H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk"); } diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 3ed4e2f..12c95d6 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -55,9 +55,7 @@ typedef struct H5D_xfer_t { void *tconv_buf; /*type conversion buffer or null */ void *bkg_buf; /*background buffer or null */ H5T_bkg_t need_bkg; /*type of background buffer needed */ -#ifdef HAVE_PARALLEL H5D_transfer_t xfer_mode; /*independent or collective transfer */ -#endif } H5D_xfer_t; typedef struct H5D_t H5D_t; diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index d1d5c26..a86d865 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -31,13 +31,12 @@ typedef enum H5D_layout_t { H5D_NLAYOUTS = 3 /*this one must be last! */ } H5D_layout_t; -#ifdef HAVE_PARALLEL /* Values for the data transfer property */ typedef enum H5D_transfer_t { H5D_XFER_INDEPENDENT, /*Independent data transfer */ - H5D_XFER_COLLECTIVE /*Collective data transfer */ + H5D_XFER_COLLECTIVE, /*Collective data transfer */ + H5D_XFER_DFLT /*default data transfer mode */ } H5D_transfer_t; -#endif #ifdef __cplusplus diff --git a/src/H5F.c b/src/H5F.c index 7d2b619..c782e53 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -153,7 +153,6 @@ H5F_init_interface(void) #elif (H5F_LOW_DFLT == H5F_LOW_CORE) H5F_access_dflt.u.core.increment = 10*1024; #elif (H5F_LOW_DFLT == H5F_LOW_MPIO) - H5F_access_dflt.u.mpio.access_mode = H5D_XFER_INDEPENDENT; H5F_access_dflt.u.mpio.comm = MPI_COMM_SELF; H5F_access_dflt.u.mpio.info = MPI_INFO_NULL; #elif (H5F_LOW_DFLT == H5F_LOW_SPLIT) @@ -393,7 +392,7 @@ H5F_locate_signature(H5F_low_t *f_handle, const H5F_access_t *access_parms, H5F_low_size(f_handle, &max_addr); H5F_addr_reset(addr); while (H5F_addr_lt(addr, &max_addr)) { - if (H5F_low_read(f_handle, access_parms, addr, + if (H5F_low_read(f_handle, access_parms, H5D_XFER_DFLT, addr, H5F_SIGNATURE_LEN, buf) < 0) { HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, "can't read file"); } @@ -892,8 +891,8 @@ H5F_open(const char *name, uintn flags, &(f->shared->boot_addr)) < 0) { HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, NULL, "can't find signature"); } - if (H5F_low_read(f->shared->lf, access_parms, &(f->shared->boot_addr), - fixed_size, buf) < 0) { + if (H5F_low_read(f->shared->lf, access_parms, H5D_XFER_DFLT, + &(f->shared->boot_addr), fixed_size, buf) < 0) { HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "can't read boot block"); } @@ -971,8 +970,8 @@ H5F_open(const char *name, uintn flags, assert(variable_size <= sizeof buf); addr1 = f->shared->boot_addr; H5F_addr_inc(&addr1, (hsize_t)fixed_size); - if (H5F_low_read(f->shared->lf, access_parms, &addr1, variable_size, - buf) < 0) { + if (H5F_low_read(f->shared->lf, access_parms, H5D_XFER_DFLT, + &addr1, variable_size, buf) < 0) { HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, NULL, "can't read boot block"); } @@ -1336,6 +1335,7 @@ H5F_flush(H5F_t *f, hbool_t invalidate) /* write the boot block to disk */ if (H5F_low_write(f->shared->lf, f->shared->access_parms, + H5D_XFER_DFLT, &(f->shared->boot_addr), (size_t)(p-buf), buf)<0) { HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "can't write header"); } @@ -1506,11 +1506,14 @@ H5Fclose(hid_t fid) * Jul 10 1997 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ herr_t -H5F_block_read(H5F_t *f, const haddr_t *addr, hsize_t size, void *buf) +H5F_block_read(H5F_t *f, const haddr_t *addr, hsize_t size, + const H5D_transfer_t xfer_mode, void *buf) { haddr_t abs_addr; @@ -1523,7 +1526,7 @@ H5F_block_read(H5F_t *f, const haddr_t *addr, hsize_t size, void *buf) H5F_addr_add(&abs_addr, addr); /* Read the data */ - if (H5F_low_read(f->shared->lf, f->shared->access_parms, + if (H5F_low_read(f->shared->lf, f->shared->access_parms, xfer_mode, &abs_addr, (size_t)size, buf) < 0) { HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, "low-level read failed"); } @@ -1550,11 +1553,14 @@ H5F_block_read(H5F_t *f, const haddr_t *addr, hsize_t size, void *buf) * Jul 10 1997 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ herr_t -H5F_block_write(H5F_t *f, const haddr_t *addr, hsize_t size, const void *buf) +H5F_block_write(H5F_t *f, const haddr_t *addr, hsize_t size, + const H5D_transfer_t xfer_mode, const void *buf) { haddr_t abs_addr; @@ -1571,7 +1577,7 @@ H5F_block_write(H5F_t *f, const haddr_t *addr, hsize_t size, const void *buf) H5F_addr_add(&abs_addr, addr); /* Write the data */ - if (H5F_low_write(f->shared->lf, f->shared->access_parms, + if (H5F_low_write(f->shared->lf, f->shared->access_parms, xfer_mode, &abs_addr, (size_t)size, buf)) { HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low-level write failed"); } diff --git a/src/H5Farray.c b/src/H5Farray.c index b74decb..85df727 100644 --- a/src/H5Farray.c +++ b/src/H5Farray.c @@ -107,6 +107,8 @@ H5F_arr_create (H5F_t *f, struct H5O_layout_t *layout/*in,out*/) * Friday, January 16, 1998 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ @@ -115,7 +117,7 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_compress_t *comp, const struct H5O_efl_t *efl, const hsize_t _hslab_size[], const hsize_t mem_size[], const hssize_t mem_offset[], const hssize_t file_offset[], - void *_buf/*out*/) + const H5D_transfer_t xfer_mode, void *_buf/*out*/) { uint8 *buf = (uint8 *)_buf; /*cast for arithmetic */ hssize_t file_stride[H5O_LAYOUT_NDIMS]; /*strides through file */ @@ -130,9 +132,6 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout, haddr_t addr; /*address in file */ intn i, j; /*counters */ hbool_t carray; /*carry for subtraction */ -#ifdef HAVE_PARALLEL - intn is_collective; /*collective access flag*/ -#endif FUNC_ENTER (H5F_arr_read, FAIL); @@ -149,12 +148,7 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout, H5V_vector_cpy (layout->ndims, hslab_size, _hslab_size); #ifdef HAVE_PARALLEL - is_collective = (f->shared->access_parms->driver==H5F_LOW_MPIO - && f->shared->access_parms->u.mpio.access_mode==H5D_XFER_COLLECTIVE); - if (is_collective){ -#ifdef AKC - printf("%s: collective read requested\n", FUNC); -#endif + if (xfer_mode==H5D_XFER_COLLECTIVE){ if (layout->type != H5D_CONTIGUOUS) HRETURN_ERROR (H5E_DATASET, H5E_READERROR, FAIL, "collective access on non-contiguous datasets not " @@ -216,7 +210,7 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout, * memory. */ #ifdef HAVE_PARALLEL - if (is_collective){ + if (xfer_mode==H5D_XFER_COLLECTIVE){ /* Currently supports same number of collective access. * Need to be changed LATER to combine all reads into one * collective MPIO call. @@ -247,7 +241,7 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout, HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "external data read failed"); } - } else if (H5F_block_read (f, &addr, elmt_size, buf)<0) { + } else if (H5F_block_read (f, &addr, elmt_size, xfer_mode, buf)<0) { HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "block read failed"); } @@ -319,6 +313,8 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout, * Friday, January 16, 1998 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ @@ -327,7 +323,7 @@ H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_compress_t *comp, const struct H5O_efl_t *efl, const hsize_t _hslab_size[], const hsize_t mem_size[], const hssize_t mem_offset[], const hssize_t file_offset[], - const void *_buf) + const H5D_transfer_t xfer_mode, const void *_buf) { const uint8 *buf = (const uint8 *)_buf; /*cast for arithmetic */ hssize_t file_stride[H5O_LAYOUT_NDIMS]; /*strides through file */ @@ -342,9 +338,6 @@ H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout, haddr_t addr; /*address in file */ intn i, j; /*counters */ hbool_t carray; /*carry for subtraction */ -#ifdef HAVE_PARALLEL - intn is_collective; /*collective access flag*/ -#endif FUNC_ENTER (H5F_arr_write, FAIL); @@ -361,12 +354,7 @@ H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout, H5V_vector_cpy (layout->ndims, hslab_size, _hslab_size); #ifdef HAVE_PARALLEL - is_collective = (f->shared->access_parms->driver==H5F_LOW_MPIO - && f->shared->access_parms->u.mpio.access_mode==H5D_XFER_COLLECTIVE); - if (is_collective){ -#ifdef AKC - printf("%s: collective write requested\n", FUNC); -#endif + if (xfer_mode==H5D_XFER_COLLECTIVE){ if (layout->type != H5D_CONTIGUOUS) HRETURN_ERROR (H5E_DATASET, H5E_WRITEERROR, FAIL, "collective access on non-contiguous datasets not supported yet"); @@ -427,7 +415,7 @@ H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout, * disk. */ #ifdef HAVE_PARALLEL - if (is_collective){ + if (xfer_mode==H5D_XFER_COLLECTIVE){ /* Currently supports same number of collective access. * Need to be changed LATER to combine all writes into one * collective MPIO call. @@ -457,7 +445,7 @@ printf("nelmts=%lu, min=%lu, max=%lu\n", temp, min, max); HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "external data write failed"); } - } else if (H5F_block_write (f, &addr, elmt_size, buf)<0) { + } else if (H5F_block_write (f, &addr, elmt_size, xfer_mode, buf)<0) { HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); } diff --git a/src/H5Fcore.c b/src/H5Fcore.c index 4f8e216..99f64fb 100644 --- a/src/H5Fcore.c +++ b/src/H5Fcore.c @@ -33,8 +33,10 @@ static H5F_low_t *H5F_core_open(const char *name, H5F_search_t *key/*out*/); static herr_t H5F_core_close(H5F_low_t *lf, const H5F_access_t *access_parms); static herr_t H5F_core_read(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, uint8 *buf); static herr_t H5F_core_write(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, const uint8 *buf); @@ -177,11 +179,14 @@ H5F_core_close(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms) * Wednesday, October 22, 1997 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ static herr_t H5F_core_read(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, uint8 *buf) { size_t n; @@ -224,11 +229,14 @@ H5F_core_read(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms, * Wednesday, October 22, 1997 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ static herr_t H5F_core_write(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, const uint8 *buf) { size_t need_more; diff --git a/src/H5Ffamily.c b/src/H5Ffamily.c index 73895b8..e887acc 100644 --- a/src/H5Ffamily.c +++ b/src/H5Ffamily.c @@ -43,8 +43,10 @@ static H5F_low_t *H5F_fam_open(const char *name, H5F_search_t *key/*out*/); static herr_t H5F_fam_close(H5F_low_t *lf, const H5F_access_t *access_parms); static herr_t H5F_fam_read(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, uint8 *buf); static herr_t H5F_fam_write(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, const uint8 *buf); static herr_t H5F_fam_flush(H5F_low_t *lf, const H5F_access_t *access_parms); @@ -292,11 +294,14 @@ H5F_fam_close(H5F_low_t *lf, const H5F_access_t *access_parms) * Monday, November 10, 1997 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ static herr_t H5F_fam_read(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, uint8 *buf) { size_t nbytes; @@ -324,7 +329,7 @@ H5F_fam_read(H5F_low_t *lf, const H5F_access_t *access_parms, nbytes = MIN(size, member_size.offset-offset.offset); cur_addr = offset; if (H5F_low_read(lf->u.fam.memb[membno], - access_parms->u.fam.memb_access, + access_parms->u.fam.memb_access, xfer_mode, &cur_addr, nbytes, buf) < 0) { HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, "can't read from family member"); @@ -356,11 +361,14 @@ H5F_fam_read(H5F_low_t *lf, const H5F_access_t *access_parms, * Monday, November 10, 1997 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ static herr_t H5F_fam_write(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, const uint8 *buf) { size_t nbytes; @@ -438,7 +446,7 @@ H5F_fam_write(H5F_low_t *lf, const H5F_access_t *access_parms, /* Write the data to the member */ if (H5F_low_write(lf->u.fam.memb[membno], - access_parms->u.fam.memb_access, + access_parms->u.fam.memb_access, xfer_mode, &cur_addr, nbytes, buf) < 0) { HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "can't write to family member"); @@ -497,12 +505,12 @@ H5F_fam_flush(H5F_low_t *lf, const H5F_access_t *access_parms) H5F_addr_inc(&addr3, (hsize_t)1); H5F_low_seteof(lf->u.fam.memb[0], &addr3); /*prevent a warning */ if (H5F_low_read(lf->u.fam.memb[0], access_parms->u.fam.memb_access, - &addr1, 1, buf) < 0) { + H5D_XFER_DFLT, &addr1, 1, buf) < 0) { HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, "can't read from first family member"); } if (H5F_low_write(lf->u.fam.memb[0], access_parms->u.fam.memb_access, - &addr1, 1, buf) < 0) { + H5D_XFER_DFLT, &addr1, 1, buf) < 0) { HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "can't write to first family member"); } diff --git a/src/H5Fistore.c b/src/H5Fistore.c index 91c4e9d..54b797d 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -713,7 +713,7 @@ H5F_istore_flush_entry (H5F_t *f, H5F_rdcc_ent_t *ent) HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk"); } - if (H5F_block_write (f, &(udata.addr), nbytes, out_ptr)<0) { + if (H5F_block_write (f, &(udata.addr), nbytes, H5D_XFER_DFLT, out_ptr)<0) { HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); } @@ -1026,7 +1026,8 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout, * the entire chunk size -- it reduces strain on the malloc() * subsystem. */ - if (H5F_block_read (f, &(udata.addr), udata.key.nbytes, chunk)<0) { + if (H5F_block_read (f, &(udata.addr), udata.key.nbytes, + H5D_XFER_DFLT, chunk)<0) { HGOTO_ERROR (H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk"); } diff --git a/src/H5Flow.c b/src/H5Flow.c index faa2202..82e1f1a 100644 --- a/src/H5Flow.c +++ b/src/H5Flow.c @@ -214,11 +214,14 @@ H5F_low_close(H5F_low_t *lf, const H5F_access_t *access_parms) * Wednesday, October 22, 1997 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ herr_t H5F_low_read(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, uint8 *buf/*out*/) { herr_t ret_value = FAIL; @@ -230,8 +233,8 @@ H5F_low_read(H5F_low_t *lf, const H5F_access_t *access_parms, assert(buf); if (lf->type->read) { - if ((ret_value = (lf->type->read) (lf, access_parms, addr, size, - buf)) < 0) { + if ((ret_value = (lf->type->read) (lf, access_parms, xfer_mode, + addr, size, buf)) < 0) { HRETURN_ERROR(H5E_IO, H5E_READERROR, ret_value, "read failed"); } } else { @@ -263,11 +266,14 @@ H5F_low_read(H5F_low_t *lf, const H5F_access_t *access_parms, * Wednesday, October 22, 1997 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ herr_t H5F_low_write(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, const uint8 *buf) { herr_t ret_value = FAIL; @@ -289,8 +295,8 @@ H5F_low_write(H5F_low_t *lf, const H5F_access_t *access_parms, /* Write the data */ if (lf->type->write) { - if ((ret_value = (lf->type->write) (lf, access_parms, addr, size, - buf)) < 0) { + if ((ret_value = (lf->type->write) (lf, access_parms, xfer_mode, + addr, size, buf)) < 0) { HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, ret_value, "write failed"); } } else { @@ -340,8 +346,10 @@ H5F_low_flush(H5F_low_t *lf, const H5F_access_t *access_parms) if (addr_defined(&(lf->eof)) && H5F_addr_gt(&(lf->eof), &last_byte)) { last_byte = lf->eof; last_byte.offset -= 1; - if (H5F_low_read(lf, access_parms, &last_byte, 1, buf) >= 0) { - H5F_low_write(lf, access_parms, &last_byte, 1, buf); + if (H5F_low_read(lf, access_parms, H5D_XFER_DFLT, &last_byte, + 1, buf) >= 0) { + H5F_low_write(lf, access_parms, H5D_XFER_DFLT, &last_byte, + 1, buf); } } /* Invoke the subclass the flush method */ diff --git a/src/H5Fmpio.c b/src/H5Fmpio.c index d55716c..7b28698 100644 --- a/src/H5Fmpio.c +++ b/src/H5Fmpio.c @@ -68,11 +68,11 @@ static H5F_low_t *H5F_mpio_open(const char *name, H5F_search_t *key/*out*/); static herr_t H5F_mpio_close(H5F_low_t *lf, const H5F_access_t *access_parms); static herr_t H5F_mpio_read(H5F_low_t *lf, const H5F_access_t *access_parms, - const haddr_t *addr, size_t size, - uint8 *buf/*out*/); + const H5D_transfer_t xfer_mode, + const haddr_t *addr, size_t size, uint8 *buf/*out*/); static herr_t H5F_mpio_write(H5F_low_t *lf, const H5F_access_t *access_parms, - const haddr_t *addr, size_t size, - const uint8 *buf); + const H5D_transfer_t xfer_mode, + const haddr_t *addr, size_t size, const uint8 *buf); static herr_t H5F_mpio_flush(H5F_low_t *lf, const H5F_access_t *access_parms); static herr_t H5F_MPIOff_to_haddr(MPI_Offset mpi_off, haddr_t *addr); static herr_t H5F_haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off); @@ -241,16 +241,6 @@ H5F_mpio_open(const char *name, const H5F_access_t *access_parms, uintn flags, fprintf(stdout, "Entering H5F_mpio_open name=%s flags=%x\n", name, flags ); #endif - switch (access_parms->u.mpio.access_mode){ - case H5D_XFER_INDEPENDENT: - case H5D_XFER_COLLECTIVE: - /*void*/ - break; - - default: - HRETURN_ERROR(H5E_IO, H5E_BADVALUE, NULL, "invalid file access mode"); - } - /* convert HDF5 flags to MPI-IO flags */ /* some combinations are illegal; let MPI-IO figure it out */ mpi_amode = (flags&H5F_ACC_RDWR) ? MPI_MODE_RDWR : MPI_MODE_RDONLY; @@ -385,10 +375,14 @@ H5F_mpio_close(H5F_low_t *lf, const H5F_access_t *access_parms) * rky, 10 Apr 1998 * Call independent or collective MPI read, based on ACCESS_PARMS. * + * Albert Cheng, June 1, 1998 + * Added xfer_mode to control independent or collective MPI read. + * *------------------------------------------------------------------------- */ static herr_t H5F_mpio_read(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, uint8 *buf/*out*/) { MPI_Offset mpi_off; @@ -415,13 +409,17 @@ H5F_mpio_read(H5F_low_t *lf, const H5F_access_t *access_parms, } /* Read the data. */ - switch (access_parms->u.mpio.access_mode){ + switch (xfer_mode){ case H5D_XFER_INDEPENDENT: + case H5D_XFER_DFLT: mpierr = MPI_File_read_at ( lf->u.mpio.f, mpi_off, (void*) buf, size_i, MPI_BYTE, &mpi_stat ); break; case H5D_XFER_COLLECTIVE: +#ifdef H5F_MPIO_DEBUG + printf("%s: using MPIO collective mode\n", FUNC); +#endif mpierr = MPI_File_read_at_all ( lf->u.mpio.f, mpi_off, (void*) buf, size_i, MPI_BYTE, &mpi_stat ); break; @@ -501,12 +499,15 @@ H5F_mpio_read(H5F_low_t *lf, const H5F_access_t *access_parms, * rky, 24 April * Removed redundant write from H5F_Mpio_write. * + * Albert Cheng, June 1, 1998 + * Added xfer_mode to control independent or collective MPI write. + * *------------------------------------------------------------------------- */ static herr_t H5F_mpio_write(H5F_low_t *lf, const H5F_access_t *access_parms, - const haddr_t *addr, size_t size, - const uint8 *buf) + const H5D_transfer_t xfer_mode, + const haddr_t *addr, size_t size, const uint8 *buf) { MPI_Offset mpi_off; MPI_Status mpi_stat; @@ -530,13 +531,17 @@ H5F_mpio_write(H5F_low_t *lf, const H5F_access_t *access_parms, } /* Write the data. */ - switch (access_parms->u.mpio.access_mode){ + switch (xfer_mode){ case H5D_XFER_INDEPENDENT: + case H5D_XFER_DFLT: mpierr = MPI_File_write_at ( lf->u.mpio.f, mpi_off, (void*) buf, size_i, MPI_BYTE, &mpi_stat ); break; case H5D_XFER_COLLECTIVE: +#ifdef H5F_MPIO_DEBUG + printf("%s: using MPIO collective mode\n", FUNC); +#endif mpierr = MPI_File_write_at_all( lf->u.mpio.f, mpi_off, (void*) buf, size_i, MPI_BYTE, &mpi_stat ); break; diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 26942ce..5b0ec5b 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -22,6 +22,7 @@ /* This is a near top-level header! Try not to include much! */ #include +#include /*for the H5D_transfer_t type */ /* * Feature: Define this constant to be non-zero if you want to enable code @@ -266,7 +267,6 @@ typedef struct H5F_access_t { #ifdef HAVE_PARALLEL /* Properties for parallel I/O */ struct { - uintn access_mode; /* independent or collective variety? */ MPI_Comm comm; /* communicator for file access */ MPI_Info info; /* optional info for MPI-IO */ } mpio; @@ -303,9 +303,10 @@ typedef struct H5F_low_class_t { herr_t (*close)(struct H5F_low_t *lf, const H5F_access_t *access_parms); herr_t (*read)(struct H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, uint8 *buf); - herr_t (*write)(struct H5F_low_t *lf, - const H5F_access_t *access_parms, + herr_t (*write)(struct H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, const uint8 *buf); herr_t (*flush)(struct H5F_low_t *lf, const H5F_access_t *access_parms); @@ -502,12 +503,14 @@ herr_t H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_compress_t *comp, const struct H5O_efl_t *efl, const hsize_t _hslab_size[], const hsize_t mem_size[], const hssize_t mem_offset[], - const hssize_t file_offset[], void *_buf/*out*/); + const hssize_t file_offset[], + const H5D_transfer_t xfer_mode, void *_buf/*out*/); herr_t H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_compress_t *comp, const struct H5O_efl_t *efl, const hsize_t _hslab_size[], const hsize_t mem_size[], const hssize_t mem_offset[], - const hssize_t file_offset[], const void *_buf); + const hssize_t file_offset[], + const H5D_transfer_t xfer_mode, const void *_buf); /* Functions that operate on indexed storage */ herr_t H5F_istore_init (H5F_t *f); @@ -525,9 +528,10 @@ herr_t H5F_istore_write(H5F_t *f, const struct H5O_layout_t *layout, const void *buf); /* Functions that operate on contiguous storage wrt boot block */ -herr_t H5F_block_read(H5F_t *f, const haddr_t *addr, hsize_t size, void *buf); +herr_t H5F_block_read(H5F_t *f, const haddr_t *addr, hsize_t size, + const H5D_transfer_t xfer_mode, void *buf); herr_t H5F_block_write(H5F_t *f, const haddr_t *addr, hsize_t size, - const void *buf); + const H5D_transfer_t xfer_mode, const void *buf); /* Functions that operate directly on low-level files */ const H5F_low_class_t *H5F_low_class (H5F_driver_t driver); @@ -543,8 +547,10 @@ H5F_low_t *H5F_low_open(const H5F_low_class_t *type, const char *name, H5F_low_t *H5F_low_close(H5F_low_t *lf, const H5F_access_t *access_parms); hsize_t H5F_low_size(H5F_low_t *lf, haddr_t *addr); herr_t H5F_low_read(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, uint8 *buf); herr_t H5F_low_write(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, const uint8 *buf); herr_t H5F_low_flush(H5F_low_t *lf, const H5F_access_t *access_parms); diff --git a/src/H5Fsec2.c b/src/H5Fsec2.c index 11f6b9c..b0be347 100644 --- a/src/H5Fsec2.c +++ b/src/H5Fsec2.c @@ -31,9 +31,11 @@ static H5F_low_t *H5F_sec2_open(const char *name, H5F_search_t *key/*out*/); static herr_t H5F_sec2_close(H5F_low_t *lf, const H5F_access_t *access_parms); static herr_t H5F_sec2_read(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, uint8 *buf/*out*/); static herr_t H5F_sec2_write(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, const uint8 *buf); @@ -152,11 +154,14 @@ H5F_sec2_close(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms) * Wednesday, October 22, 1997 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ static herr_t H5F_sec2_read(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, uint8 *buf) { ssize_t n; @@ -256,11 +261,14 @@ H5F_sec2_read(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms, * Wednesday, October 22, 1997 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ static herr_t H5F_sec2_write(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, const uint8 *buf) { uint64 mask; diff --git a/src/H5Fsplit.c b/src/H5Fsplit.c index 1359816..bc57db3 100644 --- a/src/H5Fsplit.c +++ b/src/H5Fsplit.c @@ -33,9 +33,11 @@ static H5F_low_t *H5F_split_open(const char *name, H5F_search_t *key/*out*/); static herr_t H5F_split_close(H5F_low_t *lf, const H5F_access_t *access_parms); static herr_t H5F_split_read(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, uint8 *buf/*out*/); static herr_t H5F_split_write(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, const uint8 *buf); static herr_t H5F_split_flush(H5F_low_t *lf, const H5F_access_t *access_parms); @@ -200,11 +202,14 @@ H5F_split_close(H5F_low_t *lf, const H5F_access_t *access_parms) * Monday, November 13, 1997 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ static herr_t H5F_split_read(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, uint8 *buf/*out*/) { haddr_t tmp_addr; @@ -217,6 +222,7 @@ H5F_split_read(H5F_low_t *lf, const H5F_access_t *access_parms, assert(lf); assert(addr && H5F_addr_defined(addr)); assert(buf); + assert(xfer_mode != H5D_XFER_COLLECTIVE); /* no collective support */ /* Which file to we actually read from? */ if (addr->offset & lf->u.split.mask) { @@ -230,7 +236,7 @@ H5F_split_read(H5F_low_t *lf, const H5F_access_t *access_parms, } /* Read the data */ - status = H5F_low_read(sub, sub_parms, &tmp_addr, size, buf/*out*/); + status = H5F_low_read(sub, sub_parms, xfer_mode, &tmp_addr, size, buf/*out*/); FUNC_LEAVE(status); } @@ -248,11 +254,14 @@ H5F_split_read(H5F_low_t *lf, const H5F_access_t *access_parms, * Monday, November 13, 1997 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ static herr_t H5F_split_write(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, const uint8 *buf) { haddr_t tmp_addr; @@ -265,6 +274,7 @@ H5F_split_write(H5F_low_t *lf, const H5F_access_t *access_parms, assert(lf); assert(addr && H5F_addr_defined(addr)); assert(buf); + assert(xfer_mode != H5D_XFER_COLLECTIVE); /* no collective support */ /* Which file to we actually write to? */ if (addr->offset & lf->u.split.mask) { @@ -278,7 +288,7 @@ H5F_split_write(H5F_low_t *lf, const H5F_access_t *access_parms, } /* Write the data */ - status = H5F_low_write(sub, sub_parms, &tmp_addr, size, buf); + status = H5F_low_write(sub, sub_parms, xfer_mode, &tmp_addr, size, buf); FUNC_LEAVE(status); } diff --git a/src/H5Fstdio.c b/src/H5Fstdio.c index fbccc5e..3ba7653 100644 --- a/src/H5Fstdio.c +++ b/src/H5Fstdio.c @@ -25,9 +25,11 @@ static H5F_low_t *H5F_stdio_open(const char *name, H5F_search_t *key/*out*/); static herr_t H5F_stdio_close(H5F_low_t *lf, const H5F_access_t *access_parms); static herr_t H5F_stdio_read(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, uint8 *buf/*out*/); static herr_t H5F_stdio_write(H5F_low_t *lf, const H5F_access_t *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, const uint8 *buf); static herr_t H5F_stdio_flush(H5F_low_t *lf, const H5F_access_t *access_parms); @@ -177,11 +179,14 @@ H5F_stdio_close(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms) * Wednesday, October 22, 1997 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ static herr_t H5F_stdio_read(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, uint8 *buf/*out*/) { size_t n; @@ -285,11 +290,14 @@ H5F_stdio_read(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms, * Wednesday, October 22, 1997 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ static herr_t H5F_stdio_write(H5F_low_t *lf, const H5F_access_t __unused__ *access_parms, + const H5D_transfer_t xfer_mode, const haddr_t *addr, size_t size, const uint8 *buf) { uint64 mask; diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 9b6b749..6603799 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -340,7 +340,7 @@ H5G_node_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5G_ent_encode_vec(f, &p, sym->entry, sym->nsyms); HDmemset(p, 0, size - (p - buf)); - status = H5F_block_write(f, addr, (hsize_t)size, buf); + status = H5F_block_write(f, addr, (hsize_t)size, H5D_XFER_DFLT, buf); buf = H5MM_xfree(buf); if (status < 0) HRETURN_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, @@ -404,7 +404,7 @@ H5G_node_load(H5F_t *f, const haddr_t *addr, const void __unused__ *_udata1, sym = H5MM_xcalloc(1, sizeof(H5G_node_t)); sym->entry = H5MM_xcalloc((intn)(2*H5G_NODE_K(f)), sizeof(H5G_entry_t)); - if (H5F_block_read(f, addr, (hsize_t)size, buf) < 0) { + if (H5F_block_read(f, addr, (hsize_t)size, H5D_XFER_DFLT, buf) < 0) { HGOTO_ERROR(H5E_SYM, H5E_READERROR, NULL, "unabel to read symbol table node"); } diff --git a/src/H5HG.c b/src/H5HG.c index 568461c..355e063 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -200,7 +200,8 @@ H5HG_load (H5F_t *f, const haddr_t *addr, const void __unused__ *udata1, heap = H5MM_xcalloc (1, sizeof(H5HG_heap_t)); heap->addr = *addr; heap->chunk = H5MM_xmalloc (H5HG_MINSIZE); - if (H5F_block_read (f, addr, (hsize_t)H5HG_MINSIZE, heap->chunk)<0) { + if (H5F_block_read (f, addr, (hsize_t)H5HG_MINSIZE, + H5D_XFER_DFLT, heap->chunk)<0) { HGOTO_ERROR (H5E_HEAP, H5E_READERROR, NULL, "unable to read global heap collection"); } @@ -234,7 +235,7 @@ H5HG_load (H5F_t *f, const haddr_t *addr, const void __unused__ *udata1, H5F_addr_inc (&next_addr, (hsize_t)H5HG_MINSIZE); heap->chunk = H5MM_xrealloc (heap->chunk, heap->size); if (H5F_block_read (f, &next_addr, (hsize_t)(heap->size-H5HG_MINSIZE), - heap->chunk+H5HG_MINSIZE)<0) { + H5D_XFER_DFLT, heap->chunk+H5HG_MINSIZE)<0) { HGOTO_ERROR (H5E_HEAP, H5E_READERROR, NULL, "unable to read global heap collection"); } @@ -338,7 +339,8 @@ H5HG_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5HG_heap_t *heap) assert (heap); if (heap->dirty) { - if (H5F_block_write (f, addr, (hsize_t)(heap->size), heap->chunk)<0) { + if (H5F_block_write (f, addr, (hsize_t)(heap->size), + H5D_XFER_DFLT, heap->chunk)<0) { HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write global heap collection to file"); } diff --git a/src/H5HL.c b/src/H5HL.c index 67fb9a8..8e8f553 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -181,7 +181,8 @@ H5HL_load(H5F_t *f, const haddr_t *addr, const void __unused__ *udata1, assert(!udata1); assert(!udata2); - if (H5F_block_read(f, addr, (hsize_t)H5HL_SIZEOF_HDR(f), hdr) < 0) { + if (H5F_block_read(f, addr, (hsize_t)H5HL_SIZEOF_HDR(f), + H5D_XFER_DFLT, hdr) < 0) { HRETURN_ERROR(H5E_HEAP, H5E_READERROR, NULL, "unable to read heap header"); } @@ -214,7 +215,7 @@ H5HL_load(H5F_t *f, const haddr_t *addr, const void __unused__ *udata1, heap->chunk = H5MM_xcalloc(1, H5HL_SIZEOF_HDR(f) + heap->mem_alloc); if (heap->disk_alloc && H5F_block_read(f, &(heap->addr), (hsize_t)(heap->disk_alloc), - heap->chunk + H5HL_SIZEOF_HDR(f)) < 0) { + H5D_XFER_DFLT, heap->chunk + H5HL_SIZEOF_HDR(f)) < 0) { HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to read heap data"); } @@ -345,17 +346,18 @@ H5HL_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5HL_t *heap) /* The header and data are contiguous */ if (H5F_block_write(f, addr, (hsize_t)(H5HL_SIZEOF_HDR(f)+heap->disk_alloc), - heap->chunk) < 0) { + H5D_XFER_DFLT, heap->chunk) < 0) { HRETURN_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap header and data to file"); } } else { if (H5F_block_write(f, addr, (hsize_t)H5HL_SIZEOF_HDR(f), - heap->chunk)<0) { + H5D_XFER_DFLT, heap->chunk)<0) { HRETURN_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap header to file"); } if (H5F_block_write(f, &(heap->addr), (hsize_t)(heap->disk_alloc), + H5D_XFER_DFLT, heap->chunk + H5HL_SIZEOF_HDR(f)) < 0) { HRETURN_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap data to file"); diff --git a/src/H5O.c b/src/H5O.c index e587e40..d4c861e 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -335,7 +335,7 @@ H5O_load(H5F_t *f, const haddr_t *addr, const void __unused__ *_udata1, /* read fixed-lenth part of object header */ hdr_size = H5O_SIZEOF_HDR(f); - if (H5F_block_read(f, addr, (hsize_t)hdr_size, buf) < 0) { + if (H5F_block_read(f, addr, (hsize_t)hdr_size, H5D_XFER_DFLT, buf) < 0) { HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header"); } @@ -382,7 +382,7 @@ H5O_load(H5F_t *f, const haddr_t *addr, const void __unused__ *_udata1, oh->chunk[chunkno].addr = chunk_addr; oh->chunk[chunkno].size = chunk_size; oh->chunk[chunkno].image = H5MM_xmalloc(chunk_size); - if (H5F_block_read(f, &chunk_addr, (hsize_t)chunk_size, + if (H5F_block_read(f, &chunk_addr, (hsize_t)chunk_size, H5D_XFER_DFLT, oh->chunk[chunkno].image) < 0) { HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header data"); @@ -521,7 +521,8 @@ H5O_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh) HDmemset (p, 0, H5O_SIZEOF_HDR(f)-12); /* write the object header header */ - if (H5F_block_write(f, addr, (hsize_t)H5O_SIZEOF_HDR(f), buf) < 0) { + if (H5F_block_write(f, addr, (hsize_t)H5O_SIZEOF_HDR(f), + H5D_XFER_DFLT, buf) < 0) { HRETURN_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header hdr to disk"); } @@ -593,7 +594,7 @@ H5O_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh) if (oh->chunk[i].dirty) { assert(H5F_addr_defined(&(oh->chunk[i].addr))); if (H5F_block_write(f, &(oh->chunk[i].addr), - (hsize_t)(oh->chunk[i].size), + (hsize_t)(oh->chunk[i].size), H5D_XFER_DFLT, oh->chunk[i].image) < 0) { HRETURN_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header data to disk"); diff --git a/src/H5P.c b/src/H5P.c index 09ed1a6..aa11f08 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -2230,7 +2230,6 @@ H5Pset_mpi (hid_t tid, MPI_Comm comm, MPI_Info info) #endif tmpl->driver = H5F_LOW_MPIO; - tmpl->u.mpio.access_mode = H5D_XFER_INDEPENDENT; tmpl->u.mpio.comm = comm; tmpl->u.mpio.info = info; @@ -2309,6 +2308,10 @@ H5Pget_mpi (hid_t tid, MPI_Comm *comm, MPI_Info *info) * Use independent I/O access. * H5D_XFER_COLLECTIVE * Use MPI collective I/O access. + * H5D_XFER_DFLT + * Use default I/O access. Currently, + * independent is the default mode. + * * * Return: Success: SUCCEED * @@ -2338,6 +2341,7 @@ H5Pset_xfer (hid_t tid, H5D_transfer_t data_xfer_mode) switch (data_xfer_mode){ case H5D_XFER_INDEPENDENT: case H5D_XFER_COLLECTIVE: + case H5D_XFER_DFLT: plist->xfer_mode = data_xfer_mode; break; default: diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index a023f5d..06e9d0f 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -73,7 +73,8 @@ typedef struct H5S_tconv_t { const struct H5O_compress_t *comp, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, const H5S_number_t *numbering, - size_t start, size_t nelmts, void *tconv_buf/*out*/); + size_t start, size_t nelmts, + const H5D_transfer_t xfer_mode, void *tconv_buf/*out*/); /* Scatter elements from type conversion buffer to application buffer */ herr_t (*mscat)(const void *tconv_buf, size_t elmt_size, @@ -90,21 +91,22 @@ typedef struct H5S_tconv_t { const struct H5O_compress_t *compress, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, const H5S_number_t *numbering, - size_t start, size_t nelmts, const void *tconv_buf); + size_t start, size_t nelmts, + const H5D_transfer_t xfer_mode, const void *tconv_buf); /* Read from file to application w/o intermediate scratch buffer */ herr_t (*read)(H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_compress_t *comp, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, const H5S_t *mem_space, - void *buf/*out*/); + const H5D_transfer_t xfer_mode, void *buf/*out*/); /* Write directly from app buffer to file */ herr_t (*write)(H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_compress_t *comp, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, const H5S_t *mem_space, - const void *buf); + const H5D_transfer_t xfer_mode, const void *buf); } H5S_conv_t; H5S_t *H5S_copy (const H5S_t *src); @@ -133,7 +135,8 @@ size_t H5S_simp_fgath (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_compress_t *comp, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, const H5S_number_t *numbering, - size_t start, size_t nelmts, void *tconv_buf/*out*/); + size_t start, size_t nelmts, + const H5D_transfer_t xfer_mode, void *tconv_buf/*out*/); herr_t H5S_simp_mscat (const void *tconv_buf, size_t elmt_size, const H5S_t *mem_space, const H5S_number_t *numbering, size_t start, size_t nelmts, void *buf/*out*/); @@ -144,15 +147,16 @@ herr_t H5S_simp_fscat (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_compress_t *comp, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, const H5S_number_t *numbering, - size_t start, size_t nelmts, const void *tconv_buf); + size_t start, size_t nelmts, + const H5D_transfer_t xfer_mode, const void *tconv_buf); herr_t H5S_simp_read (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_compress_t *comp, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, const H5S_t *mem_space, - void *buf/*out*/); + const H5D_transfer_t xfer_mode, void *buf/*out*/); herr_t H5S_simp_write (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_compress_t *comp, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, const H5S_t *mem_space, - const void *buf); + const H5D_transfer_t xfer_mode, const void *buf); #endif diff --git a/src/H5Ssimp.c b/src/H5Ssimp.c index f8b3e0d..64be705 100644 --- a/src/H5Ssimp.c +++ b/src/H5Ssimp.c @@ -119,6 +119,8 @@ H5S_simp_init (const struct H5O_layout_t __unused__ *layout, * Wednesday, January 21, 1998 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ @@ -127,7 +129,8 @@ H5S_simp_fgath (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_compress_t *comp, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, const H5S_number_t __unused__ *numbering, - size_t start, size_t nelmts, void *buf/*out*/) + size_t start, size_t nelmts, + const H5D_transfer_t xfer_mode, void *buf/*out*/) { hssize_t file_offset[H5O_LAYOUT_NDIMS]; /*offset of slab in file*/ hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */ @@ -185,7 +188,7 @@ H5S_simp_fgath (H5F_t *f, const struct H5O_layout_t *layout, * Gather from file. */ if (H5F_arr_read (f, layout, comp, efl, hsize, hsize, zero, file_offset, - buf/*out*/)<0) { + xfer_mode, buf/*out*/)<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_READERROR, 0, "read error"); } @@ -403,6 +406,8 @@ H5S_simp_mgath (const void *buf, size_t elmt_size, * Wednesday, January 21, 1998 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ @@ -411,7 +416,8 @@ H5S_simp_fscat (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_compress_t *comp, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, const H5S_number_t __unused__ *numbering, - size_t start, size_t nelmts, const void *buf) + size_t start, size_t nelmts, + const H5D_transfer_t xfer_mode, const void *buf) { hssize_t file_offset[H5O_LAYOUT_NDIMS]; /*offset of hyperslab */ hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */ @@ -469,7 +475,7 @@ H5S_simp_fscat (H5F_t *f, const struct H5O_layout_t *layout, * Scatter to file. */ if (H5F_arr_write (f, layout, comp, efl, hsize, hsize, zero, - file_offset, buf)<0) { + file_offset, xfer_mode, buf)<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error"); } @@ -494,6 +500,8 @@ H5S_simp_fscat (H5F_t *f, const struct H5O_layout_t *layout, * Thursday, March 12, 1998 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ @@ -501,7 +509,8 @@ herr_t H5S_simp_read (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_compress_t *comp, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, - const H5S_t *mem_space, void *buf/*out*/) + const H5S_t *mem_space, const H5D_transfer_t xfer_mode, + void *buf/*out*/) { hssize_t file_offset[H5O_LAYOUT_NDIMS]; hsize_t hslab_size[H5O_LAYOUT_NDIMS]; @@ -574,7 +583,7 @@ H5S_simp_read (H5F_t *f, const struct H5O_layout_t *layout, /* Read the hyperslab */ if (H5F_arr_read (f, layout, comp, efl, hslab_size, - mem_size, mem_offset, file_offset, buf)<0) { + mem_size, mem_offset, file_offset, xfer_mode, buf)<0) { HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "unable to read dataset"); } @@ -599,6 +608,8 @@ H5S_simp_read (H5F_t *f, const struct H5O_layout_t *layout, * Thursday, March 12, 1998 * * Modifications: + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * *------------------------------------------------------------------------- */ @@ -606,7 +617,8 @@ herr_t H5S_simp_write (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_compress_t *comp, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, - const H5S_t *mem_space, const void *buf) + const H5S_t *mem_space, const H5D_transfer_t xfer_mode, + const void *buf) { hssize_t file_offset[H5O_LAYOUT_NDIMS]; hsize_t hslab_size[H5O_LAYOUT_NDIMS]; @@ -679,7 +691,7 @@ H5S_simp_write (H5F_t *f, const struct H5O_layout_t *layout, /* Write the hyperslab */ if (H5F_arr_write (f, layout, comp, efl, hslab_size, - mem_size, mem_offset, file_offset, buf)<0) { + mem_size, mem_offset, file_offset, xfer_mode, buf)<0) { HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to write dataset"); } diff --git a/src/debug.c b/src/debug.c index 4b8fdc3..fdf21d9 100644 --- a/src/debug.c +++ b/src/debug.c @@ -90,7 +90,7 @@ main(int argc, char *argv[]) printf("Reading signature at address "); H5F_addr_print(stdout, &addr); printf(" (rel)\n"); - if (H5F_block_read(f, &addr, (hsize_t)sizeof(sig), sig) < 0) { + if (H5F_block_read(f, &addr, (hsize_t)sizeof(sig), H5D_XFER_DFLT, sig) < 0) { fprintf(stderr, "cannot read signature\n"); HDexit(3); } -- cgit v0.12