summaryrefslogtreecommitdiffstats
path: root/src/H5FDmpio.c
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 /src/H5FDmpio.c
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.
Diffstat (limited to 'src/H5FDmpio.c')
-rw-r--r--src/H5FDmpio.c70
1 files changed, 53 insertions, 17 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.