diff options
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/Makefile.am | 2 | ||||
-rw-r--r-- | tools/h5dump/Makefile.in | 23 | ||||
-rw-r--r-- | tools/h5dump/h5dump.c | 35 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 193 | ||||
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 17 |
5 files changed, 156 insertions, 114 deletions
diff --git a/tools/h5dump/Makefile.am b/tools/h5dump/Makefile.am index 992586b..81e38d1 100644 --- a/tools/h5dump/Makefile.am +++ b/tools/h5dump/Makefile.am @@ -35,7 +35,7 @@ SCRIPT_DEPEND=h5dump$(EXEEXT) bin_PROGRAMS=h5dump # Add h5dump specific linker flags here -h5dump_LDFLAGS = $(LT_STATIC_EXEC) +h5dump_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) # All the programs depend on the hdf5 and h5tools libraries LDADD=$(LIBH5TOOLS) $(LIBHDF5) diff --git a/tools/h5dump/Makefile.in b/tools/h5dump/Makefile.in index be8cf96..8ca6684 100644 --- a/tools/h5dump/Makefile.in +++ b/tools/h5dump/Makefile.in @@ -108,6 +108,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@ AMTAR = @AMTAR@ + +# H5_CFLAGS holds flags that should be used when building hdf5, +# but which should not be exported to h5cc for building other programs. +# AM_CFLAGS is an automake construct which should be used by Makefiles +# instead of CFLAGS, as CFLAGS is reserved solely for the user to define. +AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ +AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ +AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ +AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ +AM_LDFLAGS = @AM_LDFLAGS@ AM_MAKEFLAGS = @AM_MAKEFLAGS@ AR = @AR@ @@ -121,21 +131,18 @@ BYTESEX = @BYTESEX@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CC_VERSION = @CC_VERSION@ - -# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5, -# but which shouldn't be exported to h5cc for building other programs. -CFLAGS = @CFLAGS@ @H5_CFLAGS@ +CFLAGS = @CFLAGS@ CLEARFILEBUF = @CLEARFILEBUF@ CODESTACK = @CODESTACK@ CONFIG_DATE = @CONFIG_DATE@ CONFIG_MODE = @CONFIG_MODE@ CONFIG_USER = @CONFIG_USER@ CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@ +CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_PKG = @DEBUG_PKG@ DEFAULT_API_VERSION = @DEFAULT_API_VERSION@ @@ -158,7 +165,7 @@ F9XMODEXT = @F9XMODEXT@ F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ -FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@ +FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCLIBS = @FCLIBS@ FGREP = @FGREP@ @@ -369,7 +376,7 @@ check_SCRIPTS = $(TEST_SCRIPT) SCRIPT_DEPEND = h5dump$(EXEEXT) # Add h5dump specific linker flags here -h5dump_LDFLAGS = $(LT_STATIC_EXEC) +h5dump_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) # All the programs depend on the hdf5 and h5tools libraries LDADD = $(LIBH5TOOLS) $(LIBHDF5) diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index c74c9f1..a437619 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -3067,22 +3067,22 @@ dump_fcpl(hid_t fid) hsize_t userblock; /* userblock size retrieved from FCPL */ size_t off_size; /* size of offsets in the file */ size_t len_size; /* size of lengths in the file */ - unsigned super; /* superblock version # */ - unsigned freelist; /* free list version # */ - unsigned stab; /* symbol table entry version # */ - unsigned shhdr; /* shared object header version # */ hid_t fdriver; /* file driver */ char dname[32]; /* buffer to store driver name */ unsigned sym_lk; /* symbol table B-tree leaf 'K' value */ unsigned sym_ik; /* symbol table B-tree internal 'K' value */ unsigned istore_ik; /* indexed storage B-tree internal 'K' value */ + H5F_file_space_type_t fs_strategy; /* file space strategy */ + hsize_t fs_threshold; /* free-space section threshold */ + H5F_info2_t finfo; /* file information */ fcpl=H5Fget_create_plist(fid); - H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr); + H5Fget_info2(fid, &finfo); H5Pget_userblock(fcpl,&userblock); H5Pget_sizes(fcpl,&off_size,&len_size); H5Pget_sym_k(fcpl,&sym_ik,&sym_lk); H5Pget_istore_k(fcpl,&istore_ik); + H5Pget_file_space(fcpl, &fs_strategy, &fs_threshold); H5Pclose(fcpl); fapl=h5_fileaccess(); fdriver=H5Pget_driver(fapl); @@ -3094,13 +3094,13 @@ dump_fcpl(hid_t fid) */ printf("%s %s\n",SUPER_BLOCK, BEGIN); indentation(indent + COL); - printf("%s %u\n","SUPERBLOCK_VERSION", super); + printf("%s %u\n","SUPERBLOCK_VERSION", finfo.super.version); indentation(indent + COL); - printf("%s %u\n","FREELIST_VERSION", freelist); + printf("%s %u\n","FREELIST_VERSION", finfo.free.version); indentation(indent + COL); - printf("%s %u\n","SYMBOLTABLE_VERSION", stab); + printf("%s %u\n","SYMBOLTABLE_VERSION", 0); /* Retain this for backward compatibility, for now (QAK) */ indentation(indent + COL); - printf("%s %u\n","OBJECTHEADER_VERSION", shhdr); + printf("%s %u\n","OBJECTHEADER_VERSION", finfo.sohm.version); indentation(indent + COL); HDfprintf(stdout,"%s %Hd\n","OFFSET_SIZE", (long long)off_size); indentation(indent + COL); @@ -3141,6 +3141,21 @@ dump_fcpl(hid_t fid) printf("%s %s\n","FILE_DRIVER", dname);*/ indentation(indent + COL); printf("%s %u\n","ISTORE_K", istore_ik); + + indentation(indent + COL); + if(fs_strategy == H5F_FILE_SPACE_ALL_PERSIST) + printf("%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_ALL_PERSIST"); + else if(fs_strategy == H5F_FILE_SPACE_ALL) + printf("%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_ALL"); + else if(fs_strategy == H5F_FILE_SPACE_AGGR_VFD) + printf("%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_AGGR_VFD"); + else if(fs_strategy == H5F_FILE_SPACE_VFD) + printf("%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_VFD"); + else + printf("%s %s\n", "FILE_SPACE_STRATEGY", "Unknown strategy"); + indentation(indent + COL); + HDfprintf(stdout, "%s %Hu\n","FREE_SPACE_THRESHOLD", fs_threshold); + printf("%s\n",END); /*------------------------------------------------------------------------- @@ -4063,8 +4078,6 @@ parse_start: } break; - break; - /** begin XML parameters **/ case 'x': /* select XML output */ diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index dcb491e..b42b675 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -93,7 +93,8 @@ #define FILE63 "textlinkfar.h5" #define FILE64 "tarray8.h5" #define FILE65 "tattrreg.h5" -#define FILE66 "tdset_idx.h5" +#define FILE66 "file_space.h5" +#define FILE67 "tdset_idx.h5" @@ -247,6 +248,10 @@ typedef struct s1_t { #define F64_ARRAY_BUF_LEN (4*1024) #define F64_DIM1 (F64_ARRAY_BUF_LEN / sizeof(int) + 1) +/* File 65 macros */ +#define STRATEGY H5F_FILE_SPACE_AGGR_VFD /* File space handling strategy */ +#define THRESHOLD10 10 /* Free space section threshold */ + /* Declarations for gent_dataset_idx() for "FILE66" */ #define DSET_FIXED "dset_fixed" #define DSET_FIXED_FILTER "dset_filter" @@ -390,85 +395,6 @@ gent_dataset2(void) H5Fclose(fid); } -/* - * Create a file with new format. - * Create one dataset with (set_chunk, fixed dimension) - * so that Fixed Array indexing will be used. - * Create one dataset with (set_chunk, fixed dimension, filter) - * so that Fixed Array indexing will be used. - * Create one dataset with (set_chunk, non-fixed dimension) - * so that B-tree indexing will be used. - */ -static void -gent_dataset_idx(void) -{ - hid_t fid, space, dcpl, fapl; - hsize_t dims[2]; - hsize_t maxdims[2]; - int buf[20][10]; - int i, j, ret; - - /* Get a copy of the file aaccess property */ - fapl = H5Pcreate(H5P_FILE_ACCESS); - - /* Set the "use the latest version of the format" bounds for creating objects in the file */ - ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); - assert(ret >= 0); - - fid = H5Fcreate(FILE66, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - dcpl = H5Pcreate(H5P_DATASET_CREATE); - - dims[0] = CHUNK; - dims[1] = CHUNK; - - /* set chunk */ - ret = H5Pset_chunk(dcpl, RANK, dims); - assert(ret >= 0); - - /* dataset with fixed dimensions */ - dims[0] = DIM20; - dims[1] = DIM10; - space = H5Screate_simple(RANK, dims, NULL); - - for(i = 0; i < DIM20; i++) - for(j = 0; j < DIM10; j++) - buf[i][j] = j; - - ret = make_dset(fid, DSET_FIXED, space, H5T_NATIVE_INT, dcpl, buf); - assert(ret >= 0); - H5Sclose(space); - - /* dataset with non-fixed dimensions */ - maxdims[0] = DIM200; - maxdims[1] = DIM100; - space = H5Screate_simple(RANK, dims, maxdims); - - ret = make_dset(fid, DSET_BTREE, space, H5T_NATIVE_INT, dcpl, buf); - assert(ret >= 0); - H5Sclose(space); - -#if defined (H5_HAVE_FILTER_DEFLATE) - - /* dataset with fixed dimensions and filters */ - /* remove the filters from the dcpl */ - ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL); - assert(ret >= 0); - - /* set deflate data */ - ret = H5Pset_deflate(dcpl, 9); - assert(ret >= 0); - - space = H5Screate_simple(RANK, dims, NULL); - ret = make_dset(fid, DSET_FIXED_FILTER, space, H5T_NATIVE_INT, dcpl, buf); - assert(ret >= 0); - - H5Sclose(space); -#endif - - H5Pclose(dcpl); - H5Fclose(fid); -} - static void gent_attribute(void) { @@ -3043,7 +2969,6 @@ static void gent_array8(void) hsize_t sdims[] = {F64_DIM0}; hsize_t tdims[] = {F64_DIM1}; int wdata[(F64_DIM1) * sizeof(int)]; /* Write buffer */ - int ndims; int i; /* @@ -6534,7 +6459,111 @@ gent_extlinks(void) H5Fclose(far_fid); } +/*------------------------------------------------------------------------- + * Function: gent_fs_strategy_threshold + * + * Purpose: Generate a file with non-default file space strategy and + * non-default free-space section threshold. + *------------------------------------------------------------------------- + */ +static void +gent_fs_strategy_threshold(void) +{ + hid_t fid; /* File id */ + hid_t fcpl; /* File creation property */ + + /* Create file-creation template */ + fcpl = H5Pcreate(H5P_FILE_CREATE); + + /* Set file space information */ + H5Pset_file_space(fcpl, STRATEGY, (hsize_t)THRESHOLD10); + + /* Create the file with the specified strategy and threshold */ + fid = H5Fcreate(FILE66, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); + + /* close */ + H5Fclose(fid); + H5Pclose(fcpl); +} + +/* + * Create a file with new format. + * Create one dataset with (set_chunk, fixed dimension) + * so that Fixed Array indexing will be used. + * Create one dataset with (set_chunk, fixed dimension, filter) + * so that Fixed Array indexing will be used. + * Create one dataset with (set_chunk, non-fixed dimension) + * so that B-tree indexing will be used. + */ +static void +gent_dataset_idx(void) +{ + hid_t fid, space, dcpl, fapl; + hsize_t dims[2]; + hsize_t maxdims[2]; + int buf[20][10]; + int i, j, ret; + + /* Get a copy of the file aaccess property */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + /* Set the "use the latest version of the format" bounds for creating objects in the file */ + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + assert(ret >= 0); + + fid = H5Fcreate(FILE67, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + dcpl = H5Pcreate(H5P_DATASET_CREATE); + + dims[0] = CHUNK; + dims[1] = CHUNK; + + /* set chunk */ + ret = H5Pset_chunk(dcpl, RANK, dims); + assert(ret >= 0); + + /* dataset with fixed dimensions */ + dims[0] = DIM20; + dims[1] = DIM10; + space = H5Screate_simple(RANK, dims, NULL); + + for(i = 0; i < DIM20; i++) + for(j = 0; j < DIM10; j++) + buf[i][j] = j; + + ret = make_dset(fid, DSET_FIXED, space, H5T_NATIVE_INT, dcpl, buf); + assert(ret >= 0); + H5Sclose(space); + + /* dataset with non-fixed dimensions */ + maxdims[0] = DIM200; + maxdims[1] = DIM100; + space = H5Screate_simple(RANK, dims, maxdims); + + ret = make_dset(fid, DSET_BTREE, space, H5T_NATIVE_INT, dcpl, buf); + assert(ret >= 0); + H5Sclose(space); + +#if defined (H5_HAVE_FILTER_DEFLATE) + + /* dataset with fixed dimensions and filters */ + /* remove the filters from the dcpl */ + ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL); + assert(ret >= 0); + + /* set deflate data */ + ret = H5Pset_deflate(dcpl, 9); + assert(ret >= 0); + + space = H5Screate_simple(RANK, dims, NULL); + ret = make_dset(fid, DSET_FIXED_FILTER, space, H5T_NATIVE_INT, dcpl, buf); + assert(ret >= 0); + + H5Sclose(space); +#endif + + H5Pclose(dcpl); + H5Fclose(fid); +} /*------------------------------------------------------------------------- * Function: main @@ -6607,7 +6636,7 @@ int main(void) gent_attr_creation_order(); gent_fpformat(); gent_extlinks(); - + gent_fs_strategy_threshold(); gent_dataset_idx(); return 0; diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 6d2f273..84274cf 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -161,12 +161,8 @@ DIFFTEST() { PRINT_H5DIFF $@ ( - cd $srcdir/../testfiles - if [ "`uname -s`" = "TFLOPS O/S" ]; then - $RUNSERIAL $H5DIFF_BIN $@ -q - else - $RUNSERIAL $H5DIFF_BIN "$@" -q - fi + cd $srcdir/../testfiles + $RUNSERIAL $H5DIFF_BIN "$@" -q ) RET=$? if [ $RET != 0 ] ; then @@ -198,12 +194,8 @@ IMPORTTEST() PRINT_H5IMPORT $@ ( - cd $srcdir/../testfiles - if [ "`uname -s`" = "TFLOPS O/S" ]; then - $RUNSERIAL $H5IMPORT_BIN $@ - else - $RUNSERIAL $H5IMPORT_BIN "$@" - fi + cd $srcdir/../testfiles + $RUNSERIAL $H5IMPORT_BIN "$@" ) RET=$? if [ $RET != 0 ] ; then @@ -340,6 +332,7 @@ TOOLTEST tnofilename.ddl # tests for super block TOOLTEST tboot1.ddl -H -B -d dset tfcontents1.h5 TOOLTEST tboot2.ddl -B tfcontents2.h5 +TOOLTEST file_space.ddl -B file_space.h5 # test -p with a non existing dataset TOOLTEST tperror.ddl -p -d bogus tfcontents1.h5 |