diff options
Diffstat (limited to 'tools/h5repack')
-rw-r--r-- | tools/h5repack/Makefile.in | 10 | ||||
-rw-r--r-- | tools/h5repack/h5repack.c | 3 | ||||
-rw-r--r-- | tools/h5repack/h5repack.h | 2 | ||||
-rwxr-xr-x | tools/h5repack/h5repack.sh.in | 13 | ||||
-rw-r--r-- | tools/h5repack/h5repack_copy.c | 27 | ||||
-rw-r--r-- | tools/h5repack/h5repack_filters.c | 18 | ||||
-rw-r--r-- | tools/h5repack/h5repack_refs.c | 18 | ||||
-rw-r--r-- | tools/h5repack/testh5repack_dset.c | 2 | ||||
-rw-r--r-- | tools/h5repack/testh5repack_main.c | 46 | ||||
-rw-r--r-- | tools/h5repack/testh5repack_make.c | 36 |
10 files changed, 122 insertions, 53 deletions
diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in index 73601d4..5d6a9c3 100644 --- a/tools/h5repack/Makefile.in +++ b/tools/h5repack/Makefile.in @@ -29,7 +29,7 @@ CPPFLAGS=-I. -I$(srcdir) -I$(top_builddir)/src -I$(top_srcdir)/src \ ## TEST_PROGS=h5repacktst TEST_SCRIPTS=./h5repack.sh - +PRIV_PROGS=testh5repack_detect_szip ## These are our main targets: library and tools. ## @@ -37,7 +37,7 @@ LIBHDF5=$(top_builddir)/src/libhdf5.la LIBTOOLS=../lib/libh5tools.la PUB_PROGS=h5repack -PROGS=$(PUB_PROGS) $(TEST_PROGS) +PROGS=$(PUB_PROGS) $(TEST_PROGS) $(PRIV_PROGS) ## Source and object files for the library; do not install ## @@ -53,9 +53,10 @@ DISTCLEAN=h5repack.sh ## Source and object files for programs... ## PROG_SRC=h5repack.c h5repack_copy.c h5repack_filters.c h5repack_refs.c h5repack_list.c h5repack_main.c h5repack_opttable.c h5repack_parse.c h5repack_verify.c testh5repack_attr.c testh5repack_dset.c testh5repack_main.c testh5repack_make.c testh5repack_util.c -PROG_OBJ=$(PROG_SRC:.c=.lo) OBJS=h5repack.lo h5repack_filters.lo h5repack_copy.lo h5repack_refs.lo h5repack_list.lo h5repack_main.lo h5repack_opttable.lo h5repack_parse.lo h5repack_verify.lo TEST_OBJS=h5repack.lo h5repack_filters.lo h5repack_copy.lo h5repack_refs.lo h5repack_list.lo h5repack_opttable.lo h5repack_parse.lo h5repack_verify.lo testh5repack_attr.lo testh5repack_dset.lo testh5repack_main.lo testh5repack_make.lo testh5repack_util.lo +DETECT_OBJS=testh5repack_detect_szip.lo +PROG_OBJ=$(PROG_SRC:.c=.lo) $(DETECT_OBJS) PRIVATE_HDR= @@ -79,5 +80,8 @@ h5repack: $(OBJS) h5repacktst: $(TEST_OBJS) @$(LT_LINK_EXE) $(CFLAGS) -o $@ $(TEST_OBJS) $(LIBTOOLS) $(LIBHDF5) $(LDFLAGS) $(LIBS) +testh5repack_detect_szip: $(DETECT_OBJS) + @$(LT_LINK_EXE) $(CFLAGS) -o $@ $(DETECT_OBJS) $(LIBTOOLS) $(LIBHDF5) $(LDFLAGS) $(LIBS) + @CONCLUDE@ diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index 2710226..09d83b9 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -264,6 +264,9 @@ static int check_options(pack_opt_t *options) case H5D_CHUNKED: strcpy(slayout,"chunked"); break; + default: + strcpy(slayout,"unknown"); + break; } printf(" Apply %s layout to all\n", slayout); if (H5D_CHUNKED==options->layout_g) { diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index e99888e..e4de4d3 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -21,7 +21,6 @@ #include "h5diff.h" #include "h5tools.h" - #define H5FOPENERROR "unable to open file" #define PFORMAT "%-7s %-7s %-7s\n" /*chunk info, compression info, name*/ @@ -252,6 +251,7 @@ int parse_number(char *str); * tests *------------------------------------------------------------------------- */ + #define FNAME0 "test0.h5" #define FNAME0OUT "test0.out.h5" #define FNAME1 "test1.h5" diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in index a65cb37..a21d608 100755 --- a/tools/h5repack/h5repack.sh.in +++ b/tools/h5repack/h5repack.sh.in @@ -14,8 +14,6 @@ # # Tests for the h5repack tool -# Determine if SZIP has the encoder available -USE_FILTER_SZIP_ENCODER="@USE_FILTER_SZIP_ENCODER@" USE_FILTER_SZIP="@USE_FILTER_SZIP@" USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@" USE_FILTER_SHUFFLE="@USE_FILTER_SHUFFLE@" @@ -28,6 +26,9 @@ H5REPACK_BIN=`pwd`/$H5REPACK # The path of the tool binary H5DIFF=../h5diff/h5diff # The h5diff tool name H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary +H5DETECTSZIP=testh5repack_detect_szip # The tool name +H5DETECTSZIP_BIN=`pwd`/$H5DETECTSZIP # The path of the tool binary + nerrors=0 verbose=yes @@ -123,8 +124,12 @@ TOOLTEST() # See which filters are usable (and skip tests for filters we # don't have). Do this by searching H5pubconf.h to see which # filters are defined. -# A filter value of 3 means the filter can read and write, 2 -# is read-only, 1 is write-only, and 0 is not present. + +# detect whether the encoder is present. +USE_FILTER_SZIP_ENCODER="no"; +if test $USE_FILTER_SZIP = "yes"; then +USE_FILTER_SZIP_ENCODER=`$RUNSERIAL $H5DETECTSZIP_BIN` +fi # copy files (these files have no filters; test2.h5 has copied references that h5diff detects) TOOLTEST test0.h5 diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index a0fd1c9..c1ae54a 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -128,7 +128,7 @@ int copy_objects(const char* fnamein, pack_opt_t *options) { hid_t fidin; - hid_t fidout; + hid_t fidout=(-1); trav_table_t *travt=NULL; /*------------------------------------------------------------------------- @@ -222,17 +222,17 @@ int do_copy_objects(hid_t fidin, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - hid_t grp_in; /* group ID */ - hid_t grp_out; /* group ID */ - hid_t dset_in; /* read dataset ID */ - hid_t dset_out; /* write dataset ID */ - hid_t type_in; /* named type ID */ - hid_t type_out; /* named type ID */ - hid_t dcpl_id; /* dataset creation property list ID */ - hid_t dcpl_out; /* dataset creation property list ID */ - hid_t space_id; /* space ID */ - hid_t ftype_id; /* file data type ID */ - hid_t mtype_id; /* memory data type ID */ + hid_t grp_in=(-1); /* group ID */ + hid_t grp_out=(-1); /* group ID */ + hid_t dset_in=(-1); /* read dataset ID */ + hid_t dset_out=(-1); /* write dataset ID */ + hid_t type_in=(-1); /* named type ID */ + hid_t type_out=(-1); /* named type ID */ + hid_t dcpl_id=(-1); /* dataset creation property list ID */ + hid_t dcpl_out=(-1); /* dataset creation property list ID */ + hid_t space_id=(-1); /* space ID */ + hid_t ftype_id=(-1); /* file data type ID */ + hid_t mtype_id=(-1); /* memory data type ID */ size_t msize; /* memory size of memory type */ void *buf=NULL; /* data buffer */ hsize_t nelmts; /* number of elements in dataset */ @@ -241,7 +241,6 @@ int do_copy_objects(hid_t fidin, hsize_t dsize_in; /* input dataset size before filter */ int next; /* external files */ int i, j; - int wrote=0; /*------------------------------------------------------------------------- * copy the suppplied object list @@ -401,7 +400,6 @@ int do_copy_objects(hid_t fidin, if (dsize_in && nelmts) { if (H5Dwrite(dset_out,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) goto error; - wrote=1; } /*------------------------------------------------------------------------- * copy attrs @@ -557,7 +555,6 @@ error: } - /*------------------------------------------------------------------------- * Function: copy_attr * diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index 844ee5e..5d815c9 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -73,15 +73,15 @@ int aux_assign_obj(const char* name, /* object name from traverse lis pack_info_t *obj /*OUT*/) /* info about object to filter */ { - int index, i; + int idx, i; pack_info_t tmp; init_packobject(&tmp); - index = aux_find_obj(name,options,&tmp); + idx = aux_find_obj(name,options,&tmp); /* name was on input */ - if (index>=0) + if (idx>=0) { /* applying to all objects */ @@ -102,13 +102,13 @@ int aux_assign_obj(const char* name, /* object name from traverse lis } else { - tmp.layout = options->op_tbl->objs[index].layout; + tmp.layout = options->op_tbl->objs[idx].layout; switch (tmp.layout) { case H5D_CHUNKED: - tmp.chunk.rank = options->op_tbl->objs[index].chunk.rank; + tmp.chunk.rank = options->op_tbl->objs[idx].chunk.rank; for ( i=0; i<tmp.chunk.rank; i++) - tmp.chunk.chunk_lengths[i]=options->op_tbl->objs[index].chunk.chunk_lengths[i]; + tmp.chunk.chunk_lengths[i]=options->op_tbl->objs[idx].chunk.chunk_lengths[i]; break; default: break; @@ -125,15 +125,15 @@ int aux_assign_obj(const char* name, /* object name from traverse lis } /* if all */ else { - tmp.nfilters=options->op_tbl->objs[index].nfilters; + tmp.nfilters=options->op_tbl->objs[idx].nfilters; for ( i=0; i<tmp.nfilters; i++) { - tmp.filter[i] = options->op_tbl->objs[index].filter[i]; + tmp.filter[i] = options->op_tbl->objs[idx].filter[i]; } } - } /* if index */ + } /* if idx */ /* no input name */ diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index dedad6b..748eca4 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -52,15 +52,15 @@ int do_copy_refobjs(hid_t fidin, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - hid_t grp_in; /* read group ID */ - hid_t grp_out; /* write group ID */ - hid_t dset_in; /* read dataset ID */ - hid_t dset_out; /* write dataset ID */ - hid_t type_in; /* named type ID */ - hid_t dcpl_id; /* dataset creation property list ID */ - hid_t space_id; /* space ID */ - hid_t ftype_id; /* file data type ID */ - hid_t mtype_id; /* memory data type ID */ + hid_t grp_in=(-1); /* read group ID */ + hid_t grp_out=(-1); /* write group ID */ + hid_t dset_in=(-1); /* read dataset ID */ + hid_t dset_out=(-1); /* write dataset ID */ + hid_t type_in=(-1); /* named type ID */ + hid_t dcpl_id=(-1); /* dataset creation property list ID */ + hid_t space_id=(-1); /* space ID */ + hid_t ftype_id=(-1); /* file data type ID */ + hid_t mtype_id=(-1); /* memory data type ID */ size_t msize; /* memory size of memory type */ hsize_t nelmts; /* number of elements in dataset */ int rank; /* rank of dataset */ diff --git a/tools/h5repack/testh5repack_dset.c b/tools/h5repack/testh5repack_dset.c index 4666753..299c044 100644 --- a/tools/h5repack/testh5repack_dset.c +++ b/tools/h5repack/testh5repack_dset.c @@ -638,7 +638,7 @@ static void make_dset_reg_ref(hid_t loc_id) hid_t sid2; /* Dataspace ID #2 */ hsize_t dims1[] = {SPACE1_DIM1}; hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ diff --git a/tools/h5repack/testh5repack_main.c b/tools/h5repack/testh5repack_main.c index caa4ac9..6729174 100644 --- a/tools/h5repack/testh5repack_main.c +++ b/tools/h5repack/testh5repack_main.c @@ -40,6 +40,9 @@ int main (void) { pack_opt_t pack_options; diff_opt_t diff_options; +#if defined (H5_HAVE_FILTER_SZIP) + int szip_can_encode = 0; +#endif memset(&diff_options, 0, sizeof (diff_opt_t)); memset(&pack_options, 0, sizeof (pack_opt_t)); @@ -229,13 +232,17 @@ int main (void) TESTING(" adding szip filter"); -#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE) +#if defined (H5_HAVE_FILTER_SZIP) +if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { + szip_can_encode = 1; +} /*------------------------------------------------------------------------- * test an individual object option *------------------------------------------------------------------------- */ +if (szip_can_encode) { if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; if (h5repack_addfilter("dset2:SZIP=8,EC",&pack_options)<0) @@ -252,6 +259,9 @@ int main (void) TEST_ERROR; PASSED(); +} else { + SKIPPED(); +} #else SKIPPED(); #endif @@ -263,7 +273,8 @@ int main (void) */ TESTING(" adding szip filter to all"); -#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE) +#if defined (H5_HAVE_FILTER_SZIP) +if (szip_can_encode) { if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; if (h5repack_addfilter("SZIP=8,NN",&pack_options)<0) @@ -278,6 +289,9 @@ TESTING(" adding szip filter to all"); TEST_ERROR; PASSED(); +} else { + SKIPPED(); +} #else SKIPPED(); #endif @@ -425,9 +439,11 @@ TESTING(" addding shuffle filter to all"); TEST_ERROR; #endif -#if defined (H5_SZIP_CAN_ENCODE) && defined (H5_HAVE_FILTER_SZIP) +#if defined (H5_HAVE_FILTER_SZIP) +if (szip_can_encode) { if (h5repack_addfilter("dset1:SZIP=8,NN",&pack_options)<0) TEST_ERROR; +} #endif #ifdef H5_HAVE_FILTER_DEFLATE @@ -765,7 +781,8 @@ TESTING(" addding shuffle filter to all"); TESTING(" copy of szip filter"); -#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE) +#if defined (H5_HAVE_FILTER_SZIP) +if (szip_can_encode) { if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; if (h5repack(FNAME7,FNAME7OUT,&pack_options)<0) @@ -778,13 +795,17 @@ TESTING(" addding shuffle filter to all"); TEST_ERROR; PASSED(); +} else { + SKIPPED(); +} #else SKIPPED(); #endif TESTING(" removing szip filter"); -#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE) +#if defined (H5_HAVE_FILTER_SZIP) +if (szip_can_encode) { if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; if (h5repack_addfilter("dset_szip:NONE",&pack_options)<0) @@ -799,6 +820,9 @@ TESTING(" addding shuffle filter to all"); TEST_ERROR; PASSED(); +} else { + SKIPPED(); +} #else SKIPPED(); #endif @@ -941,10 +965,11 @@ TESTING(" addding shuffle filter to all"); TESTING(" filter conversion from deflate to szip"); -#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE) \ +#if defined (H5_HAVE_FILTER_SZIP) \ && defined (H5_HAVE_FILTER_DEFLATE) \ && defined (H5_HAVE_FILTER_FLETCHER32) && defined (H5_HAVE_FILTER_SHUFFLE) +if (szip_can_encode) { if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; if (h5repack_addfilter("dset_deflate:SZIP=8,NN",&pack_options)<0) @@ -959,16 +984,20 @@ TESTING(" addding shuffle filter to all"); TEST_ERROR; PASSED(); +} else { + SKIPPED(); +} #else SKIPPED(); #endif TESTING(" filter conversion from szip to deflate"); -#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE) \ +#if defined (H5_HAVE_FILTER_SZIP) \ && defined (H5_HAVE_FILTER_DEFLATE) \ && defined (H5_HAVE_FILTER_FLETCHER32) && defined (H5_HAVE_FILTER_SHUFFLE) +if (szip_can_encode) { if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; if (h5repack_addfilter("dset_szip:GZIP=1",&pack_options)<0) @@ -983,6 +1012,9 @@ TESTING(" addding shuffle filter to all"); TEST_ERROR; PASSED(); +} else { + SKIPPED(); +} #else SKIPPED(); #endif diff --git a/tools/h5repack/testh5repack_make.c b/tools/h5repack/testh5repack_make.c index 3cf7c11..65a1c4a 100644 --- a/tools/h5repack/testh5repack_make.c +++ b/tools/h5repack/testh5repack_make.c @@ -27,7 +27,9 @@ int make_attributes(hid_t loc_id); int make_hlinks(hid_t loc_id); int make_early(void); int make_layout(hid_t loc_id); +#ifdef H5_HAVE_FILTER_SZIP int make_szip(hid_t loc_id); +#endif /* H5_HAVE_FILTER_SZIP */ int make_deflate(hid_t loc_id); int make_shuffle(hid_t loc_id); int make_fletcher32(hid_t loc_id); @@ -113,12 +115,14 @@ int make_testfiles(void) * create a file with the SZIP filter *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_FILTER_SZIP if((loc_id = H5Fcreate(FNAME7,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) return -1; if (make_szip(loc_id)<0) goto out; if(H5Fclose(loc_id)<0) return -1; +#endif /* H5_HAVE_FILTER_SZIP */ /*------------------------------------------------------------------------- * create a file with the deflate filter @@ -362,6 +366,7 @@ int make_hlinks(hid_t loc_id) * *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_FILTER_SZIP int make_szip(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ @@ -372,6 +377,7 @@ int make_szip(hid_t loc_id) hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; int i, j, n; + int szip_can_encode = 0; for (i=n=0; i<DIM1; i++){ for (j=0; j<DIM2; j++){ @@ -393,13 +399,18 @@ int make_szip(hid_t loc_id) *------------------------------------------------------------------------- */ /* Make sure encoding is enabled */ -#if defined (H5_SZIP_CAN_ENCODE) && defined (H5_HAVE_FILTER_SZIP) +if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { + szip_can_encode = 1; +} +if (szip_can_encode) { /* set szip data */ if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block)<0) goto out; if (make_dset(loc_id,"dset_szip",sid,dcpl,buf)<0) goto out; -#endif +} else { + /* WARNING? SZIP is decoder only, can't generate test files */ +} if(H5Sclose(sid)<0) goto out; @@ -415,6 +426,7 @@ out: } H5E_END_TRY; return -1; } +#endif /* H5_HAVE_FILTER_SZIP */ @@ -623,12 +635,17 @@ int make_all(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ hid_t sid; /* dataspace ID */ +#if defined (H5_HAVE_FILTER_SZIP) unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK; unsigned szip_pixels_per_block=8; +#endif /* H5_HAVE_FILTER_SZIP */ hsize_t dims[RANK]={DIM1,DIM2}; hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; int i, j, n; +#if defined (H5_HAVE_FILTER_SZIP) + int szip_can_encode = 0; +#endif for (i=n=0; i<DIM1; i++){ for (j=0; j<DIM2; j++){ @@ -657,10 +674,17 @@ int make_all(hid_t loc_id) goto out; #endif -#if defined (H5_SZIP_CAN_ENCODE) && defined (H5_HAVE_FILTER_SZIP) +#if defined (H5_HAVE_FILTER_SZIP) +if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { + szip_can_encode = 1; +} +if (szip_can_encode) { /* set szip data */ if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block)<0) goto out; +} else { + /* WARNING? SZIP is decoder only, can't generate test data using szip */ +} #endif #if defined (H5_HAVE_FILTER_DEFLATE) @@ -692,7 +716,8 @@ int make_all(hid_t loc_id) *------------------------------------------------------------------------- */ /* Make sure encoding is enabled */ -#if defined (H5_SZIP_CAN_ENCODE) && defined (H5_HAVE_FILTER_SZIP) +#if defined (H5_HAVE_FILTER_SZIP) +if (szip_can_encode) { /* remove the filters from the dcpl */ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0) goto out; @@ -701,6 +726,9 @@ int make_all(hid_t loc_id) goto out; if (make_dset(loc_id,"dset_szip",sid,dcpl,buf)<0) goto out; +} else { + /* WARNING? SZIP is decoder only, can't generate test dataset */ +} #endif /*------------------------------------------------------------------------- |