diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-11-16 20:45:05 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-11-16 20:45:05 (GMT) |
commit | d2b87ec47ebdb096c331c7b62a195b9cea2f33ae (patch) | |
tree | a066f01361afaf5df457cef612bb0bb9fd80fe18 /tools/h5dump | |
parent | ee5a1e07350f0dcf3ef07d9443aa2f4c073392f4 (diff) | |
download | hdf5-d2b87ec47ebdb096c331c7b62a195b9cea2f33ae.zip hdf5-d2b87ec47ebdb096c331c7b62a195b9cea2f33ae.tar.gz hdf5-d2b87ec47ebdb096c331c7b62a195b9cea2f33ae.tar.bz2 |
[svn-r17896] Description:
Bring r17546:17895 from trunk to revise_chunks branch. Changes to
fixed and extensible array dataset chunk indexing code to accommodate changes
to private APIs in those interfaces. Also, other adjustments to source code
and expected output in response to changes on the trunk.
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 (smirom) 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, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.6.2 (amazon) in debug mode
Mac OS X/32 10.6.2 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
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 |