From d6923f46e0f0969aa0b73eb2c525dc8bf65e610c Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Fri, 17 Apr 1998 09:52:41 -0500 Subject: [svn-r351] Removed the access_mode argument from H5Pset_mpi which was later used to open an HDF5 file with MPIO access. The design has changed to provide access-mode controll (independent or collective access) as an argument in the H5D read/write calls. Also removed the macros H5FACC_INDEPENDENT and H5FACC_COLLECTIVE. The original thinking was to define how a file is independent or collective access. They are replaced by the enum H5D_transfer_t with values of H5D_XFER_INDEPENDENT and H5D_XFER_COLLECTIVE. These values are used in the H5Pset_xfer to setup a data transfer property list to be used during the H5D read/write calls. The original access_mode field in the File access structure is still there. It would be removed soon once the transfer control can be passed down to the low level I/O routines. --- src/H5D.c | 4 ++-- src/H5F.c | 4 ++-- src/H5Farray.c | 20 ++++++++++---------- src/H5Fmpio.c | 14 +++++++------- src/H5Fpublic.h | 6 ------ src/H5P.c | 51 +++++++++++++++------------------------------------ src/H5Ppublic.h | 6 ++---- 7 files changed, 38 insertions(+), 67 deletions(-) diff --git a/src/H5D.c b/src/H5D.c index b06a9cf..b53ba33 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -1186,7 +1186,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, 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; + dataset->ent.file->shared->access_parms.u.mpio.access_mode = H5D_XFER_COLLECTIVE; status = (sconv_func->read)(dataset->ent.file, &(dataset->layout), &(dataset->create_parms->efl), H5T_get_size (dataset->type), file_space, @@ -1471,7 +1471,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, 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; + dataset->ent.file->shared->access_parms.u.mpio.access_mode = H5D_XFER_COLLECTIVE; status = (sconv_func->write)(dataset->ent.file, &(dataset->layout), &(dataset->create_parms->efl), H5T_get_size (dataset->type), file_space, diff --git a/src/H5F.c b/src/H5F.c index 7a262e6..26117ad 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -149,8 +149,8 @@ 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 = 0; - H5F_access_dflt.u.mpio.comm = MPI_COMM_NULL; + 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) /* Nothing to initialize */ diff --git a/src/H5Farray.c b/src/H5Farray.c index 76f09d8..98d3022 100644 --- a/src/H5Farray.c +++ b/src/H5Farray.c @@ -150,7 +150,7 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout, #ifdef HAVE_PARALLEL is_collective = (f->shared->access_parms.driver==H5F_LOW_MPIO - && f->shared->access_parms.u.mpio.access_mode==H5ACC_COLLECTIVE); + && f->shared->access_parms.u.mpio.access_mode==H5D_XFER_COLLECTIVE); if (is_collective){ #ifdef AKC printf("%s: collective read requested\n", FUNC); @@ -212,16 +212,16 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout, * Need to be changed LATER to combine all reads into one * collective MPIO call. */ - long max, min, temp; + unsigned long max, min, temp; temp = nelmts; assert(temp==nelmts); /* verify no overflow */ - MPI_Allreduce(&temp, &max, 1, MPI_LONG, MPI_MAX, + MPI_Allreduce(&temp, &max, 1, MPI_UNSIGNED_LONG, MPI_MAX, f->shared->access_parms.u.mpio.comm); - MPI_Allreduce(&temp, &min, 1, MPI_LONG, MPI_MIN, + MPI_Allreduce(&temp, &min, 1, MPI_UNSIGNED_LONG, MPI_MIN, f->shared->access_parms.u.mpio.comm); #ifdef AKC -printf("nelmnts=%ld, min=%ld, max=%ld\n", temp, min, max); +printf("nelmts=%lu, min=%lu, max=%lu\n", temp, min, max); #endif if (max != min) HRETURN_ERROR(H5E_DATASET, H5E_READERROR, FAIL, @@ -350,7 +350,7 @@ H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout, #ifdef HAVE_PARALLEL is_collective = (f->shared->access_parms.driver==H5F_LOW_MPIO - && f->shared->access_parms.u.mpio.access_mode==H5ACC_COLLECTIVE); + && f->shared->access_parms.u.mpio.access_mode==H5D_XFER_COLLECTIVE); if (is_collective){ #ifdef AKC printf("%s: collective write requested\n", FUNC); @@ -412,16 +412,16 @@ H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout, * Need to be changed LATER to combine all writes into one * collective MPIO call. */ - long max, min, temp; + unsigned long max, min, temp; temp = nelmts; assert(temp==nelmts); /* verify no overflow */ - MPI_Allreduce(&temp, &max, 1, MPI_LONG, MPI_MAX, + MPI_Allreduce(&temp, &max, 1, MPI_UNSIGNED_LONG, MPI_MAX, f->shared->access_parms.u.mpio.comm); - MPI_Allreduce(&temp, &min, 1, MPI_LONG, MPI_MIN, + MPI_Allreduce(&temp, &min, 1, MPI_UNSIGNED_LONG, MPI_MIN, f->shared->access_parms.u.mpio.comm); #ifdef AKC -printf("nelmnts=%ld, min=%ld, max=%ld\n", temp, min, max); +printf("nelmts=%lu, min=%lu, max=%lu\n", temp, min, max); #endif if (max != min) HRETURN_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, diff --git a/src/H5Fmpio.c b/src/H5Fmpio.c index 3eea2a5..0818dda 100644 --- a/src/H5Fmpio.c +++ b/src/H5Fmpio.c @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include @@ -242,8 +242,8 @@ H5F_mpio_open(const char *name, const H5F_access_t *access_parms, uintn flags, #endif switch (access_parms->u.mpio.access_mode){ - case H5ACC_INDEPENDENT: - case H5ACC_COLLECTIVE: + case H5D_XFER_INDEPENDENT: + case H5D_XFER_COLLECTIVE: /*void*/ break; @@ -420,12 +420,12 @@ H5F_mpio_read(H5F_low_t *lf, const H5F_access_t *access_parms, /* Read the data. */ switch (access_parms->u.mpio.access_mode){ - case H5ACC_INDEPENDENT: + case H5D_XFER_INDEPENDENT: mpierr = MPI_File_read_at ( lf->u.mpio.f, mpi_off, (void*) buf, size_i, MPI_BYTE, &mpi_stat ); break; - case H5ACC_COLLECTIVE: + case H5D_XFER_COLLECTIVE: mpierr = MPI_File_read_at_all ( lf->u.mpio.f, mpi_off, (void*) buf, size_i, MPI_BYTE, &mpi_stat ); break; @@ -536,12 +536,12 @@ H5F_mpio_write(H5F_low_t *lf, const H5F_access_t *access_parms, /* Write the data. */ switch (access_parms->u.mpio.access_mode){ - case H5ACC_INDEPENDENT: + case H5D_XFER_INDEPENDENT: mpierr = MPI_File_write_at ( lf->u.mpio.f, mpi_off, (void*) buf, size_i, MPI_BYTE, &mpi_stat ); break; - case H5ACC_COLLECTIVE: + case H5D_XFER_COLLECTIVE: 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/H5Fpublic.h b/src/H5Fpublic.h index 08aa314..cfce784 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -61,12 +61,6 @@ typedef enum H5F_driver_t { /* Unlimited file size for H5Pset_external() */ #define H5F_UNLIMITED ((hsize_t)(-1L)) -/* Parallel styles passed to H5Pset_mpi() */ -#ifdef HAVE_PARALLEL -# define H5ACC_INDEPENDENT 0x0010 /*MPI independent access */ -# define H5ACC_COLLECTIVE 0x0011 /*MPI collective access */ -#endif - #ifdef __cplusplus extern "C" { #endif diff --git a/src/H5P.c b/src/H5P.c index 9f29da3..2d0e6f0 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -1902,10 +1902,15 @@ H5Pget_preserve (hid_t plist_id) * mpi-related stuff is in the `u.mpi' member. The `access_mode' will * contain only mpi-related flags defined in H5Fpublic.h. * + * Albert Cheng, Apr 16, 1998 + * Removed the access_mode argument. The access_mode is changed + * to be controlled by data transfer property list during data + * read/write calls. + * *------------------------------------------------------------------------- */ herr_t -H5Pset_mpi (hid_t tid, MPI_Comm comm, MPI_Info info, unsigned access_mode) +H5Pset_mpi (hid_t tid, MPI_Comm comm, MPI_Info info) { H5F_access_t *tmpl = NULL; MPI_Comm lcomm; @@ -1920,43 +1925,15 @@ H5Pset_mpi (hid_t tid, MPI_Comm comm, MPI_Info info, unsigned access_mode) "not a file access template"); } - switch (access_mode){ - case H5ACC_INDEPENDENT: - case H5ACC_COLLECTIVE: - /* okay */ - break; - - default: - HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, - "invalid mpio access mode"); - } - #ifdef LATER /* * Need to verify comm and info contain sensible information. */ #endif - - /* - * Everything looks good. Now go ahead and modify the access template. - */ tmpl->driver = H5F_LOW_MPIO; - tmpl->u.mpio.access_mode = access_mode; - - /* - * Store a duplicate copy of comm so that user may freely modify comm - * after this call. - */ - if ((mrc = MPI_Comm_dup(comm, &lcomm)) != MPI_SUCCESS) { - HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "failure to duplicate communicator"); - } + tmpl->u.mpio.access_mode = H5D_XFER_INDEPENDENT; tmpl->u.mpio.comm = comm; - -#ifdef LATER - /* Need to duplicate info too but don't know a quick way to do it now */ -#endif tmpl->u.mpio.info = info; FUNC_LEAVE(SUCCEED); @@ -1982,10 +1959,15 @@ H5Pset_mpi (hid_t tid, MPI_Comm comm, MPI_Info info, unsigned access_mode) * * Modifications: * + * Albert Cheng, Apr 16, 1998 + * Removed the access_mode argument. The access_mode is changed + * to be controlled by data transfer property list during data + * read/write calls. + * *------------------------------------------------------------------------- */ herr_t -H5Pget_mpi (hid_t tid, MPI_Comm *comm, MPI_Info *info, unsigned *access_mode) +H5Pget_mpi (hid_t tid, MPI_Comm *comm, MPI_Info *info) { H5F_access_t *tmpl = NULL; @@ -2001,11 +1983,8 @@ H5Pget_mpi (hid_t tid, MPI_Comm *comm, MPI_Info *info, unsigned *access_mode) HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "the mpi driver is not set"); } - -#ifndef LATER - HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, - "not implemented yet"); -#endif + *comm = tmpl->u.mpio.comm; + *info = tmpl->u.mpio.info; FUNC_LEAVE (SUCCEED); } diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 6f11dce..ad7f98b 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -89,10 +89,8 @@ herr_t H5Pset_preserve (hid_t plist_id, hbool_t status); int H5Pget_preserve (hid_t plist_id); #ifdef HAVE_PARALLEL -herr_t H5Pset_mpi (hid_t tid, MPI_Comm comm, MPI_Info info, - unsigned access_mode); -herr_t H5Pget_mpi (hid_t tid, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/, - unsigned *access_mode/*out*/); +herr_t H5Pset_mpi (hid_t tid, MPI_Comm comm, MPI_Info info); +herr_t H5Pget_mpi (hid_t tid, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/); herr_t H5Pset_xfer (hid_t tid, H5D_transfer_t data_xfer_mode); herr_t H5Pget_xfer (hid_t tid, H5D_transfer_t *data_xfer_mode/*out*/); #endif -- cgit v0.12