summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-06-17 14:12:34 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-06-17 14:12:34 (GMT)
commit2ae3f6b8669ce5dc19fe7e3d03eeb4728d8c9d1c (patch)
tree1578bd895a08baaafa9a773a2c024e5947c4091f
parent90abe2ed25ce5727bb479061185b8a44fd49db76 (diff)
downloadhdf5-2ae3f6b8669ce5dc19fe7e3d03eeb4728d8c9d1c.zip
hdf5-2ae3f6b8669ce5dc19fe7e3d03eeb4728d8c9d1c.tar.gz
hdf5-2ae3f6b8669ce5dc19fe7e3d03eeb4728d8c9d1c.tar.bz2
[svn-r5650] 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.c70
-rw-r--r--src/H5FDmpio.h2
-rw-r--r--src/H5Smpio.c25
3 files changed, 68 insertions, 29 deletions
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 2d81469..57efa90 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -58,7 +58,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
*/
@@ -509,9 +508,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.
*
@@ -524,11 +522,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;
@@ -539,7 +542,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);
@@ -1116,6 +1118,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
@@ -1126,7 +1134,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;
@@ -1145,6 +1153,9 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add
assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id));
assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
+ /* Portably initialize MPI status variable */
+ HDmemset(&mpi_stat,0,sizeof(MPI_Status));
+
/* some numeric conversions */
if (H5FD_mpio_haddr_to_MPIOff(addr, &mpi_off/*out*/)<0)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off");
@@ -1180,8 +1191,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 (H5FD_mpio_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
@@ -1189,7 +1204,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 alread set */
}
/*
@@ -1396,6 +1411,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
@@ -1406,7 +1427,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
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;
@@ -1425,11 +1446,12 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id));
assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
+ /* Portably initialize MPI status variable */
+ HDmemset(&mpi_stat,0,sizeof(MPI_Status));
+
/* some numeric conversions */
if (H5FD_mpio_haddr_to_MPIOff(addr, &mpi_off)<0)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off");
- if (H5FD_mpio_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");
@@ -1462,8 +1484,12 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
/* prepare for a full-blown xfer using btype, ftype, and disp */
buf_type = file->btype;
file_type = file->ftype;
- if (H5FD_mpio_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.
@@ -1471,7 +1497,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
*/
buf_type = MPI_BYTE;
file_type = MPI_BYTE;
- mpi_disp = 0; /* mpi_off is sufficient */
+ mpi_disp = 0; /* mpi_off is already set */
}
/*
@@ -1630,6 +1656,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
@@ -1641,7 +1672,7 @@ H5FD_mpio_flush(H5FD_t *_file, unsigned closing)
herr_t ret_value=SUCCEED;
#ifdef OLD_WAY
uint8_t byte=0;
- MPI_Status mpi_stat = {0};
+ MPI_Status mpi_stat;
#endif /* OLD_WAY */
FUNC_ENTER_NOAPI(H5FD_mpio_flush, FAIL);
@@ -1653,6 +1684,11 @@ H5FD_mpio_flush(H5FD_t *_file, unsigned closing)
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 45e6069..2810bfb 100644
--- a/src/H5FDmpio.h
+++ b/src/H5FDmpio.h
@@ -58,7 +58,7 @@ __DLL__ herr_t H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode);
__DLL__ herr_t H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode/*out*/);
__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__ int H5FD_mpio_mpi_rank(H5FD_t *_file);
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index c8acc41..5c4377b 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -546,6 +546,10 @@ H5S_mpio_space_type( const H5S_t *space, const size_t elmt_size,
* Removed the must_convert parameter and move preconditions to
* H5S_mpio_opt_possible() routine
*
+ * 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.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -557,7 +561,7 @@ H5S_mpio_spaces_xfer(H5F_t *f, const H5O_layout_t *layout,
{
herr_t ret_value = SUCCEED;
int err;
- haddr_t disp, addr;
+ haddr_t addr;
size_t mpi_count;
size_t mpi_buf_count, mpi_unused_count;
MPI_Datatype mpi_buf_type, mpi_file_type;
@@ -629,21 +633,20 @@ H5S_mpio_spaces_xfer(H5F_t *f, const 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 */
H5_CHECK_OVERFLOW(mpi_buf_count, hsize_t, size_t);