summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-04-17 21:29:43 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-04-17 21:29:43 (GMT)
commit011457075e41d587c47f89250514b3393a78d329 (patch)
treed9b12f2ffc87b12575607102d207a60cd52214b9 /src/H5D.c
parentb59ab36893949af14c403ab46cbdb397f0a24f5b (diff)
downloadhdf5-011457075e41d587c47f89250514b3393a78d329.zip
hdf5-011457075e41d587c47f89250514b3393a78d329.tar.gz
hdf5-011457075e41d587c47f89250514b3393a78d329.tar.bz2
[svn-r353] Changes since 19980414
---------------------- ./html/Compression.html [NEW] ./html/Datasets.html ./html/H5.format.html ./html/H5.user.html Documented compression. A couple of the H5P functions aren't quite implemented yet but they're coming soon... ./src/H5Dprivate.h ./src/H5E.c ./src/H5Epublic.h ./src/H5Farray.c ./src/H5Fistore.c ./src/H5Fprivate.h ./src/H5MF.c ./src/H5MFprivate.h ./src/H5O.c ./src/H5Ocomp.c [NEW] ./src/H5Oprivate.h ./src/H5P.c ./src/H5Ppublic.h ./src/H5Sprivate.h ./src/H5Ssimp.c ./src/H5Z.c [NEW] ./src/H5Zprivate.h [NEW] ./src/H5Zpublic.h [NEW] ./src/Makefile.in ./src/hdf5.h ./test/dsets.c ./test/istore.c Compression is now mostly working. Don't try to open a compressed dataset though because the compression message won't be read. ./html/Datatypes.html ./html/H5.api.html ./src/H5.c ./src/H5private.h ./src/H5D.c ./src/H5T.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5Tprivate.h ./src/H5Tpublic.h Added timing support. When compiled with H5T_DEBUG defined the library will print conversion bandwidths when the library closes. The H5Tregister functions take a string as the first argument so the statistics output is meaningful. ./MANIFEST Added new files. ./configure.in ./src/H5config.h.in Check for getrusage(). Check for compress2() in libz.a and the zlib.h header file. Added `z' to the debug list. ./src/H5B.c ./src/H5Bprivate.h ./src/H5Gnode.c ./src/debug.c Cleaned up some indentation and added support to print istore B-trees. From the debugger, give the B-tree address and the dimensionality from the layout message of the object header. ./src/h5ls.c The oid is printed as w:x:y:z where w and x are the file ID and y and z are the OID within the file. You can give z or y*2^32+z as an argument to the debugger to print the object header for the object. ./src/H5AC.c Cleaned up statistics and made them match those reported by H5T and H5Z. ./src/H5MM.c ./src/H5MMprivate.h ./src/H5Fistore.c Finally got rid of a couple of long-standing const cast warnings.
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c66
1 files changed, 54 insertions, 12 deletions
diff --git a/src/H5D.c b/src/H5D.c
index b53ba33..a49727a 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -17,16 +17,17 @@ static char RcsId[] = "@(#)$Revision$";
/* $Id$ */
#include <H5private.h> /* Generic Functions */
-#include <H5Iprivate.h> /* IDs */
+#include <H5Iprivate.h> /* IDs */
#include <H5ACprivate.h> /* Cache */
#include <H5Dprivate.h> /* Dataset functions */
#include <H5Eprivate.h> /* Error handling */
#include <H5Gprivate.h> /* Group headers */
-#include <H5HLprivate.h> /* Name heap */
+#include <H5HLprivate.h> /* Name heap */
#include <H5MFprivate.h> /* File space allocation header */
#include <H5MMprivate.h> /* Memory management */
#include <H5Oprivate.h> /* Object headers */
#include <H5Pprivate.h> /* Property lists */
+#include <H5Zprivate.h> /* Data compression */
#define PABLO_MASK H5D_mask
@@ -55,10 +56,17 @@ const H5D_create_t H5D_create_dflt = {
1, 1, 1, 1, 1, 1, 1, 1, /*...are quite useless. Larger chunks..*/
1, 1, 1, 1, 1, 1, 1, 1, /*...produce fewer, but larger I/O......*/
1, 1, 1, 1, 1, 1, 1, 1}, /*...requests. */
+
+ /* External file list */
{H5F_ADDR_UNDEF, /* External file list heap address */
0, /*...slots allocated */
0, /*...slots used */
- NULL} /*...slot array */
+ NULL}, /*...slot array */
+
+ /* Compression */
+ {H5Z_NONE, /* No compression */
+ 0, /*...flags */
+ 0, NULL} /*...client data */
};
/* Default dataset transfer property list */
@@ -741,6 +749,11 @@ H5D_create(H5G_t *loc, const char *name, const H5T_t *type, const H5S_t *space,
assert (type);
assert (space);
assert (create_parms);
+ if (H5Z_NONE!=create_parms->compress.method &&
+ H5D_CHUNKED!=create_parms->layout) {
+ HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, NULL,
+ "compression can only be used with chunked layout");
+ }
/* Initialize the dataset object */
new_dset = H5MM_xcalloc(1, sizeof(H5D_t));
@@ -829,9 +842,17 @@ H5D_create(H5G_t *loc, const char *name, const H5T_t *type, const H5S_t *space,
new_dset->type) < 0 ||
H5S_modify(&(new_dset->ent), new_dset->space) < 0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
- "can't update type or space header messages");
+ "unable to update type or space header messages");
}
+ /* Update the compression message */
+ if (H5Z_NONE!=new_dset->create_parms->compress.method &&
+ H5O_modify (&(new_dset->ent), H5O_COMPRESS, 0, H5O_FLAG_CONSTANT,
+ &(new_dset->create_parms->compress))<0) {
+ HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
+ "unable to update compression header message");
+ }
+
/*
* Initialize storage. We assume that external storage is already
* initialized by the caller, or at least will be before I/O is
@@ -1111,6 +1132,9 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
size_t target_size; /*desired buffer size */
size_t request_nelmts; /*requested strip mine */
H5T_bkg_t need_bkg; /*type of background buf*/
+#ifdef H5T_DEBUG
+ H5_timer_t timer;
+#endif
#ifdef HAVE_PARALLEL
int access_mode_saved = -1;
#endif
@@ -1210,6 +1234,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
H5T_conv_noop==tconv_func &&
NULL!=sconv_func->read) {
status = (sconv_func->read)(dataset->ent.file, &(dataset->layout),
+ &(dataset->create_parms->compress),
&(dataset->create_parms->efl),
H5T_get_size (dataset->type), file_space,
mem_space, buf/*out*/);
@@ -1296,6 +1321,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
* if necessary.
*/
if ((sconv_func->fgath)(dataset->ent.file, &(dataset->layout),
+ &(dataset->create_parms->compress),
&(dataset->create_parms->efl),
H5T_get_size (dataset->type), file_space,
&numbering, smine_start, smine_nelmts,
@@ -1314,14 +1340,19 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
/*
* Perform data type conversion.
*/
+#ifdef H5T_DEBUG
+ H5T_timer_begin (&timer, cdata);
+#endif
cdata->command = H5T_CONV_CONV;
- cdata->ncalls++;
- if ((tconv_func)(src_id, dst_id, cdata, smine_nelmts, tconv_buf,
- bkg_buf)<0) {
+ status = (tconv_func)(src_id, dst_id, cdata, smine_nelmts, tconv_buf,
+ bkg_buf);
+#ifdef H5T_DEBUG
+ H5T_timer_end (&timer, cdata, smine_nelmts);
+#endif
+ if (status<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"data type conversion failed");
}
- cdata->nelmts += smine_nelmts;
/*
* Scatter the data into memory.
@@ -1396,6 +1427,9 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
size_t target_size; /*desired buffer size */
size_t request_nelmts; /*requested strip mine */
H5T_bkg_t need_bkg; /*type of background buf*/
+#ifdef H5T_DEBUG
+ H5_timer_t timer;
+#endif
#ifdef HAVE_PARALLEL
int access_mode_saved = -1;
#endif
@@ -1495,6 +1529,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
H5T_conv_noop==tconv_func &&
NULL!=sconv_func->write) {
status = (sconv_func->write)(dataset->ent.file, &(dataset->layout),
+ &(dataset->create_parms->compress),
&(dataset->create_parms->efl),
H5T_get_size (dataset->type), file_space,
mem_space, buf);
@@ -1588,6 +1623,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
if ((H5D_OPTIMIZE_PIPE && H5T_BKG_YES==need_bkg) ||
(!H5D_OPTIMIZE_PIPE && need_bkg)) {
if ((sconv_func->fgath)(dataset->ent.file, &(dataset->layout),
+ &(dataset->create_parms->compress),
&(dataset->create_parms->efl),
H5T_get_size (dataset->type), file_space,
&numbering, smine_start, smine_nelmts,
@@ -1600,19 +1636,25 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
/*
* Perform data type conversion.
*/
+#ifdef H5T_DEBUG
+ H5T_timer_begin (&timer, cdata);
+#endif
cdata->command = H5T_CONV_CONV;
- cdata->ncalls++;
- if ((tconv_func) (src_id, dst_id, cdata, smine_nelmts, tconv_buf,
- bkg_buf)<0) {
+ status = (tconv_func) (src_id, dst_id, cdata, smine_nelmts, tconv_buf,
+ bkg_buf);
+#ifdef H5T_DEBUG
+ H5T_timer_end (&timer, cdata, smine_nelmts);
+#endif
+ if (status<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"data type conversion failed");
}
- cdata->nelmts += smine_nelmts;
/*
* Scatter the data out to the file.
*/
if ((sconv_func->fscat)(dataset->ent.file, &(dataset->layout),
+ &(dataset->create_parms->compress),
&(dataset->create_parms->efl),
H5T_get_size (dataset->type), file_space,
&numbering, smine_start, smine_nelmts,