diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2018-02-14 01:15:40 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2018-02-14 01:15:40 (GMT) |
commit | 66ea3b8fb9fdff0a0ffa6ffd318ad5fc2c9a8f4b (patch) | |
tree | 380fd687260c0d0aff9c3dc04be70afa63b9e296 /tools/src | |
parent | 20332fac0ead66b7fc90858b209b33fbd6a75d57 (diff) | |
parent | b4294d8d3e5937527e9814f23d04df412ebbe770 (diff) | |
download | hdf5-66ea3b8fb9fdff0a0ffa6ffd318ad5fc2c9a8f4b.zip hdf5-66ea3b8fb9fdff0a0ffa6ffd318ad5fc2c9a8f4b.tar.gz hdf5-66ea3b8fb9fdff0a0ffa6ffd318ad5fc2c9a8f4b.tar.bz2 |
Merge pull request #876 in HDFFV/hdf5 from ~VCHOI/my_hdf5_fork:bugfix/version_bounds to develop
* commit 'b4294d8d3e5937527e9814f23d04df412ebbe770':
Added comment for clarification about latest as 1.10. Platforms tested: Linux/64 (jelly) Linux/32 (jam)
Fixed typos Platforms tested: Linux/32 (jam)
Additional tests Description: - Revised and add more variety to version bound tests per review - Revised gen_bounds.c per review Platforms tested: Linux/64 (jelly) Linux/32 (jam) Darwin (osx1010test)
Added gen_bounds
Cleaned up per comments in PR# 876
Modifications made based on comments from pull request.
Added gen_bounds.c
Added gen_bounds.c
Fix bounds check for the generation of cache image.
Modify usage description for -j and -k options so that it is more informative.
Modify h5repack usage so that it is more descriptive.
Changes made based on code reviews.
Further improvement
Fixed comment.
Adding data file generator Description: Added gen_bounds.c to generate the following files: - bounds_earliest_latest.h5 - bounds_earliest_v18.h5 - bounds_latest_latest.h5 - bounds_v18_latest.h5 - bounds_v18_v18.h5 for testing the version bounds fix in 1.8 and 1.6.
Initial checkin for library version bounds Code changes to provide versioning support when adding to the enumerated defines for H5F_libver_t.
Diffstat (limited to 'tools/src')
-rw-r--r-- | tools/src/h5repack/h5repack.c | 2 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack.h | 30 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_copy.c | 20 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_main.c | 41 |
4 files changed, 67 insertions, 26 deletions
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index c98575c..e7f4aae 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -75,6 +75,8 @@ h5repack_init(pack_opt_t *options, int verbose, hbool_t latest) options->verbose = verbose; options->latest = latest; options->layout_g = H5D_LAYOUT_ERROR; + options->low_bound = H5F_LIBVER_EARLIEST; + options->high_bound = H5F_LIBVER_LATEST; for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) { options->filter_g[n].filtn = -1; diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h index 0252768..a0e0387 100644 --- a/tools/src/h5repack/h5repack.h +++ b/tools/src/h5repack/h5repack.h @@ -101,21 +101,23 @@ typedef struct { /* all the above, ready to go to the hrepack call */ typedef struct { - pack_opttbl_t *op_tbl; /*table with all -c and -f options */ - int all_layout; /*apply the layout to all objects */ - int all_filter; /*apply the filter to all objects */ + pack_opttbl_t *op_tbl; /*table with all -c and -f options */ + int all_layout; /*apply the layout to all objects */ + int all_filter; /*apply the filter to all objects */ filter_info_t filter_g[H5_REPACK_MAX_NFILTERS]; /*global filter array for the ALL case */ - int n_filter_g; /*number of global filters */ - chunk_info_t chunk_g; /*global chunk INFO for the ALL case */ - H5D_layout_t layout_g; /*global layout information for the ALL case */ - int verbose; /*verbose mode */ - hsize_t min_comp; /*minimum size to compress, in bytes */ - int use_native; /*use a native type in write */ - hbool_t latest; /*pack file with the latest file format */ - int grp_compact; /* Set the maximum number of links to store as header messages in the group */ - int grp_indexed; /* Set the minimum number of links to store in the indexed format */ - int msg_size[8]; /* Minimum size of shared messages: dataspace, - datatype, fill value, filter pipleline, attribute */ + int n_filter_g; /*number of global filters */ + chunk_info_t chunk_g; /*global chunk INFO for the ALL case */ + H5D_layout_t layout_g; /*global layout information for the ALL case */ + int verbose; /*verbose mode */ + hsize_t min_comp; /*minimum size to compress, in bytes */ + int use_native; /*use a native type in write */ + hbool_t latest; /*pack file with the latest file format */ + H5F_libver_t low_bound; /* The file's low bound as in H5Fset_libver_bounds() */ + H5F_libver_t high_bound; /* The file's high bound as in H5Fset_libver_bounds() */ + int grp_compact; /* Set the maximum number of links to store as header messages in the group */ + int grp_indexed; /* Set the minimum number of links to store in the indexed format */ + int msg_size[8]; /* Minimum size of shared messages: dataspace, + datatype, fill value, filter pipleline, attribute */ const char *ublock_filename; /* user block file name */ hsize_t ublock_size; /* user block size */ hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */ diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index e205fba..b279cf9 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -142,8 +142,18 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed to close property list"); } + if(options->latest) + options->low_bound = options->high_bound = H5F_LIBVER_LATEST; + /* Create file access property list */ + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list"); + + /* It can be default, latest or other settings by users */ + if(H5Pset_libver_bounds(fapl, options->low_bound, options->high_bound) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_libver_bounds failed to set format version bounds"); + /* Check if we need to create a non-default file creation property list */ - if (options->latest || ub_size > 0) { + if (options->low_bound >= H5F_LIBVER_V18 || ub_size > 0) { /* Create file creation property list */ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list"); @@ -152,7 +162,7 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) if (H5Pset_userblock(fcpl, ub_size) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_userblock failed to set non-default userblock size"); - if (options->latest) { + if (options->low_bound >= H5F_LIBVER_V18) { unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5]; /* Adjust group creation parameters for root group */ @@ -203,12 +213,6 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shared_mesg_index failed to configure the specified shared object header message index"); } /* if (nindex>0) */ - /* Create file access property list */ - if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list"); - - if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_libver_bounds failed to set property for using latest version of the format"); } /* end if */ } /* end if */ #if defined (H5REPACK_DEBUG_USER_BLOCK) diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index d34c394..0fa268e 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -31,7 +31,7 @@ const char *outfile = NULL; * Command-line options: The user can specify short or long-named * parameters. */ -static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:M:t:a:i:o:S:P:T:G:q:z:E"; +static const char *s_opts = "hVvf:l:m:e:nLj:k:c:d:s:u:b:M:t:a:i:o:S:P:T:G:q:z:E"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "version", no_arg, 'V' }, @@ -42,6 +42,8 @@ static struct long_options l_opts[] = { { "file", require_arg, 'e' }, { "native", no_arg, 'n' }, { "latest", no_arg, 'L' }, + { "low", require_arg, 'j' }, + { "high", require_arg, 'k' }, { "compact", require_arg, 'c' }, { "indexed", require_arg, 'd' }, { "ssize", require_arg, 's' }, @@ -81,7 +83,13 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, " -v, --verbose Verbose mode, print object information\n"); PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n"); PRINTVALSTREAM(rawoutstream, " -n, --native Use a native HDF5 type when repacking\n"); + PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they occur\n"); PRINTVALSTREAM(rawoutstream, " -L, --latest Use latest version of file format\n"); + PRINTVALSTREAM(rawoutstream, " This option will take precedence over the -j and -k options\n"); + PRINTVALSTREAM(rawoutstream, " --low=BOUND The low bound for library release versions to use when creating\n"); + PRINTVALSTREAM(rawoutstream, " objects in the file (default is H5F_LIBVER_EARLIEST)\n"); + PRINTVALSTREAM(rawoutstream, " --high=BOUND The high bound for library release versions to use when creating\n"); + PRINTVALSTREAM(rawoutstream, " objects in the file (default is H5F_LIBVER_LATEST)\n"); PRINTVALSTREAM(rawoutstream, " -c L1, --compact=L1 Maximum number of links in header messages\n"); PRINTVALSTREAM(rawoutstream, " -d L2, --indexed=L2 Minimum number of links in the indexed format\n"); PRINTVALSTREAM(rawoutstream, " -s S[:F], --ssize=S[:F] Shared object header message minimum size\n"); @@ -114,8 +122,12 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, " F - is the shared object header message type, any of <dspace|dtype|fill|\n"); PRINTVALSTREAM(rawoutstream, " pline|attr>. If F is not specified, S applies to all messages\n"); PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they\n"); - PRINTVALSTREAM(rawoutstream, " occur.\n"); + PRINTVALSTREAM(rawoutstream, " BOUND is an integer indicating the library release versions to use when creating\n"); + PRINTVALSTREAM(rawoutstream, " objects in the file (see H5Pset_libver_bounds()):\n"); + PRINTVALSTREAM(rawoutstream, " 0: This is H5F_LIBVER_EARLIEST in H5F_libver_t struct\n"); + PRINTVALSTREAM(rawoutstream, " 1: This is H5F_LIBVER_V18 in H5F_libver_t struct\n"); + PRINTVALSTREAM(rawoutstream, " 2: This is H5F_LIBVER_V110 in H5F_libver_t struct\n"); + PRINTVALSTREAM(rawoutstream, " (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V110 for this release\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " FS_STRATEGY is a string indicating the file space strategy used:\n"); PRINTVALSTREAM(rawoutstream, " FSM_AGGR:\n"); @@ -205,6 +217,11 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, " Using latest file format with maximum compact group size of 10 and\n"); PRINTVALSTREAM(rawoutstream, " and minimum shared datatype size of 20\n"); PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "5) h5repack --low=0 --high=1 file1 file2\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " Set low=H5F_LIBVER_EARLIEST and high=H5F_LIBVER_V18 via H5Pset_libver_bounds() when\n"); + PRINTVALSTREAM(rawoutstream, " creating the repacked file: file2\n"); + PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, "5) h5repack -f SHUF -f GZIP=1 file1 file2\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " Add both filters SHUF and GZIP in this order to all datasets\n"); @@ -500,6 +517,22 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) options->latest = TRUE; break; + case 'j': + options->low_bound = (H5F_libver_t)HDatoi(opt_arg); + if(options->low_bound < H5F_LIBVER_EARLIEST || options->low_bound > H5F_LIBVER_LATEST) { + error_msg("in parsing low bound\n"); + goto done; + } + break; + + case 'k': + options->high_bound = (H5F_libver_t)HDatoi(opt_arg); + if(options->high_bound < H5F_LIBVER_EARLIEST || options->high_bound > H5F_LIBVER_LATEST) { + error_msg("in parsing high bound\n"); + goto done; + } + break; + case 'c': options->grp_compact = HDatoi( opt_arg ); if (options->grp_compact > 0) @@ -634,7 +667,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) break; case 'E': - enable_error_stack = TRUE; + enable_error_stack = TRUE; break; default: |