mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-01 16:28:09 +08:00
[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.
This commit is contained in:
parent
4d16aa5ab7
commit
d6923f46e0
@ -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,
|
||||
|
@ -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 */
|
||||
|
@ -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,
|
||||
|
@ -47,7 +47,7 @@
|
||||
#include <H5private.h>
|
||||
#include <H5private.h>
|
||||
#include <H5Eprivate.h>
|
||||
#include <H5Fprivate.h>
|
||||
#include <H5Dprivate.h>
|
||||
#include <H5MMprivate.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -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;
|
||||
|
@ -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
|
||||
|
51
src/H5P.c
51
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);
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user