diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2004-05-03 23:34:42 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2004-05-03 23:34:42 (GMT) |
commit | 0c6229a68d8a8e6148f8a975c5392f62c4b3a35e (patch) | |
tree | 84d752bcf68e1ba3ee89cfa3e49f61e7ad0a853a /src/H5Dio.c | |
parent | ecd3870fa2a8a6a16548592506722d20606be64e (diff) | |
download | hdf5-0c6229a68d8a8e6148f8a975c5392f62c4b3a35e.zip hdf5-0c6229a68d8a8e6148f8a975c5392f62c4b3a35e.tar.gz hdf5-0c6229a68d8a8e6148f8a975c5392f62c4b3a35e.tar.bz2 |
[svn-r8479] Purpose:
New Feature
Description:
Add the data transform function, H5Pset_transform().
Platforms tested:
"h5committested".
Copper was down. Ran parallel tests in sol instead.
Misc. update:
Diffstat (limited to 'src/H5Dio.c')
-rw-r--r-- | src/H5Dio.c | 94 |
1 files changed, 80 insertions, 14 deletions
diff --git a/src/H5Dio.c b/src/H5Dio.c index 227d0d7..48492b2 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -27,6 +27,8 @@ #include "H5Sprivate.h" /* Dataspace functions */ #include "H5TBprivate.h" /* Threaded, balanced, binary trees (TBBTs) */ #include "H5Vprivate.h" /* Vector and array functions */ +#include "H5Tpublic.h" +#include "H5Zprivate.h" /*#define H5D_DEBUG*/ @@ -129,6 +131,7 @@ H5FL_BLK_DEFINE(type_conv); /* Declare a free list to manage the H5D_chunk_info_t struct */ H5FL_DEFINE_STATIC(H5D_chunk_info_t); + /*-------------------------------------------------------------------------- NAME @@ -306,7 +309,10 @@ H5D_get_dxpl_cache_real(hid_t dxpl_id, H5D_dxpl_cache_t *cache) /* Get the dataset transfer property list */ if (NULL == (dx_plist = H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list") - + + /* Get the data transform property */ + H5P_get(dx_plist, H5D_XFER_XFORM, &cache->data_xform_prop); + /* Get maximum temporary buffer size */ if(H5P_get(dx_plist, H5D_XFER_MAX_TEMP_BUF_NAME, &cache->max_temp_buf)<0) HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve maximum temporary buffer size") @@ -1030,6 +1036,8 @@ done: * Modifications: * QAK - 2003/04/17 * Hacked on it a lot. :-) + * Leon Arber: 4/20/04 + * Added support for data transforms. * *------------------------------------------------------------------------- */ @@ -1062,13 +1070,19 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, hsize_t n, smine_nelmts; /*elements per strip */ herr_t ret_value = SUCCEED; /*return value */ + hid_t array_type; + FUNC_ENTER_NOAPI_NOINIT(H5D_contig_read) - + + /* Inits for data transforms, if needed */ + array_type = H5Z_xform_find_type(mem_type); + /* * If there is no type conversion then read directly into the * application's buffer. This saves at least one mem-to-mem copy. */ - if (H5T_path_noop(tpath)) { + + if ( (dxpl_cache->data_xform_prop == NULL) && H5T_path_noop(tpath)) { #ifdef H5S_DEBUG H5_timer_begin(&timer); #endif @@ -1090,10 +1104,10 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, if (status<0) { HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "optimized read failed") } else - /* direct xfer accomplished successfully */ + /* direct xfer accomplished successfully */ HGOTO_DONE(SUCCEED) } /* end if */ - + /* * This is the general case(type conversion). */ @@ -1205,6 +1219,15 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, 0, 0, tconv_buf, bkg_buf, dxpl_id)<0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "data type conversion failed") + + /* Added by LA to do data transforms */ + + if(dxpl_cache->data_xform_prop) + H5Z_xform_eval(dxpl_cache->data_xform_prop->parse_root, tconv_buf, smine_nelmts, array_type); + + /* end of LA additions */ + + /* * Scatter the data into memory. */ @@ -1213,6 +1236,8 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, #endif status = H5S_select_mscat(tconv_buf, mem_space, &mem_iter, smine_nelmts, dxpl_cache, buf/*out*/); + + #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[1].scat_timer), &timer); sconv->stats[1].scat_nbytes += smine_nelmts * dst_type_size; @@ -1260,6 +1285,8 @@ done: * Modifications: * QAK - 2003/04/17 * Hacked on it a lot. :-) + * Leon Arber: 4/20/04 + * Added support for data transforms. * *------------------------------------------------------------------------- */ @@ -1290,14 +1317,21 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5 hsize_t smine_start; /*strip mine start loc */ hsize_t n, smine_nelmts; /*elements per strip */ herr_t ret_value = SUCCEED; /*return value */ - - FUNC_ENTER_NOAPI_NOINIT(H5D_contig_write) + hid_t array_type; + + FUNC_ENTER_NOAPI_NOINIT(H5D_contig_write) + + /*TODO: This should be the type of the destination file...not the memory source. Where do we get this? */ + /* Inits for the data transform, if needed */ + array_type = H5Z_xform_find_type(mem_type); + /* * If there is no type conversion then write directly from the * application's buffer. This saves at least one mem-to-mem copy. */ - if (H5T_path_noop(tpath)) { + + if ( (dxpl_cache->data_xform_prop == NULL) && H5T_path_noop(tpath)) { #ifdef H5S_DEBUG H5_timer_begin(&timer); #endif @@ -1305,10 +1339,11 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5 status = (sconv->write)(dataset->ent.file, &(dataset->layout), &dataset->dcpl_cache, (H5D_storage_t *)&(dataset->efl), (size_t)nelmts, H5T_get_size(dataset->type), file_space, mem_space, dxpl_cache, dxpl_id, buf); + #ifdef H5S_DEBUG - H5_timer_end(&(sconv->stats[0].write_timer), &timer); - sconv->stats[0].write_nbytes += nelmts * H5T_get_size(mem_type); - sconv->stats[0].write_ncalls++; + H5_timer_end(&(sconv->stats[0].write_timer), &timer); + sconv->stats[0].write_nbytes += nelmts * H5T_get_size(mem_type); + sconv->stats[0].write_ncalls++; #endif /* Check return value from optimized write */ @@ -1437,6 +1472,11 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5 #ifdef H5S_DEBUG H5_timer_begin(&timer); #endif + + /* LA additions for data transforms */ + if(dxpl_cache->data_xform_prop) + H5Z_xform_eval(dxpl_cache->data_xform_prop->parse_root, tconv_buf, smine_nelmts, array_type); + /* End of LA modifications */ status = H5S_select_fscat(dataset->ent.file, &(dataset->layout), &dataset->dcpl_cache, (H5D_storage_t *)&(dataset->efl), file_space, &file_iter, smine_nelmts, dxpl_cache, dxpl_id, tconv_buf); @@ -1451,6 +1491,7 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5 } /* end for */ done: + /* Release selection iterators */ if(file_iter_init) { if(H5S_select_iter_release(&file_iter)<0) @@ -1487,7 +1528,10 @@ done: * Modifications: * QAK - 2003/04/17 * Hacked on it a lot. :-) + * Leon Arber: 4/20/04 + * Added support for data transforms. * + *------------------------------------------------------------------------- */ /* ARGSUSED */ @@ -1524,18 +1568,21 @@ UNUSED uint8_t *bkg_buf = NULL; /*background buffer */ H5D_storage_t store; /*union of EFL and chunk pointer in file space */ herr_t ret_value = SUCCEED; /*return value */ - + hid_t array_type; + FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_read) /* Map elements between file and memory for each chunk*/ if(H5D_create_chunk_map(dataset, mem_type, file_space, mem_space, &fm)<0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't build chunk mapping") + array_type = H5Z_xform_find_type(mem_type); + /* * If there is no type conversion then read directly into the * application's buffer. This saves at least one mem-to-mem copy. */ - if (H5T_path_noop(tpath)) { + if ( (dxpl_cache->data_xform_prop == NULL) && H5T_path_noop(tpath)) { #ifdef H5S_DEBUG H5_timer_begin(&timer); #endif @@ -1705,6 +1752,13 @@ UNUSED tconv_buf, bkg_buf, dxpl_id)<0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "data type conversion failed") + /* LA additions for data transforms */ + if(dxpl_cache->data_xform_prop) + H5Z_xform_eval(dxpl_cache->data_xform_prop->parse_root, tconv_buf, smine_nelmts, array_type); + + + + /* * Scatter the data into memory. */ @@ -1784,6 +1838,8 @@ done: * Modifications: * QAK - 2003/04/17 * Hacked on it a lot. :-) + * Leon Arber: 4/20/04 + * Added support for data transforms. * *------------------------------------------------------------------------- */ @@ -1821,9 +1877,12 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, uint8_t *bkg_buf = NULL; /*background buffer */ H5D_storage_t store; /*union of EFL and chunk pointer in file space */ herr_t ret_value = SUCCEED; /*return value */ + hid_t array_type; FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_write) + array_type = H5Z_xform_find_type(mem_type); + #ifdef QAK { int mpi_rank; @@ -1850,7 +1909,7 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, * If there is no type conversion then write directly from the * application's buffer. This saves at least one mem-to-mem copy. */ - if (H5T_path_noop(tpath)) { + if ((dxpl_cache->data_xform_prop == NULL) && H5T_path_noop(tpath)) { #ifdef H5S_DEBUG H5_timer_begin(&timer); #endif @@ -2043,6 +2102,13 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, tconv_buf, bkg_buf, dxpl_id)<0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "data type conversion failed") + /* LA additions for data transforms */ + if(dxpl_cache->data_xform_prop) + H5Z_xform_eval(dxpl_cache->data_xform_prop->parse_root, tconv_buf, smine_nelmts, array_type); + + + + /* * Scatter the data out to the file. */ |