diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-09-17 12:45:55 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-09-17 12:45:55 (GMT) |
commit | 6747ebd9858374ae912b6182024861b1710518c8 (patch) | |
tree | 9bd75142d9dd292fe4272118f650f1c91205a988 /tools/h5repack | |
parent | 9de3a84f916168831f29a4259fe93cb4823d8f57 (diff) | |
download | hdf5-6747ebd9858374ae912b6182024861b1710518c8.zip hdf5-6747ebd9858374ae912b6182024861b1710518c8.tar.gz hdf5-6747ebd9858374ae912b6182024861b1710518c8.tar.bz2 |
[svn-r19413] Description:
Bring r19349:19411 from trunk to revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.4 (amazon) in debug mode
Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
Diffstat (limited to 'tools/h5repack')
-rw-r--r-- | tools/h5repack/CMakeLists.txt | 110 | ||||
-rw-r--r-- | tools/h5repack/Makefile.in | 2 | ||||
-rwxr-xr-x | tools/h5repack/h5repack.sh.in | 182 | ||||
-rw-r--r-- | tools/h5repack/h5repack_copy.c | 15 | ||||
-rw-r--r-- | tools/h5repack/h5repacktst.c | 89 | ||||
-rw-r--r-- | tools/h5repack/testfiles/h5repack_layout2.h5 | bin | 0 -> 6808 bytes |
6 files changed, 339 insertions, 59 deletions
diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt index d767de1..be2844d 100644 --- a/tools/h5repack/CMakeLists.txt +++ b/tools/h5repack/CMakeLists.txt @@ -22,16 +22,7 @@ SET (REPACK_COMMON_SRCS ADD_EXECUTABLE (h5repack ${REPACK_COMMON_SRCS} ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_main.c) H5_NAMING (h5repack) -IF (WIN32) - IF (MSVC) - IF (NOT BUILD_SHARED_LIBS) - SET_TARGET_PROPERTIES (h5repack - PROPERTIES - LINK_FLAGS "/NODEFAULTLIB:MSVCRT" - ) - ENDIF (NOT BUILD_SHARED_LIBS) - ENDIF (MSVC) -ENDIF (WIN32) +TARGET_WIN_PROPERTIES (h5repack) TARGET_LINK_LIBRARIES (h5repack ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) SET (H5_DEP_EXECUTABLES h5repack) @@ -48,16 +39,7 @@ IF (BUILD_TESTING) # -------------------------------------------------------------------- ADD_EXECUTABLE (testh5repack_detect_szip ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testh5repack_detect_szip.c) H5_NAMING (testh5repack_detect_szip) - IF (WIN32) - IF (MSVC) - IF (NOT BUILD_SHARED_LIBS) - SET_TARGET_PROPERTIES (testh5repack_detect_szip - PROPERTIES - LINK_FLAGS "/NODEFAULTLIB:MSVCRT" - ) - ENDIF (NOT BUILD_SHARED_LIBS) - ENDIF (MSVC) - ENDIF (WIN32) + TARGET_WIN_PROPERTIES (testh5repack_detect_szip) TARGET_LINK_LIBRARIES (testh5repack_detect_szip ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME testh5repack_detect_szip COMMAND $<TARGET_FILE:testh5repack_detect_szip>) @@ -76,16 +58,7 @@ IF (BUILD_TESTING) ADD_EXECUTABLE (h5repacktest ${REPACK_COMMON_SRCS} ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repacktst.c) H5_NAMING (h5repacktest) - IF (WIN32) - IF (MSVC) - IF (NOT BUILD_SHARED_LIBS) - SET_TARGET_PROPERTIES (h5repacktest - PROPERTIES - LINK_FLAGS "/NODEFAULTLIB:MSVCRT" - ) - ENDIF (NOT BUILD_SHARED_LIBS) - ENDIF (MSVC) - ENDIF (WIN32) + TARGET_WIN_PROPERTIES (h5repacktest) TARGET_LINK_LIBRARIES (h5repacktest ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME h5repacktest COMMAND $<TARGET_FILE:h5repacktest>) @@ -108,6 +81,7 @@ IF (BUILD_TESTING) h5repack_hlink.h5 h5repack_layout.h5 h5repack_layouto.h5 + h5repack_layout2.h5 h5repack_named_dtypes.h5 h5repack_nbit.h5 h5repack_objs.h5 @@ -175,7 +149,7 @@ IF (BUILD_TESTING) COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out.${testfile} ) ENDIF (${testtype} STREQUAL "SKIP") - ENDMACRO (ADD_H5_TEST testname testfile testtype) + ENDMACRO (ADD_H5_TEST) MACRO (ADD_H5_CMP_TEST testname testfilter testtype resultcode resultfile) IF (${testtype} STREQUAL "SKIP") @@ -197,7 +171,53 @@ IF (BUILD_TESTING) -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) ENDIF (${testtype} STREQUAL "SKIP") - ENDMACRO (ADD_H5_CMP_TEST file) + ENDMACRO (ADD_H5_CMP_TEST) + + MACRO (ADD_H5_VERIFY_TEST testname testtype resultcode testfile testdset testfilter) + IF (${testtype} STREQUAL "SKIP") + ADD_TEST ( + NAME H5REPACK_VERIFY_LAYOUT-${testname} + COMMAND ${CMAKE_COMMAND} -E echo "SKIP -d ${testdset} -pH ${PROJECT_BINARY_DIR}/testfiles/out.${resultfile}" + ) + ELSE (${testtype} STREQUAL "SKIP") + IF (${resultcode} STREQUAL "0") + ADD_TEST ( + NAME H5REPACK_VERIFY_LAYOUT-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>" + -D "TEST_ARGS:STRING=-d;${testdset};-pH;testfiles/out.${testfile}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_OUTPUT=${testfile}-v.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_FILTER:STRING=${testfilter}" + -D "TEST_REFERENCE=${testfilter}" + -P "${HDF5_RESOURCES_DIR}/grepTest.cmake" + ) + ELSE (${resultcode} STREQUAL "0") + IF (${testfilter} STREQUAL "CHUNKED") + SET (nottestfilter "(CONTIGUOUS|COMPACT)") + ENDIF (${testfilter} STREQUAL "CHUNKED") + IF (${testfilter} STREQUAL "CONTIGUOUS") + SET (nottestfilter "(CHUNK|COMPACT)") + ENDIF (${testfilter} STREQUAL "CONTIGUOUS") + IF (${testfilter} STREQUAL "COMPACT") + SET (nottestfilter "(CONTIGUOUS|CHUNK)") + ENDIF (${testfilter} STREQUAL "COMPACT") + ADD_TEST ( + NAME H5REPACK_VERIFY_LAYOUT_ALL-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>" + -D "TEST_ARGS:STRING=-pH;testfiles/out.${testfile}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_OUTPUT=${testfile}-v.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_FILTER:STRING=${nottestfilter}" + -D "TEST_REFERENCE=${testfilter}" + -P "${HDF5_RESOURCES_DIR}/grepTest.cmake" + ) + ENDIF (${resultcode} STREQUAL "0") + ENDIF (${testtype} STREQUAL "SKIP") + ENDMACRO (ADD_H5_VERIFY_TEST) ############################################################################## ############################################################################## @@ -226,6 +246,7 @@ IF (BUILD_TESTING) SET (FILE14 h5repack_layouto.h5 ) # A file with an older version of the layout message (copy of test/tlayouto.h5) SET (FILE15 h5repack_named_dtypes.h5) SET (FILE16 tfamily%05d.h5) # located in common testfiles folder + SET (FILE18 h5repack_layout2.h5) SET (FILE_REF h5repack_refs.h5) SET (FILE_ATTR_REF h5repack_attr_refs.h5) @@ -523,26 +544,47 @@ ADD_H5_TEST (deflate_file ${TESTTYPE} ${arg}) ######################################################### ADD_H5_TEST (dset2_chunk_20x10 "TEST" ${FILE4} --layout=dset2:CHUNK=20x10) +ADD_H5_VERIFY_TEST (dset2_chunk_20x10 "TEST" 0 ${FILE4} dset2 CHUNKED) ADD_H5_TEST (chunk_20x10 "TEST" ${FILE4} -l CHUNK=20x10) +ADD_H5_VERIFY_TEST (chunk_20x10 "TEST" 1 ${FILE4} null CHUNKED) ADD_H5_TEST (dset2_conti "TEST" ${FILE4} -l dset2:CONTI) +ADD_H5_VERIFY_TEST (dset2_conti "TEST" 0 ${FILE4} dset2 CONTIGUOUS) ADD_H5_TEST (conti "TEST" ${FILE4} -l CONTI) +ADD_H5_VERIFY_TEST (conti "TEST" 1 ${FILE4} null CONTIGUOUS) ADD_H5_TEST (dset2_compa "TEST" ${FILE4} -l dset2:COMPA) +ADD_H5_VERIFY_TEST (dset2_compa "TEST" 0 ${FILE4} dset2 COMPACT) ADD_H5_TEST (compa "TEST" ${FILE4} -l COMPA) - +ADD_H5_VERIFY_TEST (compa "TEST" 1 ${FILE4} null COMPACT) ################################################################ # layout conversions (file has no filters) ############################################################### ADD_H5_TEST (dset_compa_conti "TEST" ${FILE4} -l dset_compact:CONTI) +ADD_H5_VERIFY_TEST (dset_compa_conti "TEST" 0 ${FILE4} dset_compact CONTIGUOUS) ADD_H5_TEST (dset_compa_chunk "TEST" ${FILE4} -l dset_compact:CHUNK=2x5) +ADD_H5_VERIFY_TEST (dset_compa_chunk "TEST" 0 ${FILE4} dset_compact CHUNKED) ADD_H5_TEST (dset_compa_compa "TEST" ${FILE4} -l dset_compact:COMPA) +ADD_H5_VERIFY_TEST (dset_compa_compa "TEST" 0 ${FILE4} dset_compact COMPACT) ADD_H5_TEST (dset_conti_compa "TEST" ${FILE4} -l dset_contiguous:COMPA) +ADD_H5_VERIFY_TEST (dset_conti_compa "TEST" 0 ${FILE4} dset_contiguous COMPACT) ADD_H5_TEST (dset_conti_chunk "TEST" ${FILE4} -l dset_contiguous:CHUNK=3x6) +ADD_H5_VERIFY_TEST (dset_conti_chunk "TEST" 0 ${FILE4} dset_contiguous CHUNKED) ADD_H5_TEST (dset_conti_conti "TEST" ${FILE4} -l dset_contiguous:CONTI) +ADD_H5_VERIFY_TEST (dset_conti_conti "TEST" 0 ${FILE4} dset_contiguous CONTIGUOUS) ADD_H5_TEST (chunk_compa "TEST" ${FILE4} -l dset_chunk:COMPA) +ADD_H5_VERIFY_TEST (chunk_compa "TEST" 0 ${FILE4} dset_chunk COMPACT) ADD_H5_TEST (chunk_conti "TEST" ${FILE4} -l dset_chunk:CONTI) +ADD_H5_VERIFY_TEST (chunk_conti "TEST" 0 ${FILE4} dset_chunk CONTIGUOUS) ADD_H5_TEST (chunk_18x13 "TEST" ${FILE4} -l dset_chunk:CHUNK=18x13) +ADD_H5_VERIFY_TEST (chunk_18x13 "TEST" 0 ${FILE4} dset_chunk CHUNKED) + +# test convert small size dataset ( < 1k) to compact layout without -m +ADD_H5_TEST (contig_small_compa "TEST" ${FILE18} -l contig_small:COMPA) +ADD_H5_VERIFY_TEST (contig_small_compa "TEST" 0 ${FILE18} contig_small COMPACT) + +ADD_H5_TEST (contig_small_fixed_compa "TEST" ${FILE18} -l chunked_small_fixed:COMPA) +ADD_H5_VERIFY_TEST (contig_small_fixed_compa "TEST" 0 ${FILE18} chunked_small_fixed COMPACT) # Native option # Do not use FILE1, as the named dtype will be converted to native, and h5diff will @@ -558,6 +600,7 @@ IF (NOT USE_FILTER_DEFLATE) SET (TESTTYPE "SKIP") ENDIF (NOT USE_FILTER_DEFLATE) ADD_H5_TEST (layout_long_switches ${TESTTYPE} ${arg}) +ADD_H5_VERIFY_TEST (layout_long_switches ${TESTTYPE} 1 ${FILE4} null CHUNKED) # latest file format with short switches. use FILE4=h5repack_layout.h5 (no filters) SET (arg ${FILE4} -l CHUNK=20x10 -f GZIP=1 -m 10 -n -L -c 8 -d 6 -s 8[:dtype]) @@ -566,6 +609,7 @@ IF (NOT USE_FILTER_DEFLATE) SET (TESTTYPE "SKIP") ENDIF (NOT USE_FILTER_DEFLATE) ADD_H5_TEST (layout_short_switches ${TESTTYPE} ${arg}) +ADD_H5_VERIFY_TEST (layout_short_switches ${TESTTYPE} 1 ${FILE4} null CHUNKED) # several global filters SET (arg ${FILE4} --filter GZIP=1 --filter SHUF) diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in index 9fef88b..23f5844 100644 --- a/tools/h5repack/Makefile.in +++ b/tools/h5repack/Makefile.in @@ -315,7 +315,6 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -364,6 +363,7 @@ H5CC_PP = $(bindir)/h5pcc H5FC = $(bindir)/h5fc H5FC_PP = $(bindir)/h5pfc H5CPP = $(bindir)/h5c++ +ACLOCAL_AMFLAGS = "-I m4" # The trace script; this is used on source files from the C library to # insert tracing macros. diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in index d889b55..5a60227 100755 --- a/tools/h5repack/h5repack.sh.in +++ b/tools/h5repack/h5repack.sh.in @@ -35,7 +35,12 @@ H5REPACK=h5repack # The tool name 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 +H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary + +H5DUMP=../h5dump/h5dump # The h5dump tool name +H5DUMP_BIN=`pwd`/$H5DUMP # The path of the h5dump tool binary + +GREP='grep' H5DETECTSZIP=testh5repack_detect_szip H5DETECTSZIP_BIN=`pwd`/$H5DETECTSZIP @@ -59,6 +64,7 @@ FILE14=h5repack_layouto.h5 # A file with an older version of the layout mes # (copy of test/tlayouto.h5) FILE15=h5repack_named_dtypes.h5 FILE16=tfamily%05d.h5 # located in common testfiles folder +FILE18=h5repack_layout2.h5 FILE_REF=h5repack_refs.h5 FILE_ATTR_REF=h5repack_attr_refs.h5 @@ -115,8 +121,21 @@ DIFFTEST() # Call h5repack # + + +# call TOOLTEST_MAIN and delete $output file TOOLTEST() { + echo $@ + TOOLTEST_MAIN $@ + path=`pwd` + outfile=$path/out.$1 + rm -f $outfile +} + +# TOOLTEST main function, doesn't delete $output file +TOOLTEST_MAIN() +{ # Run test. TESTING $H5REPACK $@ @@ -133,7 +152,98 @@ TOOLTEST() echo " PASSED" DIFFTEST $infile $outfile fi +} + +#------------------------------------------ +# Verifying layouts of a dataset +VERIFY_LAYOUT_DSET() +{ + path=`pwd` + outfile=$path/out.$1 + layoutfile=$path/layout.$1 + dset=$2 + expectlayout=$3 + + #--------------------------------- + # check the layout from a dataset + VERIFY "Layout" + $H5DUMP_BIN -d $dset -pH $outfile > $layoutfile + $GREP $expectlayout $layoutfile > /dev/null + if [ $? -eq 0 ]; then + echo " PASSED" + else + echo " FAILED" + fi + + # clean up tmp files rm -f $outfile + rm -f $layoutfile +} + +#---------------------------------------- +# Verifying layouts from entire file +VERIFY_LAYOUT_ALL() +{ + path=`pwd` + outfile=$path/out.$1 + layoutfile=$path/layout.$1 + expectlayout=$2 + + #--------------------------------- + # check the layout from a dataset + # check if the other layouts still exsit + VERIFY "Layout " + # if CONTIGUOUS + if [ $expectlayout = "CONTIGUOUS" ]; then + $H5DUMP_BIN -pH $outfile > $layoutfile + $GREP "COMPACT" $layoutfile > /dev/null + if [ $? -eq 0 ]; then + echo " FAILED" + else + $GREP "CHUNKED" $layoutfile > /dev/null + if [ $? -eq 0 ]; then + echo " FAILED" + else + echo " PASSED" + fi + fi + else + # if COMPACT + if [ $expectlayout = "COMPACT" ]; then + $H5DUMP_BIN -pH $outfile > $layoutfile + $GREP "CHUNKED" $layoutfile > /dev/null + if [ $? -eq 0 ]; then + echo " FAILED" + else + $GREP "CONTIGUOUS" $layoutfile > /dev/null + if [ $? -eq 0 ]; then + echo " FAILED" + else + echo " PASSED" + fi + fi + else + # if CHUNKED + if [ $expectlayout = "CHUNKED" ]; then + $H5DUMP_BIN -pH $outfile > $layoutfile + $GREP "CONTIGUOUS" $layoutfile > /dev/null + if [ $? -eq 0 ]; then + echo " FAILED" + else + $GREP "COMPACT" $layoutfile > /dev/null + if [ $? -eq 0 ]; then + echo " FAILED" + else + echo " PASSED" + fi + fi + fi + fi + fi + + # clean up tmp files + rm -f $outfile + rm -f $layoutfile } # same as TOOLTEST, but it uses the old syntax -i input_file -o output_file @@ -494,32 +604,64 @@ else TOOLTEST $arg fi - ######################################################### # layout options (these files have no filters) ######################################################### +TOOLTEST_MAIN $FILE4 --layout dset2:CHUNK=20x10 +VERIFY_LAYOUT_DSET $FILE4 dset2 CHUNKED -TOOLTEST $FILE4 --layout=dset2:CHUNK=20x10 -TOOLTEST $FILE4 -l CHUNK=20x10 -TOOLTEST $FILE4 -l dset2:CONTI -TOOLTEST $FILE4 -l CONTI -TOOLTEST $FILE4 -l dset2:COMPA -TOOLTEST $FILE4 -l COMPA +TOOLTEST_MAIN $FILE4 -l CHUNK=20x10 +VERIFY_LAYOUT_ALL $FILE4 CHUNKED +TOOLTEST_MAIN $FILE4 -l dset2:CONTI +VERIFY_LAYOUT_DSET $FILE4 dset2 CONTIGUOUS + +TOOLTEST_MAIN $FILE4 -l CONTI +VERIFY_LAYOUT_ALL $FILE4 CONTIGUOUS + +TOOLTEST_MAIN $FILE4 -l dset2:COMPA +VERIFY_LAYOUT_DSET $FILE4 dset2 COMPACT + +TOOLTEST_MAIN $FILE4 -l COMPA +VERIFY_LAYOUT_ALL $FILE4 COMPACT ################################################################ # layout conversions (file has no filters) ############################################################### -TOOLTEST $FILE4 -l dset_compact:CONTI -TOOLTEST $FILE4 -l dset_compact:CHUNK=2x5 -TOOLTEST $FILE4 -l dset_compact:COMPA -TOOLTEST $FILE4 -l dset_contiguous:COMPA -TOOLTEST $FILE4 -l dset_contiguous:CHUNK=3x6 -TOOLTEST $FILE4 -l dset_contiguous:CONTI -TOOLTEST $FILE4 -l dset_chunk:COMPA -TOOLTEST $FILE4 -l dset_chunk:CONTI -TOOLTEST $FILE4 -l dset_chunk:CHUNK=18x13 +TOOLTEST_MAIN $FILE4 -l dset_compact:CONTI +VERIFY_LAYOUT_DSET $FILE4 dset_compact CONTIGUOUS + +TOOLTEST_MAIN $FILE4 -l dset_compact:CHUNK=2x5 +VERIFY_LAYOUT_DSET $FILE4 dset_compact CHUNKED + +TOOLTEST_MAIN $FILE4 -l dset_compact:COMPA +VERIFY_LAYOUT_DSET $FILE4 dset_compact COMPACT + +TOOLTEST_MAIN $FILE4 -l dset_contiguous:COMPA +VERIFY_LAYOUT_DSET $FILE4 dset_contiguous COMPACT + +TOOLTEST_MAIN $FILE4 -l dset_contiguous:CHUNK=3x6 +VERIFY_LAYOUT_DSET $FILE4 dset_contiguous CHUNKED + +TOOLTEST_MAIN $FILE4 -l dset_contiguous:CONTI +VERIFY_LAYOUT_DSET $FILE4 dset_contiguous CONTIGUOUS + +TOOLTEST_MAIN $FILE4 -l dset_chunk:COMPA +VERIFY_LAYOUT_DSET $FILE4 dset_chunk COMPACT + +TOOLTEST_MAIN $FILE4 -l dset_chunk:CONTI +VERIFY_LAYOUT_DSET $FILE4 dset_chunk CONTIGUOUS + +TOOLTEST_MAIN $FILE4 -l dset_chunk:CHUNK=18x13 +VERIFY_LAYOUT_DSET $FILE4 dset_chunk CHUNKED + +# test convert small size dataset ( < 1k) to compact layout without -m +TOOLTEST_MAIN $FILE18 -l contig_small:COMPA +VERIFY_LAYOUT_DSET $FILE18 contig_small COMPACT + +TOOLTEST_MAIN $FILE18 -l chunked_small_fixed:COMPA +VERIFY_LAYOUT_DSET $FILE18 chunked_small_fixed COMPACT # Native option # Do not use FILE1, as the named dtype will be converted to native, and h5diff will @@ -533,7 +675,8 @@ arg="$FILE4 --layout CHUNK=20x10 --filter GZIP=1 --minimum=10 --native --latest if test $USE_FILTER_DEFLATE != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST_MAIN $arg + VERIFY_LAYOUT_ALL $FILE4 CHUNKED fi # latest file format with short switches. use FILE4=h5repack_layout.h5 (no filters) @@ -541,7 +684,8 @@ arg="$FILE4 -l CHUNK=20x10 -f GZIP=1 -m 10 -n -L -c 8 -d 6 -s 8[:dtype]" if test $USE_FILTER_DEFLATE != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST_MAIN $arg + VERIFY_LAYOUT_ALL $FILE4 CHUNKED fi # several global filters diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index b736c22..6c47cfb 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -687,14 +687,11 @@ int do_copy_objects(hid_t fidin, /* check if filters were requested for individual objects */ for (u = 0; u < options->op_tbl->nelems; u++) { - int k; if (strcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) { - for (k = 0; k < options->op_tbl->objs[u].nfilters; k++) { if (options->op_tbl->objs[u].filter->filtn > 0) { req_filter = 1; } - } } } @@ -789,9 +786,15 @@ int do_copy_objects(hid_t fidin, /* get the storage size of the input dataset */ dsize_in=H5Dget_storage_size(dset_in); - /* check for datasets too small */ - if (nelmts*msize < options->min_comp ) - apply_s=0; + /* check for small size datasets (less than 1k) except + * changing to COMPACT. For the reference, COMPACT is limited + * by size 64K by library. + */ + if (options->layout_g != H5D_COMPACT) + { + if ( nelmts*msize < options->min_comp ) + apply_s=0; + } /* apply the filter */ if (apply_s) diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index e329082..0567615 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -76,6 +76,9 @@ #define FNAME17 "h5repack_named_dtypes.h5" #define FNAME17OUT "h5repack_named_dtypes_out.h5" +#define FNAME18 "h5repack_layout2.h5" +#define FNAME18OUT "h5repack_layout2_out.h5" + #define FNAME_UB "ublock.bin" /* obj and region references */ @@ -120,6 +123,7 @@ static int make_attributes(hid_t loc_id); static int make_hlinks(hid_t loc_id); static int make_early(void); static int make_layout(hid_t loc_id); +static int make_layout2(hid_t loc_id); #ifdef H5_HAVE_FILTER_SZIP static int make_szip(hid_t loc_id); #endif /* H5_HAVE_FILTER_SZIP */ @@ -1692,6 +1696,19 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- + * create a file for layout conversion test + *------------------------------------------------------------------------- + */ + if((fid = H5Fcreate(FNAME18, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + return -1; + + if(make_layout2(fid) < 0) + goto out; + + if(H5Fclose(fid) < 0) + return -1; + + /*------------------------------------------------------------------------- * create a file for the H5D_ALLOC_TIME_EARLY test *------------------------------------------------------------------------- */ @@ -2983,6 +3000,78 @@ out: } /*------------------------------------------------------------------------- + * Function: make_layout2 + * + * Purpose: create datasets with contiguous and chunked layouts: + * + * contig_small: < 1k, fixed dims datspace + * chunked_small_fixed: < 1k, fixed dims dataspace + * + *------------------------------------------------------------------------- + */ +#define S_DIM1 4 +#define S_DIM2 10 +#define CONTIG_S "contig_small" +#define CHUNKED_S_FIX "chunked_small_fixed" + +static +int make_layout2(hid_t loc_id) +{ + + hid_t contig_dcpl = -1; /* dataset creation property list */ + hid_t chunked_dcpl = -1; /* dataset creation property list */ + + int i, j, n; /* Local index variables */ + int ret_value = -1; /* Return value */ + hid_t s_sid = -1; /* dataspace ID */ + + hsize_t s_dims[RANK] = {S_DIM1,S_DIM2}; /* Dataspace (< 1 k) */ + hsize_t chunk_dims[RANK] = {S_DIM1/2, S_DIM2/2}; /* Dimension sizes for chunks */ + + int s_buf[S_DIM1][S_DIM2]; /* Temporary buffer */ + + for(i = n = 0; i < S_DIM1; i++) { + for (j = 0; j < S_DIM2; j++) { + s_buf[i][j] = n++; + } + } + + /* Create dataspaces */ + if((s_sid = H5Screate_simple(RANK, s_dims, NULL)) < 0) + goto out; + + /* Create contiguous datasets */ + if((contig_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto out; + if(H5Pset_layout(contig_dcpl, H5D_CONTIGUOUS) < 0) + goto out; + if(make_dset(loc_id, CONTIG_S, s_sid, contig_dcpl, s_buf) < 0) + goto out; + + /* Create chunked datasets */ + if((chunked_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto out; + if(H5Pset_chunk(chunked_dcpl, RANK, chunk_dims) < 0) + goto out; + if(make_dset(loc_id, CHUNKED_S_FIX, s_sid, chunked_dcpl, s_buf) < 0) + goto out; + + ret_value = 0; + +out: + H5E_BEGIN_TRY { + H5Pclose(contig_dcpl); + H5Pclose(chunked_dcpl); + + H5Sclose(s_sid); + + } H5E_END_TRY; + + return(ret_value); + +} /* make_layout2() */ + +/*------------------------------------------------------------------------- * Function: make a file with an integer dataset with a fill value * * Purpose: test copy of fill values diff --git a/tools/h5repack/testfiles/h5repack_layout2.h5 b/tools/h5repack/testfiles/h5repack_layout2.h5 Binary files differnew file mode 100644 index 0000000..6e77e41 --- /dev/null +++ b/tools/h5repack/testfiles/h5repack_layout2.h5 |