diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2008-11-21 20:03:41 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2008-11-21 20:03:41 (GMT) |
commit | 0b4b87e36ff3ee8a6b1c24733a5b24b7b9112a1f (patch) | |
tree | bf934a53808104ee25d75e1cb69dffe2dfc25d98 /tools/h5repack/h5repack_filters.c | |
parent | e2c88e83bd54e0b76e9173e8e63442ab7230126c (diff) | |
download | hdf5-0b4b87e36ff3ee8a6b1c24733a5b24b7b9112a1f.zip hdf5-0b4b87e36ff3ee8a6b1c24733a5b24b7b9112a1f.tar.gz hdf5-0b4b87e36ff3ee8a6b1c24733a5b24b7b9112a1f.tar.bz2 |
[svn-r16115] #1375. Define a default chunk whose size is manageable. Defined currently as the same size of hyperslab (that compares the dimension sizes against a predefined constant size and chooses the minimum between the two)
Tested : linux, windows
Diffstat (limited to 'tools/h5repack/h5repack_filters.c')
-rw-r--r-- | tools/h5repack/h5repack_filters.c | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index 98ef07e..341803f 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -15,6 +15,7 @@ #include "h5repack.h" #include "h5test.h" +#include "h5tools.h" /*------------------------------------------------------------------------- @@ -193,6 +194,7 @@ int aux_assign_obj(const char* name, /* object name from traverse lis int apply_filters(const char* name, /* object name from traverse list */ int rank, /* rank of dataset */ hsize_t *dims, /* dimensions of dataset */ + size_t msize, /* size of type */ hid_t dcpl_id, /* dataset creation property list */ pack_opt_t *options, /* repack options */ int *has_filter) /* (OUT) object NAME has a filter */ @@ -250,13 +252,13 @@ int apply_filters(const char* name, /* object name from traverse list */ if ((layout = H5Pget_layout(dcpl_id))<0) return -1; - if (layout==H5D_CHUNKED) + if (layout == H5D_CHUNKED) { if ((rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize/*out*/))<0) return -1; - obj.layout=H5D_CHUNKED; - obj.chunk.rank=rank; - for ( i=0; i<rank; i++) + obj.layout = H5D_CHUNKED; + obj.chunk.rank = rank; + for ( i = 0; i < rank; i++) obj.chunk.chunk_lengths[i] = chsize[i]; } } @@ -283,9 +285,32 @@ int apply_filters(const char* name, /* object name from traverse list */ */ if (obj.layout==-1) { - obj.chunk.rank=rank; - for (i=0; i<rank; i++) - obj.chunk.chunk_lengths[i] = dims[i]; + + /* stripmine info */ + hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */ + hsize_t sm_nbytes; /*bytes per stripmine */ + + obj.chunk.rank = rank; + + /* + * determine the strip mine size. The strip mine is + * a hyperslab whose size is manageable. + */ + + sm_nbytes = msize; + for ( i = rank; i > 0; --i) + { + sm_size[i - 1] = MIN(dims[i - 1], H5TOOLS_BUFSIZE / sm_nbytes); + sm_nbytes *= sm_size[i - 1]; + assert(sm_nbytes > 0); + + } + + for ( i = 0; i < rank; i++) + { + obj.chunk.chunk_lengths[i] = sm_size[i]; + } + } for ( i=0; i<obj.nfilters; i++) |