summaryrefslogtreecommitdiffstats
path: root/src/H5Cmpio.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@lbl.gov>2020-08-27 23:18:44 (GMT)
committerQuincey Koziol <koziol@lbl.gov>2020-08-27 23:18:44 (GMT)
commit165c454aa739477fda6837a14b7cdaa3a7f0b7aa (patch)
treeec7fd5d41cb22206cc8339c50940841b6cbeb3e4 /src/H5Cmpio.c
parent72b9b8ca7535ddce25fe03e6a3b3ae774c88f85b (diff)
downloadhdf5-165c454aa739477fda6837a14b7cdaa3a7f0b7aa.zip
hdf5-165c454aa739477fda6837a14b7cdaa3a7f0b7aa.tar.gz
hdf5-165c454aa739477fda6837a14b7cdaa3a7f0b7aa.tar.bz2
Revert PR 405 (https://bitbucket.hdfgroup.org/projects/HDFFV/repos/hdf5/pull-requests/405/overview)
and reimplement with correct and simpler code.
Diffstat (limited to 'src/H5Cmpio.c')
-rw-r--r--src/H5Cmpio.c55
1 files changed, 18 insertions, 37 deletions
diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c
index 5297a96..f451671 100644
--- a/src/H5Cmpio.c
+++ b/src/H5Cmpio.c
@@ -1000,6 +1000,7 @@ H5C__collective_write(H5F_t *f)
{
H5AC_t *cache_ptr;
H5FD_mpio_xfer_t orig_xfer_mode = H5FD_MPIO_COLLECTIVE;
+ void *base_buf;
int count;
int *length_array = NULL;
MPI_Aint *buf_array = NULL;
@@ -1009,6 +1010,7 @@ H5C__collective_write(H5F_t *f)
MPI_Datatype ftype;
hbool_t ftype_created = FALSE;
int mpi_code;
+ char unused = 0; /* Unused, except for non-NULL pointer value */
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -1023,19 +1025,17 @@ H5C__collective_write(H5F_t *f)
if(H5CX_get_io_xfer_mode(&orig_xfer_mode) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode")
+ /* Set transfer mode */
+ if(H5CX_set_io_xfer_mode(H5FD_MPIO_COLLECTIVE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O transfer mode")
+
/* Get number of entries in collective write list */
count = (int)H5SL_count(cache_ptr->coll_write_list);
if(count > 0) {
- H5FD_mpio_xfer_t xfer_mode = H5FD_MPIO_COLLECTIVE;
H5SL_node_t *node;
H5C_cache_entry_t *entry_ptr;
- void *base_buf;
int i;
- /* Set new transfer mode */
- if(H5CX_set_io_xfer_mode(xfer_mode) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O transfer mode")
-
/* Allocate arrays */
if(NULL == (length_array = (int *)H5MM_malloc((size_t)count * sizeof(int))) )
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for collective write table length array")
@@ -1085,42 +1085,23 @@ H5C__collective_write(H5F_t *f)
ftype_created = TRUE;
if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&ftype)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
-
- /* Pass buf type, file type to the file driver */
- if(H5CX_set_mpi_coll_datatypes(btype, ftype) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O properties")
-
- /* Write data */
- if(H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)0, (size_t)1, base_buf) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to write entries collectively")
-
} /* end if */
else {
- MPI_Status mpi_stat;
- MPI_File mpi_fh_p;
- MPI_File mpi_fh;
+ /* Pass trivial buf type, file type to the file driver */
+ btype = MPI_BYTE;
+ ftype = MPI_BYTE;
-/* This should be rewritten to call H5F_block_write, with the correct
- * buffer and file datatypes (null ones). -QAK, 2018/02/21
- */
- if(H5F_get_mpi_handle(f, (MPI_File **)&mpi_fh_p) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't get mpi file handle")
-
- mpi_fh = *(MPI_File*)mpi_fh_p;
-
- /* just to match up with the 1st MPI_File_set_view from H5FD_mpio_write() */
- if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, "native", MPI_INFO_NULL)))
- HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
+ /* Set non-NULL pointer for I/O operation */
+ base_buf = &unused;
+ } /* end else */
- /* just to match up with MPI_File_write_at_all from H5FD_mpio_write() */
- HDmemset(&mpi_stat, 0, sizeof(MPI_Status));
- if(MPI_SUCCESS != (mpi_code = MPI_File_write_at_all(mpi_fh, (MPI_Offset)0, NULL, 0, MPI_BYTE, &mpi_stat)))
- HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code)
+ /* Pass buf type, file type to the file driver */
+ if(H5CX_set_mpi_coll_datatypes(btype, ftype) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O properties")
- /* just to match up with the 2nd MPI_File_set_view (reset) in H5FD_mpio_write() */
- if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, "native", MPI_INFO_NULL)))
- HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
- } /* end else */
+ /* Write data */
+ if(H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)0, (size_t)1, base_buf) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "unable to write entries collectively")
done:
/* Free arrays */