summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-06-17 14:15:04 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-06-17 14:15:04 (GMT)
commit9747f70f1f0e80f7541721b461de2aa4dad5e3d1 (patch)
treec0ac42dc09bdc16ffa32e979bc94aff3142cd25e
parentd2bb11974c66a9b5316442c6afa49348095e82c7 (diff)
downloadhdf5-9747f70f1f0e80f7541721b461de2aa4dad5e3d1.zip
hdf5-9747f70f1f0e80f7541721b461de2aa4dad5e3d1.tar.gz
hdf5-9747f70f1f0e80f7541721b461de2aa4dad5e3d1.tar.bz2
[svn-r5651] Purpose:
Code cleanup Description: Change MPI-I/O code to use the address of the dataset for the displacement, instead of having a separate displacement value. Removed displacement parameter from H5FD_mpio_setup parameters. Platforms tested: Linux 2.2.x (eirene) w/parallel & IRIX64 6.5 (modi4) w/parallel.
-rw-r--r--src/H5FDmpio.c72
-rw-r--r--src/H5FDmpio.h2
-rw-r--r--src/H5Smpio.c25
3 files changed, 70 insertions, 29 deletions
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 12bfccc..5e711b5 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -71,7 +71,6 @@ typedef struct H5FD_mpio_t {
haddr_t last_eoa; /* Last known end-of-address marker */
MPI_Datatype btype; /*buffer type for xfers */
MPI_Datatype ftype; /*file type for xfers */
- haddr_t disp; /*displacement for set_view in xfers */
int use_types; /*if !0, use btype, ftype, disp.else do
* simple byteblk xfer
*/
@@ -500,9 +499,8 @@ H5FD_mpio_mpi_size(H5FD_t *_file)
/*-------------------------------------------------------------------------
* Function: H5FD_mpio_setup
*
- * Purpose: Set the buffer type BTYPE, file type FTYPE, and absolute base
- * address DISP (i.e., the file view displacement) for a data
- * transfer. Also request a dataspace transfer or an elementary
+ * Purpose: Set the buffer type BTYPE, file type FTYPE for a data
+ * transfer. Also request a MPI type transfer or an elementary
* byteblock transfer depending on whether USE_TYPES is non-zero
* or zero, respectively.
*
@@ -515,11 +513,16 @@ H5FD_mpio_mpi_size(H5FD_t *_file)
*
* Modifications:
*
+ * Quincey Koziol - 2002/06/17
+ * Removed 'disp' parameter, read & write routines will use
+ * the address of the dataset in MPI_File_set_view() calls, as
+ * necessary.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5FD_mpio_setup(H5FD_t *_file, MPI_Datatype btype, MPI_Datatype ftype,
- haddr_t disp, hbool_t use_types)
+ hbool_t use_types)
{
H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
@@ -529,7 +532,6 @@ H5FD_mpio_setup(H5FD_t *_file, MPI_Datatype btype, MPI_Datatype ftype,
file->btype = btype;
file->ftype = ftype;
- file->disp = disp;
file->use_types = use_types;
FUNC_LEAVE(SUCCEED);
@@ -1132,6 +1134,12 @@ H5FD_mpio_get_eof(H5FD_t *_file)
* for the I/O transfer. Someday we might include code to decode
* the MPI type used for more complicated transfers and call
* MPI_Get_count all the time.
+ *
+ * Quincey Koziol - 2002/06/17
+ * Removed 'disp' parameter from H5FD_mpio_setup routine and use
+ * the address of the dataset in MPI_File_set_view() calls, as
+ * necessary.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1142,7 +1150,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add
const H5FD_mpio_dxpl_t *dx=NULL;
H5FD_mpio_dxpl_t _dx;
MPI_Offset mpi_off, mpi_disp;
- MPI_Status mpi_stat = {0};
+ MPI_Status mpi_stat;
MPI_Datatype buf_type, file_type;
int size_i, bytes_read, n;
int use_types_this_time, used_types_last_time;
@@ -1157,6 +1165,9 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add
assert(file);
assert(H5FD_MPIO==file->pub.driver_id);
+ /* Portably initialize MPI status variable */
+ HDmemset(&mpi_stat,0,sizeof(MPI_Status));
+
/* some numeric conversions */
if (haddr_to_MPIOff(addr, &mpi_off/*out*/)<0)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off");
@@ -1190,8 +1201,12 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add
/* prepare for a full-blown xfer using btype, ftype, and disp */
buf_type = file->btype;
file_type = file->ftype;
- if (haddr_to_MPIOff(file->disp, &mpi_disp)<0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off");
+
+ /* When using types, use the address as the displacement for
+ * MPI_File_set_view and reset the address for the read to zero
+ */
+ mpi_disp=mpi_off;
+ mpi_off=0;
} else {
/*
* Prepare for a simple xfer of a contiguous block of bytes. The
@@ -1199,7 +1214,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add
*/
buf_type = MPI_BYTE;
file_type = MPI_BYTE;
- mpi_disp = 0; /* mpi_off is sufficient */
+ mpi_disp = 0; /* mpi_off is already set */
}
/*
@@ -1405,6 +1420,12 @@ done:
* for the I/O transfer. Someday we might include code to decode
* the MPI type used for more complicated transfers and call
* MPI_Get_count all the time.
+ *
+ * Quincey Koziol - 2002/06/17
+ * Removed 'disp' parameter from H5FD_mpio_setup routine and use
+ * the address of the dataset in MPI_File_set_view() calls, as
+ * necessary.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1415,7 +1436,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id/*unused*/, haddr_t
const H5FD_mpio_dxpl_t *dx=NULL;
H5FD_mpio_dxpl_t _dx;
MPI_Offset mpi_off, mpi_disp;
- MPI_Status mpi_stat = {0};
+ MPI_Status mpi_stat;
MPI_Datatype buf_type, file_type;
int size_i, bytes_written;
int use_types_this_time, used_types_last_time;
@@ -1430,11 +1451,12 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id/*unused*/, haddr_t
assert(file);
assert(H5FD_MPIO==file->pub.driver_id);
+ /* Portably initialize MPI status variable */
+ HDmemset(&mpi_stat,0,sizeof(MPI_Status));
+
/* some numeric conversions */
if (haddr_to_MPIOff(addr, &mpi_off)<0)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off");
- if (haddr_to_MPIOff(file->disp, &mpi_disp)<0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off");
size_i = (int)size;
if ((hsize_t)size_i != size)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from size to size_i");
@@ -1465,8 +1487,12 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id/*unused*/, haddr_t
/* prepare for a full-blown xfer using btype, ftype, and disp */
buf_type = file->btype;
file_type = file->ftype;
- if (haddr_to_MPIOff(file->disp, &mpi_disp)<0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off");
+
+ /* When using types, use the address as the displacement for
+ * MPI_File_set_view and reset the address for the read to zero
+ */
+ mpi_disp=mpi_off;
+ mpi_off=0;
} else {
/*
* Prepare for a simple xfer of a contiguous block of bytes.
@@ -1474,7 +1500,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id/*unused*/, haddr_t
*/
buf_type = MPI_BYTE;
file_type = MPI_BYTE;
- mpi_disp = 0; /* mpi_off is sufficient */
+ mpi_disp = 0; /* mpi_off is already set */
}
/*
@@ -1628,6 +1654,11 @@ done:
* Robb Matzke, 2000-12-29
* Make sure file size is at least as large as the last
* allocated byte.
+ *
+ * Quincey Koziol, 2002-06-??
+ * Changed file extension method to use MPI_File_set_size instead
+ * read->write method.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1635,8 +1666,10 @@ H5FD_mpio_flush(H5FD_t *_file)
{
H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
int mpi_code; /* mpi return code */
+#ifdef OLD_WAY
uint8_t byte=0;
- MPI_Status mpi_stat = {0};
+ MPI_Status mpi_stat;
+#endif /* OLD_WAY */
MPI_Offset mpi_off;
herr_t ret_value=SUCCEED;
@@ -1649,6 +1682,11 @@ H5FD_mpio_flush(H5FD_t *_file)
assert(file);
assert(H5FD_MPIO==file->pub.driver_id);
+#ifdef OLD_WAY
+ /* Portably initialize MPI status variable */
+ HDmemset(&mpi_stat,0,sizeof(MPI_Status));
+#endif /* OLD_WAY */
+
/* Extend the file to make sure it's large enough, then sync.
* Unfortunately, keeping track of EOF is an expensive operation, so
* we can't just check whether EOF<EOA like with other drivers.
diff --git a/src/H5FDmpio.h b/src/H5FDmpio.h
index 25cd8fb..89c02ca 100644
--- a/src/H5FDmpio.h
+++ b/src/H5FDmpio.h
@@ -71,7 +71,7 @@ __DLL__ herr_t H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode/*out*
__DLL__ htri_t H5FD_mpio_tas_allsame(H5FD_t *_file, hbool_t newval);
__DLL__ MPI_Comm H5FD_mpio_communicator(H5FD_t *_file);
__DLL__ herr_t H5FD_mpio_setup(H5FD_t *_file, MPI_Datatype btype, MPI_Datatype ftype,
- haddr_t disp, hbool_t use_types);
+ hbool_t use_types);
__DLL__ herr_t H5FD_mpio_wait_for_left_neighbor(H5FD_t *file);
__DLL__ herr_t H5FD_mpio_signal_right_neighbor(H5FD_t *file);
__DLL__ herr_t H5FD_mpio_closing(H5FD_t *file);
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index 534b9eb..37935f8 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -557,6 +557,10 @@ H5S_mpio_space_type( const H5S_t *space, const size_t elmt_size,
* Albert Cheng, 001123
* Include the MPI_type freeing as part of cleanup code.
*
+ * QAK - 2002/06/17
+ * Removed 'disp' parameter from H5FD_mpio_setup routine and use the
+ * address of the dataset in MPI_File_set_view() calls, as necessary.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -571,7 +575,7 @@ H5S_mpio_spaces_xfer(H5F_t *f, const struct H5O_layout_t *layout,
{
herr_t ret_value = SUCCEED;
int err;
- haddr_t disp, addr;
+ haddr_t addr;
hsize_t mpi_count;
hsize_t mpi_buf_count, mpi_unused_count;
MPI_Datatype mpi_buf_type, mpi_file_type;
@@ -648,21 +652,20 @@ H5S_mpio_spaces_xfer(H5F_t *f, const struct H5O_layout_t *layout,
if (MPI_SUCCESS != err)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't create MPI file type");
- /* calculate the absolute base addr (i.e., the file view disp) */
- disp = f->shared->base_addr + layout->addr;
+ /* Use the absolute base address of the dataset (or chunk, eventually) as
+ * the address to read from. This should be used as the diplacement for
+ * a call to MPI_File_set_view() in the read or write call.
+ */
+ addr = f->shared->base_addr + layout->addr;
#ifdef H5Smpi_DEBUG
- HDfprintf(stdout, "spaces_xfer: disp=%Hu\n", disp );
+ HDfprintf(stdout, "spaces_xfer: addr=%a\n", addr );
#endif
- /* Effective address determined by base addr and the MPI file type */
- addr = 0;
-
/*
- * Pass buf type, file type, and absolute base address (i.e., the file
- * view disp) to the file driver. Request a dataspace transfer (instead
- * of an elementary byteblock transfer).
+ * Pass buf type, file type to the file driver. Request an MPI type
+ * transfer (instead of an elementary byteblock transfer).
*/
- H5FD_mpio_setup(f->shared->lf, mpi_buf_type, mpi_file_type, disp, 1);
+ H5FD_mpio_setup(f->shared->lf, mpi_buf_type, mpi_file_type, 1);
/* transfer the data */
mpi_count = (size_t)mpi_buf_count;