summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-10-28 14:42:24 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-10-28 14:42:24 (GMT)
commitf4240b2639ccdd5f0444f7a8892afb6759da9989 (patch)
treee54d6a6fe4752d4f6a2da81e8c141199ea8b04b3
parent47c3791addd6d6ca4fdc39cbb7555d867f4093a0 (diff)
downloadhdf5-f4240b2639ccdd5f0444f7a8892afb6759da9989.zip
hdf5-f4240b2639ccdd5f0444f7a8892afb6759da9989.tar.gz
hdf5-f4240b2639ccdd5f0444f7a8892afb6759da9989.tar.bz2
[svn-r7765] Purpose:
Code cleanup Description: More collective/independent cleanups to straighten out code contortions. Platforms tested: FreeBSD 4.9 (sleipnir) FreeBSD 4.9 (sleipnir) w/parallel Linux 2.4 (verbena) w/fortran & C++ Solaris 2.7 (arabica) w/64-bit extensions enabled
-rw-r--r--src/H5FDfphdf5.c161
-rw-r--r--src/H5FDmpio.c177
-rw-r--r--src/H5FDmpiposix.c7
3 files changed, 181 insertions, 164 deletions
diff --git a/src/H5FDfphdf5.c b/src/H5FDfphdf5.c
index 577f51d..842e941 100644
--- a/src/H5FDfphdf5.c
+++ b/src/H5FDfphdf5.c
@@ -1164,13 +1164,14 @@ H5FD_fphdf5_read(H5FD_t *_file, H5FD_mem_t mem_type, hid_t dxpl_id,
MPI_Status status;
int mrc;
MPI_Datatype buf_type;
- MPI_Datatype file_type;
int size_i;
int bytes_read;
int n;
unsigned use_view_this_time = 0;
H5P_genplist_t *plist;
- H5FD_mpio_xfer_t xfer_mode = H5FD_MPIO_INDEPENDENT;
+#ifndef NDEBUG
+ H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */
+#endif /* NDEBUG */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5FD_fphdf5_read, FAIL)
@@ -1199,57 +1200,84 @@ H5FD_fphdf5_read(H5FD_t *_file, H5FD_mem_t mem_type, hid_t dxpl_id,
/* Obtain the data transfer properties */
if ((plist = H5I_object(dxpl_id)) == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
+#ifndef NDEBUG
+ xfer_mode = H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME);
+#endif /* NDEBUG */
- if (H5P_get_driver(plist) == H5FD_FPHDF5)
- /* Get the transfer mode */
- xfer_mode = H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME);
+ /* Only look for MPI views for raw data transfers */
+ if(mem_type==H5FD_MEM_DRAW) {
+ /*
+ * Set up for a fancy xfer using complex types, or single byte block.
+ * We wouldn't need to rely on the use_view field if MPI semantics
+ * allowed us to test that btype == ftype == MPI_BYTE (or even
+ * MPI_TYPE_NULL, which could mean "use MPI_BYTE" by convention).
+ */
+ if (H5P_exist_plist(plist, H5FD_FPHDF5_XFER_USE_VIEW_NAME) > 0)
+ if (H5P_get(plist, H5FD_FPHDF5_XFER_USE_VIEW_NAME, &use_view_this_time) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
- /*
- * Set up for a fancy xfer using complex types, or single byte block.
- * We wouldn't need to rely on the use_view field if MPI semantics
- * allowed us to test that btype == ftype == MPI_BYTE (or even
- * MPI_TYPE_NULL, which could mean "use MPI_BYTE" by convention).
- */
- if (H5P_exist_plist(plist, H5FD_FPHDF5_XFER_USE_VIEW_NAME) > 0)
- if (H5P_get(plist, H5FD_FPHDF5_XFER_USE_VIEW_NAME, &use_view_this_time) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
+ if (use_view_this_time) {
+ MPI_Datatype file_type;
- if (use_view_this_time) {
- /* Sanity check that views will only be used by collective I/O */
- assert(xfer_mode==H5FD_MPIO_COLLECTIVE);
+ /* Sanity check that views will only be used by collective I/O */
+ assert(xfer_mode==H5FD_MPIO_COLLECTIVE);
- /* Prepare for a full-blown xfer using btype, ftype, and disp */
- if (H5P_get(plist, H5FD_FPHDF5_XFER_MEM_MPI_TYPE_NAME, &buf_type) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
+ /* Prepare for a full-blown xfer using btype, ftype, and disp */
+ if (H5P_get(plist, H5FD_FPHDF5_XFER_MEM_MPI_TYPE_NAME, &buf_type) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
- if (H5P_get(plist, H5FD_FPHDF5_XFER_FILE_MPI_TYPE_NAME, &file_type) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
+ if (H5P_get(plist, H5FD_FPHDF5_XFER_FILE_MPI_TYPE_NAME, &file_type) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
- /* Set the file view when we are using MPI derived types */
- if ((mrc = MPI_File_set_view(file->f, mpi_off, MPI_BYTE,
- file_type, H5FD_mpio_native,
- file->info)) != MPI_SUCCESS)
- HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mrc)
+ /* Set the file view when we are using MPI derived types */
+ if ((mrc = MPI_File_set_view(file->f, mpi_off, MPI_BYTE,
+ file_type, H5FD_mpio_native,
+ file->info)) != MPI_SUCCESS)
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mrc)
+
+ /*
+ * When using types, use the address as the displacement for
+ * MPI_File_set_view and reset the address for the read to zero
+ */
+ mpi_off = 0;
+ } else {
+ /* Sanity check that independent I/O must be occuring */
+ assert(xfer_mode==H5FD_MPIO_INDEPENDENT);
+
+ /*
+ * Prepare for a simple xfer of a contiguous block of bytes. The
+ * btype, ftype, and disp fields are not used.
+ */
+ buf_type = MPI_BYTE;
+ }
+
+ /* Read the data. */
+ if (!use_view_this_time) {
+ if ((mrc = MPI_File_read_at(file->f, mpi_off, buf, size_i,
+ buf_type, &status)) != MPI_SUCCESS)
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mrc)
+ } else {
+ if ((mrc = MPI_File_read_at_all(file->f, mpi_off, buf, size_i,
+ buf_type, &status)) != MPI_SUCCESS)
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mrc)
+ }
/*
- * When using types, use the address as the displacement for
- * MPI_File_set_view and reset the address for the read to zero
+ * MPI_Get_count incorrectly returns negative count; fake a complete
+ * read.
*/
- mpi_off = 0;
- } else {
- /* Sanity check that independent I/O must be occuring */
- assert(xfer_mode==H5FD_MPIO_INDEPENDENT);
+ bytes_read = size_i;
/*
- * Prepare for a simple xfer of a contiguous block of bytes. The
- * btype, ftype, and disp fields are not used.
+ * Reset the file view when we used MPI derived types
*/
- buf_type = MPI_BYTE;
- file_type = MPI_BYTE;
- }
+ if (use_view_this_time)
+ if ((mrc = MPI_File_set_view(file->f, (MPI_Offset)0, MPI_BYTE, MPI_BYTE,
+ H5FD_mpio_native, file->info)) != MPI_SUCCESS)
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mrc)
- /* If metadata, check the metadata cache first */
- if (mem_type != H5FD_MEM_DRAW) {
+ } /* end if */
+ else {
/*
* This is metadata - we want to try to read it from the SAP
* first.
@@ -1266,39 +1294,12 @@ HDfprintf(stderr, "%s:%d: Metadata cache read failed!\n", FUNC, __LINE__);
if (sap_status == H5FP_STATUS_OK) {
/* WAH-HOO! We've found it! We can leave now */
- goto finished_read;
} else if (sap_status != H5FP_STATUS_MDATA_NOT_CACHED) {
/* FIXME: something bad happened */
HDfprintf(stderr, "%s:%d: Metadata cache read failed!\n", FUNC, __LINE__);
}
- }
-
- /* Read the data. */
- if (!use_view_this_time) {
- if ((mrc = MPI_File_read_at(file->f, mpi_off, buf, size_i,
- buf_type, &status)) != MPI_SUCCESS)
- HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mrc)
- } else {
- if ((mrc = MPI_File_read_at_all(file->f, mpi_off, buf, size_i,
- buf_type, &status)) != MPI_SUCCESS)
- HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mrc)
- }
-
- /*
- * MPI_Get_count incorrectly returns negative count; fake a complete
- * read.
- */
- bytes_read = size_i;
+ } /* end else */
- /*
- * Reset the file view when we used MPI derived types
- */
- if (use_view_this_time)
- if ((mrc = MPI_File_set_view(file->f, (MPI_Offset)0, MPI_BYTE, MPI_BYTE,
- H5FD_mpio_native, file->info)) != MPI_SUCCESS)
- HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mrc)
-
-finished_read:
/* Check for read failure */
if (bytes_read < 0 || bytes_read > size_i)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed")
@@ -1351,7 +1352,7 @@ H5FD_fphdf5_write(H5FD_t *_file, H5FD_mem_t mem_type, hid_t dxpl_id,
int size_i;
unsigned dumping = 0;
H5P_genplist_t *plist;
- herr_t ret_value = SUCCEED;
+ herr_t ret_value;
FUNC_ENTER_NOAPI(H5FD_fphdf5_write, FAIL)
@@ -1398,9 +1399,9 @@ HDfprintf(stderr, "%s:%d: Couldn't write metadata to SAP (%d)\n",
/* WAH-HOO! We've written it! We can leave now */
/* Forget the EOF value (see H5FD_fphdf5_get_eof()) */
file->eof = HADDR_UNDEF;
- HGOTO_DONE(ret_value)
+ HGOTO_DONE(SUCCEED)
case H5FP_STATUS_FILE_CLOSING:
- HGOTO_DONE(ret_value)
+ HGOTO_DONE(SUCCEED)
case H5FP_STATUS_DUMPING_FAILED:
case H5FP_STATUS_OOM:
case H5FP_STATUS_BAD_FILE_ID:
@@ -1439,13 +1440,14 @@ H5FD_fphdf5_write_real(H5FD_t *_file, hid_t dxpl_id, haddr_t addr, int size,
H5FD_fphdf5_t *file = (H5FD_fphdf5_t*)_file;
MPI_Status status;
MPI_Datatype buf_type;
- MPI_Datatype file_type;
MPI_Offset mpi_off;
int mrc;
int bytes_written;
unsigned use_view_this_time = 0;
H5P_genplist_t *plist;
- H5FD_mpio_xfer_t xfer_mode = H5FD_MPIO_INDEPENDENT;
+#ifndef NDEBUG
+ H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */
+#endif /* NDEBUG */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5FD_fphdf5_write_real, FAIL)
@@ -1480,10 +1482,8 @@ H5FD_fphdf5_write_real(H5FD_t *_file, hid_t dxpl_id, haddr_t addr, int size,
if (H5P_get(plist, H5FD_FPHDF5_XFER_USE_VIEW_NAME, &use_view_this_time) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
-
if (use_view_this_time) {
- /* Sanity check that views will only be used by collective I/O */
- assert(xfer_mode==H5FD_MPIO_COLLECTIVE);
+ MPI_Datatype file_type;
/* Prepare for a full-blown xfer using btype, ftype, and disp */
if (H5P_get(plist, H5FD_FPHDF5_XFER_MEM_MPI_TYPE_NAME, &buf_type) < 0)
@@ -1504,22 +1504,13 @@ H5FD_fphdf5_write_real(H5FD_t *_file, hid_t dxpl_id, haddr_t addr, int size,
*/
mpi_off = 0;
} else {
- /* Sanity check that independent I/O must be occuring */
- assert(xfer_mode==H5FD_MPIO_INDEPENDENT);
-
/*
* Prepare for a simple xfer of a contiguous block of bytes. The
* btype and ftype.
*/
buf_type = MPI_BYTE;
- file_type = MPI_BYTE;
}
-
- if (H5P_get_driver(plist) == H5FD_FPHDF5)
- /* Get the transfer mode */
- xfer_mode = H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME);
-
/* Write the data. */
if (!use_view_this_time) {
/*OKAY: CAST DISCARDS CONST QUALIFIER*/
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 4fefbde..5a629bd 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -1473,11 +1473,13 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add
MPI_Offset mpi_off;
MPI_Status mpi_stat;
int mpi_code; /* mpi return code */
- MPI_Datatype buf_type, file_type;
+ MPI_Datatype buf_type;
int size_i, bytes_read, n;
unsigned use_view_this_time=0;
H5P_genplist_t *plist; /* Property list pointer */
- H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; /* I/O tranfer mode */
+#ifndef NDEBUG
+ H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */
+#endif /* NDEBUG */
herr_t ret_value=SUCCEED;
FUNC_ENTER_NOAPI(H5FD_mpio_read, FAIL)
@@ -1512,53 +1514,63 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add
/* Obtain the data transfer properties */
if(NULL == (plist = H5I_object(dxpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- if (H5FD_MPIO==H5P_get_driver(plist)) {
- /* Get the transfer mode */
- xfer_mode=(H5FD_mpio_xfer_t)H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME);
- } /* end if */
+#ifndef NDEBUG
+ xfer_mode=(H5FD_mpio_xfer_t)H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME);
+#endif /* NDEBUG */
- /*
- * Set up for a fancy xfer using complex types, or single byte block. We
- * wouldn't need to rely on the use_view field if MPI semantics allowed
- * us to test that btype=ftype=MPI_BYTE (or even MPI_TYPE_NULL, which
- * could mean "use MPI_BYTE" by convention).
- */
- if(H5P_exist_plist(plist,H5FD_MPIO_XFER_USE_VIEW_NAME)>0)
- if(H5P_get(plist,H5FD_MPIO_XFER_USE_VIEW_NAME,&use_view_this_time)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
+ /* Only look for MPI views for raw data transfers */
+ if(type==H5FD_MEM_DRAW) {
+ /*
+ * Set up for a fancy xfer using complex types, or single byte block. We
+ * wouldn't need to rely on the use_view field if MPI semantics allowed
+ * us to test that btype=ftype=MPI_BYTE (or even MPI_TYPE_NULL, which
+ * could mean "use MPI_BYTE" by convention).
+ */
+ if(H5P_exist_plist(plist,H5FD_MPIO_XFER_USE_VIEW_NAME)>0)
+ if(H5P_get(plist,H5FD_MPIO_XFER_USE_VIEW_NAME,&use_view_this_time)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
- if (use_view_this_time) {
- /* Sanity check that views will only be used by collective I/O */
- assert(xfer_mode==H5FD_MPIO_COLLECTIVE);
+ if (use_view_this_time) {
+ MPI_Datatype file_type;
- /* prepare for a full-blown xfer using btype, ftype, and disp */
- if(H5P_get(plist,H5FD_MPIO_XFER_MEM_MPI_TYPE_NAME,&buf_type)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
- if(H5P_get(plist,H5FD_MPIO_XFER_FILE_MPI_TYPE_NAME,&file_type)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
+ /* Sanity check that views will only be used by collective I/O */
+ assert(xfer_mode==H5FD_MPIO_COLLECTIVE);
- /*
- * Set the file view when we are using MPI derived types
- */
- /*OKAY: CAST DISCARDS CONST QUALIFIER*/
- if (MPI_SUCCESS != (mpi_code=MPI_File_set_view(file->f, mpi_off, MPI_BYTE, file_type, (char*)"native", file->info)))
- HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
+ /* prepare for a full-blown xfer using btype, ftype, and disp */
+ if(H5P_get(plist,H5FD_MPIO_XFER_MEM_MPI_TYPE_NAME,&buf_type)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
+ if(H5P_get(plist,H5FD_MPIO_XFER_FILE_MPI_TYPE_NAME,&file_type)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
- /* When using types, use the address as the displacement for
- * MPI_File_set_view and reset the address for the read to zero
- */
- mpi_off=0;
+ /*
+ * Set the file view when we are using MPI derived types
+ */
+ /*OKAY: CAST DISCARDS CONST QUALIFIER*/
+ if (MPI_SUCCESS != (mpi_code=MPI_File_set_view(file->f, mpi_off, MPI_BYTE, file_type, (char*)"native", file->info)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
+
+ /* When using types, use the address as the displacement for
+ * MPI_File_set_view and reset the address for the read to zero
+ */
+ mpi_off=0;
+ } /* end if */
+ else {
+ /* Sanity check that independent I/O must be occuring */
+ assert(xfer_mode==H5FD_MPIO_INDEPENDENT);
+
+ /*
+ * Prepare for a simple xfer of a contiguous block of bytes. The
+ * btype, ftype, and disp fields are not used.
+ */
+ buf_type = MPI_BYTE;
+ } /* end else */
} /* end if */
else {
- /* Sanity check that independent I/O must be occuring */
- assert(xfer_mode==H5FD_MPIO_INDEPENDENT);
-
/*
* Prepare for a simple xfer of a contiguous block of bytes. The
* btype, ftype, and disp fields are not used.
*/
buf_type = MPI_BYTE;
- file_type = MPI_BYTE;
} /* end else */
/* Read the data. */
@@ -1779,13 +1791,14 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
MPI_Offset mpi_off;
MPI_Status mpi_stat;
- MPI_Datatype buf_type, file_type;
+ MPI_Datatype buf_type;
int mpi_code; /* MPI return code */
int size_i, bytes_written;
unsigned use_view_this_time=0;
- unsigned block_before_meta_write=0; /* Whether to block before a metadata write */
H5P_genplist_t *plist; /* Property list pointer */
- H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; /* I/O tranfer mode */
+#ifndef NDEBUG
+ H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */
+#endif /* NDEBUG */
herr_t ret_value=SUCCEED;
FUNC_ENTER_NOAPI(H5FD_mpio_write, FAIL)
@@ -1820,64 +1833,72 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
/* Obtain the data transfer properties */
if(NULL == (plist = H5I_object(dxpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- if (H5FD_MPIO==H5P_get_driver(plist)) {
- /* Get the transfer mode */
- xfer_mode=(H5FD_mpio_xfer_t)H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME);
- } /* end if */
+#ifndef NDEBUG
+ xfer_mode = H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME);
+#endif /* NDEBUG */
- /*
- * Set up for a fancy xfer using complex types, or single byte block. We
- * wouldn't need to rely on the use_view field if MPI semantics allowed
- * us to test that btype=ftype=MPI_BYTE (or even MPI_TYPE_NULL, which
- * could mean "use MPI_BYTE" by convention).
- */
- if(H5P_exist_plist(plist,H5FD_MPIO_XFER_USE_VIEW_NAME)>0)
- if(H5P_get(plist,H5FD_MPIO_XFER_USE_VIEW_NAME,&use_view_this_time)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
+ if(type==H5FD_MEM_DRAW) {
+ /*
+ * Set up for a fancy xfer using complex types, or single byte block. We
+ * wouldn't need to rely on the use_view field if MPI semantics allowed
+ * us to test that btype=ftype=MPI_BYTE (or even MPI_TYPE_NULL, which
+ * could mean "use MPI_BYTE" by convention).
+ */
+ if(H5P_exist_plist(plist,H5FD_MPIO_XFER_USE_VIEW_NAME)>0)
+ if(H5P_get(plist,H5FD_MPIO_XFER_USE_VIEW_NAME,&use_view_this_time)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
- if (use_view_this_time) {
- /* Sanity check that views will only be used by collective I/O */
- assert(xfer_mode==H5FD_MPIO_COLLECTIVE);
+ if (use_view_this_time) {
+ MPI_Datatype file_type;
- /* prepare for a full-blown xfer using btype, ftype, and disp */
- if(H5P_get(plist,H5FD_MPIO_XFER_MEM_MPI_TYPE_NAME,&buf_type)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
- if(H5P_get(plist,H5FD_MPIO_XFER_FILE_MPI_TYPE_NAME,&file_type)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
+ /* Sanity check that views will only be used by collective I/O */
+ assert(xfer_mode==H5FD_MPIO_COLLECTIVE);
- /*
- * Set the file view when we are using MPI derived types
- */
- /*OKAY: CAST DISCARDS CONST QUALIFIER*/
- if (MPI_SUCCESS != (mpi_code=MPI_File_set_view(file->f, mpi_off, MPI_BYTE, file_type, (char*)"native", file->info)))
- HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
+ /* prepare for a full-blown xfer using btype, ftype, and disp */
+ if(H5P_get(plist,H5FD_MPIO_XFER_MEM_MPI_TYPE_NAME,&buf_type)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
+ if(H5P_get(plist,H5FD_MPIO_XFER_FILE_MPI_TYPE_NAME,&file_type)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property")
- /* When using types, use the address as the displacement for
- * MPI_File_set_view and reset the address for the read to zero
- */
- mpi_off=0;
+ /*
+ * Set the file view when we are using MPI derived types
+ */
+ /*OKAY: CAST DISCARDS CONST QUALIFIER*/
+ if (MPI_SUCCESS != (mpi_code=MPI_File_set_view(file->f, mpi_off, MPI_BYTE, file_type, (char*)"native", file->info)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
+
+ /* When using types, use the address as the displacement for
+ * MPI_File_set_view and reset the address for the read to zero
+ */
+ mpi_off=0;
+ } /* end if */
+ else {
+ /* Sanity check that independent I/O must occur */
+ assert(xfer_mode==H5FD_MPIO_INDEPENDENT);
+
+ /*
+ * Prepare for a simple xfer of a contiguous block of bytes.
+ * The btype, ftype, and disp fields are not used.
+ */
+ buf_type = MPI_BYTE;
+ } /* end else */
} /* end if */
else {
- /* Sanity check that independent I/O must occur */
- assert(xfer_mode==H5FD_MPIO_INDEPENDENT);
+ unsigned block_before_meta_write=0; /* Whether to block before a metadata write */
/*
* Prepare for a simple xfer of a contiguous block of bytes.
* The btype, ftype, and disp fields are not used.
*/
buf_type = MPI_BYTE;
- file_type = MPI_BYTE;
- } /* end else */
- /* Metadata specific actions */
- if(type!=H5FD_MEM_DRAW) {
/* Check if we need to syncronize all processes before attempting metadata write
* (Prevents race condition where the process writing the metadata goes ahead
* and writes the metadata to the file before all the processes have
* read the data, "transmitting" data from the "future" to the reading
* process. -QAK )
*
- * The only time we don't want to block before a metdata write is when
+ * The only time we don't want to block before a metadata write is when
* we are flushing out a bunch of metadata. Then, we block before the
* first write and don't block for further writes in the sequence.
*/
diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c
index 735ea5f..2625208 100644
--- a/src/H5FDmpiposix.c
+++ b/src/H5FDmpiposix.c
@@ -1264,7 +1264,6 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
int mpi_code; /* MPI return code */
ssize_t nbytes; /* Number of bytes written each I/O call */
H5P_genplist_t *plist; /* Property list pointer */
- unsigned block_before_meta_write=0; /* Whether to block before a metadata write */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FD_mpiposix_write, FAIL)
@@ -1289,11 +1288,17 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
/* Metadata specific actions */
if(type!=H5FD_MEM_DRAW) {
+ unsigned block_before_meta_write=0; /* Whether to block before a metadata write */
+
/* Check if we need to syncronize all processes before attempting metadata write
* (Prevents race condition where the process writing the metadata goes ahead
* and writes the metadata to the file before all the processes have
* read the data, "transmitting" data from the "future" to the reading
* process. -QAK )
+ *
+ * The only time we don't want to block before a metadata write is when
+ * we are flushing out a bunch of metadata. Then, we block before the
+ * first write and don't block for further writes in the sequence.
*/
if(H5P_exist_plist(plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME)>0)
if(H5P_get(plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,&block_before_meta_write)<0)