diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2008-11-21 15:39:06 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2008-11-21 15:39:06 (GMT) |
commit | b067b416b21013d38dff9f46948b6db3862450c1 (patch) | |
tree | 9d870f943711fb16f28aaf54da4c90c8045b1e04 /tools/h5repack | |
parent | a4487662b0ee9443951642c38bcd5c2478ff24ef (diff) | |
download | hdf5-b067b416b21013d38dff9f46948b6db3862450c1.zip hdf5-b067b416b21013d38dff9f46948b6db3862450c1.tar.gz hdf5-b067b416b21013d38dff9f46948b6db3862450c1.tar.bz2 |
[svn-r16112] #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')
-rw-r--r-- | tools/h5repack/h5repack.h | 1 | ||||
-rw-r--r-- | tools/h5repack/h5repack_copy.c | 17 | ||||
-rw-r--r-- | tools/h5repack/h5repack_filters.c | 50 |
3 files changed, 55 insertions, 13 deletions
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index 384ec2d..b63102b 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -176,6 +176,7 @@ void init_packobject(pack_info_t *obj); 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 */ diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 312f085..b165dc7 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -23,9 +23,6 @@ extern char *progname; -#if 0 -#define H5REPACK_DEBUG -#endif /*------------------------------------------------------------------------- * macros @@ -41,7 +38,7 @@ static void print_dataset_info(hid_t dcpl_id,char *objname,double per, int pr); static int do_copy_objects(hid_t fidin,hid_t fidout,trav_table_t *travt,pack_opt_t *options); static int copy_attr(hid_t loc_in,hid_t loc_out,pack_opt_t *options); static int copy_user_block(const char *infile, const char *outfile, hsize_t size); -#if defined (H5REPACK_DEBUG) +#if defined (H5REPACK_DEBUG_USER_BLOCK) static void print_user_block(const char *filename, hid_t fid); #endif @@ -212,7 +209,7 @@ int copy_objects(const char* fnamein, -#if defined (H5REPACK_DEBUG) +#if defined (H5REPACK_DEBUG_USER_BLOCK) print_user_block(fnamein,fidin); #endif @@ -713,7 +710,13 @@ int do_copy_objects(hid_t fidin, /* apply the filter */ if (apply_s) { - if (apply_filters(travt->objs[i].name,rank,dims,dcpl_out,options,&has_filter) < 0) + if (apply_filters(travt->objs[i].name, + rank, + dims, + msize, + dcpl_out, + options, + &has_filter) < 0) goto error; } @@ -1453,7 +1456,7 @@ done: * *------------------------------------------------------------------------- */ -#if defined (H5REPACK_DEBUG) +#if defined (H5REPACK_DEBUG_USER_BLOCK) static void print_user_block(const char *filename, hid_t fid) { diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index cd4693e..8f51e20 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,45 @@ 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++) + + /* stripmine info */ + hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */ + hsize_t sm_nbytes; /*bytes per stripmine */ + + obj.chunk.rank = rank; + + +#if 0 + for ( i = 0; i < rank; i++) + { obj.chunk.chunk_lengths[i] = dims[i]; + } + +#else + + /* + * 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]; + } + +#endif + + + } for ( i=0; i<obj.nfilters; i++) |