diff options
author | Robb Matzke <matzke@llnl.gov> | 1999-06-18 15:12:18 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1999-06-18 15:12:18 (GMT) |
commit | 8baa67525092387f0e5b8ce7e139a9a6849c2c63 (patch) | |
tree | 59b08e44f1913c85fe5f72b5a139d0aa59cae3bc /src/H5T.c | |
parent | ca9f4c3888a5763b20b696ace5e213ab0f72f6e6 (diff) | |
download | hdf5-8baa67525092387f0e5b8ce7e139a9a6849c2c63.zip hdf5-8baa67525092387f0e5b8ce7e139a9a6849c2c63.tar.gz hdf5-8baa67525092387f0e5b8ce7e139a9a6849c2c63.tar.bz2 |
[svn-r1362]
Changes since 19990616
----------------------
./src/H5T.c
./src/H5Tconv.c
All conversion functions take an extra argument called
`stride' which is the number of bytes to advance the source
and destination pointers after each element is converted. If
the value is zero then the old behavior is preserved (source
and destination values are packed). This feature was necessary
to implement the compound datatype conversion optimizations
and it causes a minor change to the API (application-defined
type conversion functions take an extra size_t stride
argument).
./src/H5Tconv.c
An additional compound data type conversion function was added
which is applied unless the destination type is larger than
the source type. I'm measuring significant performance
increases for certain operations:
Test Name Struct-Conv Noop-Conv
New(Old) MB/s New(Old) MB/s
---------- ------------- -------------
Reordering 2.062(0.3936) 54087(0.9047)
Subsetting 2.901(0.6581) 40192(1.1100)
Shrinking 1.976(0.3925) 33628(1.1500)
---------- ------------- -------------
./test/dtypes.c
Added various compound datatype conversion tests.
Fixed return values from functions.
./src/H5T.c
Conversion timers are updated only if H5T debugging is turned
on a runtime (in addition to compile time). This allows the
data type layer to be compiled with debugging support without
having to pay a big runtime penalty if the debugging isn't
actually used.
./src/H5A.c
./src/H5D.c
./src/H5Ofill.c
./src/H5P.c
./src/H5T.c
./src/H5Tconv.c
./src/H5Tpkg.h
./src/H5Tprivate.h
./src/H5Tpublic.h
Added the stride argument to the H5T_convert() calls. The
stride is always zero, which means that the source and
destination data values are packed.
./configure.in
./configure [REGENERATED]
If API tracing is turned off then libhdf5.settings will say
`no' instead of nothing.
./test/flush1.c
./test/flush2.c
Added better error messages in a couple places.
Diffstat (limited to 'src/H5T.c')
-rw-r--r-- | src/H5T.c | 46 |
1 files changed, 30 insertions, 16 deletions
@@ -956,6 +956,9 @@ H5T_init_interface(void) status |= H5Tregister(H5T_PERS_SOFT, "struct", compound, compound, H5T_conv_struct); + status |= H5Tregister(H5T_PERS_SOFT, "struct(opt)", + compound, compound, + H5T_conv_struct_opt); status |= H5Tregister(H5T_PERS_SOFT, "enum", enum_type, enum_type, H5T_conv_enum); @@ -1355,7 +1358,7 @@ H5T_term_interface(void) H5T_print_stats(path, &nprint/*in,out*/); path->cdata.command = H5T_CONV_FREE; if ((path->func)(FAIL, FAIL, &(path->cdata), - 0, NULL, NULL)<0) { + 0, 0, NULL, NULL)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf (H5DEBUG(T), "H5T: conversion function " @@ -4136,7 +4139,7 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, } HDmemset(&cdata, 0, sizeof cdata); cdata.command = H5T_CONV_INIT; - if ((func)(tmp_sid, tmp_did, &cdata, 0, NULL, NULL)<0) { + if ((func)(tmp_sid, tmp_did, &cdata, 0, 0, NULL, NULL)<0) { H5I_dec_ref(tmp_sid); H5I_dec_ref(tmp_did); tmp_sid = tmp_did = -1; @@ -4168,7 +4171,7 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, H5T_print_stats(old_path, &nprint); old_path->cdata.command = H5T_CONV_FREE; if ((old_path->func)(tmp_sid, tmp_did, &(old_path->cdata), - 0, NULL, NULL)<0) { + 0, 0, NULL, NULL)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx " @@ -4284,7 +4287,7 @@ H5Tunregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, /* Shut down path */ H5T_print_stats(path, &nprint); path->cdata.command = H5T_CONV_FREE; - if ((path->func)(FAIL, FAIL, &(path->cdata), 0, NULL, NULL)<0) { + if ((path->func)(FAIL, FAIL, &(path->cdata), 0, 0, NULL, NULL)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed " @@ -4402,7 +4405,7 @@ H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts, void *buf, "unable to convert between src and dst data types"); } - if (H5T_convert(tpath, src_id, dst_id, nelmts, buf, background)<0) { + if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, buf, background)<0) { HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed"); } @@ -6399,7 +6402,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, HDstrcpy(H5T_g.path[0]->name, "no-op"); H5T_g.path[0]->func = H5T_conv_noop; H5T_g.path[0]->cdata.command = H5T_CONV_INIT; - if (H5T_conv_noop(FAIL, FAIL, &(H5T_g.path[0]->cdata), 0, + if (H5T_conv_noop(FAIL, FAIL, &(H5T_g.path[0]->cdata), 0, 0, NULL, NULL)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { @@ -6487,7 +6490,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, "query"); } path->cdata.command = H5T_CONV_INIT; - if ((func)(src_id, dst_id, &(path->cdata), 0, NULL, NULL)<0) { + if ((func)(src_id, dst_id, &(path->cdata), 0, 0, NULL, NULL)<0) { HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to initialize conversion function"); } @@ -6519,7 +6522,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, } path->cdata.command = H5T_CONV_INIT; if ((H5T_g.soft[i].func) (src_id, dst_id, &(path->cdata), - 0, NULL, NULL)<0) { + 0, 0, NULL, NULL)<0) { HDmemset (&(path->cdata), 0, sizeof(H5T_cdata_t)); H5E_clear(); /*ignore the error*/ } else { @@ -6541,7 +6544,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, assert(table==H5T_g.path[md]); H5T_print_stats(table, &nprint/*in,out*/); table->cdata.command = H5T_CONV_FREE; - if ((table->func)(FAIL, FAIL, &(table->cdata), 0, NULL, NULL)<0) { + if ((table->func)(FAIL, FAIL, &(table->cdata), 0, 0, NULL, NULL)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free " @@ -6605,12 +6608,20 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, * Tuesday, December 15, 1998 * * Modifications: - * + * Robb Matzke, 1999-06-16 + * The timers are updated only if H5T debugging is enabled at + * runtime in addition to compile time. + * + * Robb Matzke, 1999-06-16 + * Added support for non-zero strides. If STRIDE is non-zero + * then convert one value at each memory location advancing + * STRIDE bytes each time; otherwise assume both source and + * destination values are packed. *------------------------------------------------------------------------- */ herr_t H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, - void *buf, void *bkg) + size_t stride, void *buf, void *bkg) { #ifdef H5T_DEBUG H5_timer_t timer; @@ -6619,17 +6630,20 @@ H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, FUNC_ENTER(H5T_convert, FAIL); #ifdef H5T_DEBUG - H5_timer_begin(&timer); + if (H5DEBUG(T)) H5_timer_begin(&timer); #endif tpath->cdata.command = H5T_CONV_CONV; - if ((tpath->func)(src_id, dst_id, &(tpath->cdata), nelmts, buf, bkg)<0) { + if ((tpath->func)(src_id, dst_id, &(tpath->cdata), nelmts, stride, buf, + bkg)<0) { HRETURN_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "data type conversion failed"); } #ifdef H5T_DEBUG - H5_timer_end(&(tpath->stats.timer), &timer); - tpath->stats.ncalls++; - tpath->stats.nelmts += nelmts; + if (H5DEBUG(T)) { + H5_timer_end(&(tpath->stats.timer), &timer); + tpath->stats.ncalls++; + tpath->stats.nelmts += nelmts; + } #endif FUNC_LEAVE(SUCCEED); |