summaryrefslogtreecommitdiffstats
path: root/src/H5Dio.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-06-14 20:39:08 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-06-14 20:39:08 (GMT)
commitfabb5167ba3afb1f32784d274df67f8b6195e5ea (patch)
treea8d00af71a6f9fd04127fbb42b930284765e1867 /src/H5Dio.c
parentef01629bb29800c8837a261b85897570e4c092c1 (diff)
downloadhdf5-fabb5167ba3afb1f32784d274df67f8b6195e5ea.zip
hdf5-fabb5167ba3afb1f32784d274df67f8b6195e5ea.tar.gz
hdf5-fabb5167ba3afb1f32784d274df67f8b6195e5ea.tar.bz2
[svn-r8686] Purpose:
Code optimization Description: Eliminate memcpy() when using default DXPL by pointing at existing default object, instead of copying it. Platforms tested: Solaris 2.7 (arabica) FreeBSD 4.10 (sleipnir) w/parallel Too minor to require h5committest
Diffstat (limited to 'src/H5Dio.c')
-rw-r--r--src/H5Dio.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 389cfef..243b5a9 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -375,11 +375,14 @@ done:
within the library.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
+ The CACHE pointer should point at already allocated memory to place
+ non-default property list info. If a default property list is used, the
+ CACHE pointer will be changed to point at the default information.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5D_get_dxpl_cache(hid_t dxpl_id, H5D_dxpl_cache_t *cache)
+H5D_get_dxpl_cache(hid_t dxpl_id, H5D_dxpl_cache_t **cache)
{
herr_t ret_value=SUCCEED; /* Return value */
@@ -390,9 +393,9 @@ H5D_get_dxpl_cache(hid_t dxpl_id, H5D_dxpl_cache_t *cache)
/* Check for the default DXPL */
if(dxpl_id==H5P_DATASET_XFER_DEFAULT)
- HDmemcpy(cache,&H5D_def_dxpl_cache,sizeof(H5D_dxpl_cache_t));
+ *cache=&H5D_def_dxpl_cache;
else
- if(H5D_get_dxpl_cache_real(dxpl_id,cache)<0)
+ if(H5D_get_dxpl_cache_real(dxpl_id,*cache)<0)
HGOTO_ERROR (H5E_DATASET, H5E_CANTGET, FAIL, "Can't retrieve DXPL values")
done:
@@ -647,7 +650,8 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
#ifdef H5_HAVE_PARALLEL
hbool_t xfer_mode_changed=FALSE; /* Whether the transfer mode was changed */
#endif /*H5_HAVE_PARALLEL*/
- H5D_dxpl_cache_t dxpl_cache; /* Data transfer property cache */
+ H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */
+ H5D_dxpl_cache_t *dxpl_cache=&_dxpl_cache; /* Data transfer property cache */
unsigned sconv_flags=0; /* Flags for the space conversion */
herr_t ret_value = SUCCEED; /* Return value */
@@ -672,12 +676,12 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
#ifdef H5_HAVE_PARALLEL
/* Collective access is not permissible without a MPI based VFD */
- if (dxpl_cache.xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPI(dataset->ent.file))
+ if (dxpl_cache->xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPI(dataset->ent.file))
HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based drivers only")
/* Set the "parallel I/O possible" flag, for H5S_find(), if we are doing collective I/O */
/* (Don't set the parallel I/O possible flag for the MPI-posix driver, since it doesn't do real collective I/O) */
- if (H5S_mpi_opt_types_g && dxpl_cache.xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPIPOSIX(dataset->ent.file))
+ if (H5S_mpi_opt_types_g && dxpl_cache->xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPIPOSIX(dataset->ent.file))
sconv_flags |= H5S_CONV_PAR_IO_POSSIBLE;
#endif /*H5_HAVE_PARALLEL*/
@@ -760,18 +764,18 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
#ifdef H5_HAVE_PARALLEL
/* Don't reset the transfer mode if we can't or won't use it */
if(!use_par_opt_io || !H5T_path_noop(tpath))
- H5D_io_assist_mpio(dxpl_id, &dxpl_cache, &xfer_mode_changed);
+ H5D_io_assist_mpio(dxpl_id, dxpl_cache, &xfer_mode_changed);
#endif /*H5_HAVE_PARALLEL*/
/* Determine correct I/O routine to invoke */
if(dataset->layout.type!=H5D_CHUNKED) {
if(H5D_contig_read(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv,
- &dxpl_cache, dxpl_id, src_id, dst_id, buf)<0)
+ dxpl_cache, dxpl_id, src_id, dst_id, buf)<0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
} /* end if */
else {
if(H5D_chunk_read(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv,
- &dxpl_cache, dxpl_id, src_id, dst_id, buf)<0)
+ dxpl_cache, dxpl_id, src_id, dst_id, buf)<0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
} /* end else */
@@ -851,7 +855,8 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
#ifdef H5_HAVE_PARALLEL
hbool_t xfer_mode_changed=FALSE; /* Whether the transfer mode was changed */
#endif /*H5_HAVE_PARALLEL*/
- H5D_dxpl_cache_t dxpl_cache; /* Data transfer property cache */
+ H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */
+ H5D_dxpl_cache_t *dxpl_cache=&_dxpl_cache; /* Data transfer property cache */
unsigned sconv_flags=0; /* Flags for the space conversion */
herr_t ret_value = SUCCEED; /* Return value */
@@ -896,12 +901,12 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
#ifdef H5_HAVE_PARALLEL
/* Collective access is not permissible without a MPI based VFD */
- if (dxpl_cache.xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPI(dataset->ent.file))
+ if (dxpl_cache->xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPI(dataset->ent.file))
HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based driver only")
/* Set the "parallel I/O possible" flag, for H5S_find(), if we are doing collective I/O */
/* (Don't set the parallel I/O possible flag for the MPI-posix driver, since it doesn't do real collective I/O) */
- if (H5S_mpi_opt_types_g && dxpl_cache.xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPIPOSIX(dataset->ent.file))
+ if (H5S_mpi_opt_types_g && dxpl_cache->xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPIPOSIX(dataset->ent.file))
sconv_flags |= H5S_CONV_PAR_IO_POSSIBLE;
#endif /*H5_HAVE_PARALLEL*/
@@ -975,18 +980,18 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
#ifdef H5_HAVE_PARALLEL
/* Don't reset the transfer mode if we can't or won't use it */
if(!use_par_opt_io || !H5T_path_noop(tpath))
- H5D_io_assist_mpio(dxpl_id, &dxpl_cache, &xfer_mode_changed);
+ H5D_io_assist_mpio(dxpl_id, dxpl_cache, &xfer_mode_changed);
#endif /*H5_HAVE_PARALLEL*/
/* Determine correct I/O routine to invoke */
if(dataset->layout.type!=H5D_CHUNKED) {
if(H5D_contig_write(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv,
- &dxpl_cache, dxpl_id, src_id, dst_id, buf)<0)
+ dxpl_cache, dxpl_id, src_id, dst_id, buf)<0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
} /* end if */
else {
if(H5D_chunk_write(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv,
- &dxpl_cache, dxpl_id, src_id, dst_id, buf)<0)
+ dxpl_cache, dxpl_id, src_id, dst_id, buf)<0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
} /* end else */