diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-10-28 15:33:56 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-10-28 15:33:56 (GMT) |
commit | 10b6bab2abbf239495fa59f459ce0134c9a03bb0 (patch) | |
tree | 1f669dcf90a899587fbaf10d4f3bc946115a13f8 | |
parent | f4240b2639ccdd5f0444f7a8892afb6759da9989 (diff) | |
download | hdf5-10b6bab2abbf239495fa59f459ce0134c9a03bb0.zip hdf5-10b6bab2abbf239495fa59f459ce0134c9a03bb0.tar.gz hdf5-10b6bab2abbf239495fa59f459ce0134c9a03bb0.tar.bz2 |
[svn-r7767] Purpose:
Code cleanup
Description:
Untwist the last few sections of code before starting on fixing the
problems with reading off the end of the file in earnest.
Platforms tested:
FreeBSD 4.9 (sleipnir)
FreeBSD 4.9 (sleipnir) w/parallel
h5committest not necessary - parallel only changes
-rw-r--r-- | src/H5FDfphdf5.c | 28 | ||||
-rw-r--r-- | src/H5FDmpio.c | 47 |
2 files changed, 24 insertions, 51 deletions
diff --git a/src/H5FDfphdf5.c b/src/H5FDfphdf5.c index 842e941..d43c71f 100644 --- a/src/H5FDfphdf5.c +++ b/src/H5FDfphdf5.c @@ -1240,6 +1240,11 @@ H5FD_fphdf5_read(H5FD_t *_file, H5FD_mem_t mem_type, hid_t dxpl_id, * MPI_File_set_view and reset the address for the read to zero */ mpi_off = 0; + + /* Read the data. */ + 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) } else { /* Sanity check that independent I/O must be occuring */ assert(xfer_mode==H5FD_MPIO_INDEPENDENT); @@ -1249,17 +1254,11 @@ H5FD_fphdf5_read(H5FD_t *_file, H5FD_mem_t mem_type, hid_t dxpl_id, * btype, ftype, and disp fields are not used. */ buf_type = MPI_BYTE; - } - /* Read the data. */ - if (!use_view_this_time) { + /* Read the data. */ 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) } /* @@ -1503,25 +1502,24 @@ H5FD_fphdf5_write_real(H5FD_t *_file, hid_t dxpl_id, haddr_t addr, int size, * MPI_File_set_view and reset the address for the read to zero */ mpi_off = 0; + + /* Write the data. */ + /*OKAY: CAST DISCARDS CONST QUALIFIER*/ + if ((mrc = MPI_File_write_at_all(file->f, mpi_off, (void*)buf, + size, buf_type, &status)) != MPI_SUCCESS) + HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mrc) } else { /* * Prepare for a simple xfer of a contiguous block of bytes. The * btype and ftype. */ buf_type = MPI_BYTE; - } - /* Write the data. */ - if (!use_view_this_time) { + /* Write the data. */ /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if ((mrc = MPI_File_write_at(file->f, mpi_off, (void*)buf, size, buf_type, &status)) != MPI_SUCCESS) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mrc) - } else { - /*OKAY: CAST DISCARDS CONST QUALIFIER*/ - if ((mrc = MPI_File_write_at_all(file->f, mpi_off, (void*)buf, - size, buf_type, &status)) != MPI_SUCCESS) - HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mrc) } /* Reset the file view when we used MPI derived types */ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 5a629bd..f045e7e 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1473,7 +1473,7 @@ 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; + MPI_Datatype buf_type=MPI_BYTE; /* MPI description of the selection in memory */ int size_i, bytes_read, n; unsigned use_view_this_time=0; H5P_genplist_t *plist; /* Property list pointer */ @@ -1557,33 +1557,20 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add 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 { - /* - * 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 */ /* Read the data. */ - if (!use_view_this_time) { - if (MPI_SUCCESS!= (mpi_code=MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code) - } else { + if (use_view_this_time) { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "H5FD_mpio_read: using MPIO collective mode\n"); #endif if (MPI_SUCCESS!= (mpi_code=MPI_File_read_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat ))) HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mpi_code) + } else { + if (MPI_SUCCESS!= (mpi_code=MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code) } /* KLUDGE, Robb Matzke, 2000-12-29 @@ -1791,7 +1778,7 @@ 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; + MPI_Datatype buf_type=MPI_BYTE; /* MPI description of the selection in memory */ int mpi_code; /* MPI return code */ int size_i, bytes_written; unsigned use_view_this_time=0; @@ -1875,23 +1862,11 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, 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 { 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; - /* 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 @@ -1926,11 +1901,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, } /* end if */ /* Write the data. */ - if (!use_view_this_time) { - /*OKAY: CAST DISCARDS CONST QUALIFIER*/ - if (MPI_SUCCESS != (mpi_code=MPI_File_write_at(file->f, mpi_off, (void*)buf, size_i, buf_type, &mpi_stat))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code) - } else { + if (use_view_this_time) { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "H5FD_mpio_write: using MPIO collective mode\n"); @@ -1938,6 +1909,10 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if (MPI_SUCCESS != (mpi_code=MPI_File_write_at_all(file->f, mpi_off, (void*)buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code) + } else { + /*OKAY: CAST DISCARDS CONST QUALIFIER*/ + if (MPI_SUCCESS != (mpi_code=MPI_File_write_at(file->f, mpi_off, (void*)buf, size_i, buf_type, &mpi_stat))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code) } /* KLUDGE, Robb Matzke, 2000-12-29 |