diff options
Diffstat (limited to 'tools/h5repack/h5repack_main.c')
-rw-r--r-- | tools/h5repack/h5repack_main.c | 142 |
1 files changed, 92 insertions, 50 deletions
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index d2aed2b..acbd8ee 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -38,7 +38,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:t:a:i:o:"; +static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:t:a:i:o:S:T:"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "version", no_arg, 'V' }, @@ -58,6 +58,8 @@ static struct long_options l_opts[] = { { "alignment", require_arg, 'a' }, { "infile", require_arg, 'i' }, /* -i for backward compability */ { "outfile", require_arg, 'o' }, /* -o for backward compability */ + { "fs_strategy", require_arg, 'S' }, + { "fs_threshold", require_arg, 'T' }, { NULL, 0, '\0' } }; @@ -69,7 +71,9 @@ static struct long_options l_opts[] = { * * Purpose: h5repack main program * - * Return: 1, error, 0, no error + * Return: Success: EXIT_SUCCESS(0) + * + * Failure: EXIT_FAILURE(1) * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * @@ -104,7 +108,7 @@ int main(int argc, const char **argv) int ret=-1; /* initialize options */ - h5repack_init (&options,0, 0); + h5repack_init (&options, 0, 0, 0, (hsize_t)0); parse_command_line(argc, argv, &options); @@ -180,63 +184,77 @@ static void usage(const char *prog) printf(" -a A, --alignment=A Alignment value for H5Pset_alignment\n"); printf(" -f FILT, --filter=FILT Filter type\n"); printf(" -l LAYT, --layout=LAYT Layout type\n"); + printf(" -S FS_STRGY, --fs_strategy=FS_STRGY File space management strategy\n"); + printf(" -T FS_THRD, --fs_threshold=FS_THRD Free-space section threshold\n"); printf("\n"); - printf(" M - is an integer greater than 1, size of dataset in bytes (default is 1024) \n"); - printf(" E - is a filename.\n"); - printf(" S - is an integer\n"); - printf(" U - is a filename.\n"); - printf(" T - is an integer\n"); - printf(" A - is an integer greater than zero\n"); - printf(" B - is the user block size, any value that is 512 or greater and is\n"); + printf(" M - is an integer greater than 1, size of dataset in bytes (default is 1024) \n"); + printf(" E - is a filename.\n"); + printf(" S - is an integer\n"); + printf(" U - is a filename.\n"); + printf(" T - is an integer\n"); + printf(" A - is an integer greater than zero\n"); + printf(" B - is the user block size, any value that is 512 or greater and is\n"); printf(" a power of 2 (1024 default)\n"); - printf(" F - is the shared object header message type, any of <dspace|dtype|fill|\n"); + printf(" F - is the shared object header message type, any of <dspace|dtype|fill|\n"); printf(" pline|attr>. If F is not specified, S applies to all messages\n"); - + printf("\n"); + printf(" FS_STRGY is the file space management strategy to use for the output file.\n"); + printf(" It is a string as listed below:\n"); + printf(" ALL_PERSIST - Use persistent free-space managers, aggregators and virtual file driver\n"); + printf(" for file space allocation\n"); + printf(" ALL - Use non-persistent free-space managers, aggregators and virtual file driver\n"); + printf(" for file space allocation\n"); + printf(" AGGR_VFD - Use aggregators and virtual file driver for file space allocation\n"); + printf(" VFD - Use virtual file driver for file space allocation\n"); + printf("\n"); + printf(" FS_THRD is the free-space section threshold to use for the output file.\n"); + printf(" It is the minimum size (in bytes) of free-space sections to be tracked\n"); + printf(" by the the library's free-space managers.\n"); printf("\n"); - printf(" FILT - is a string with the format:\n"); + printf(" FILT - is a string with the format:\n"); printf("\n"); - printf(" <list of objects>:<name of filter>=<filter parameters>\n"); + printf(" <list of objects>:<name of filter>=<filter parameters>\n"); printf("\n"); - printf(" <list of objects> is a comma separated list of object names, meaning apply\n"); - printf(" compression only to those objects. If no names are specified, the filter\n"); - printf(" is applied to all objects\n"); - printf(" <name of filter> can be:\n"); - printf(" GZIP, to apply the HDF5 GZIP filter (GZIP compression)\n"); - printf(" SZIP, to apply the HDF5 SZIP filter (SZIP compression)\n"); - printf(" SHUF, to apply the HDF5 shuffle filter\n"); - printf(" FLET, to apply the HDF5 checksum filter\n"); - printf(" NBIT, to apply the HDF5 NBIT filter (NBIT compression)\n"); - printf(" SOFF, to apply the HDF5 Scale/Offset filter\n"); - printf(" NONE, to remove all filters\n"); - printf(" <filter parameters> is optional filter parameter information\n"); - printf(" GZIP=<deflation level> from 1-9\n"); - printf(" SZIP=<pixels per block,coding> pixels per block is a even number in\n"); + printf(" <list of objects> is a comma separated list of object names, meaning apply\n"); + printf(" compression only to those objects. If no names are specified, the filter\n"); + printf(" is applied to all objects\n"); + printf(" <name of filter> can be:\n"); + printf(" GZIP, to apply the HDF5 GZIP filter (GZIP compression)\n"); + printf(" SZIP, to apply the HDF5 SZIP filter (SZIP compression)\n"); + printf(" SHUF, to apply the HDF5 shuffle filter\n"); + printf(" FLET, to apply the HDF5 checksum filter\n"); + printf(" NBIT, to apply the HDF5 NBIT filter (NBIT compression)\n"); + printf(" SOFF, to apply the HDF5 Scale/Offset filter\n"); + printf(" NONE, to remove all filters\n"); + printf(" <filter parameters> is optional filter parameter information\n"); + printf(" GZIP=<deflation level> from 1-9\n"); + printf(" SZIP=<pixels per block,coding> pixels per block is a even number in\n"); printf(" 2-32 and coding method is either EC or NN\n"); - printf(" SHUF (no parameter)\n"); - printf(" FLET (no parameter)\n"); - printf(" NBIT (no parameter)\n"); - printf(" SOFF=<scale_factor,scale_type> scale_factor is an integer and scale_type\n"); + printf(" SHUF (no parameter)\n"); + printf(" FLET (no parameter)\n"); + printf(" NBIT (no parameter)\n"); + printf(" SOFF=<scale_factor,scale_type> scale_factor is an integer and scale_type\n"); printf(" is either IN or DS\n"); - printf(" NONE (no parameter)\n"); + printf(" NONE (no parameter)\n"); printf("\n"); - printf(" LAYT - is a string with the format:\n"); + printf(" LAYT - is a string with the format:\n"); printf("\n"); - printf(" <list of objects>:<layout type>=<layout parameters>\n"); + printf(" <list of objects>:<layout type>=<layout parameters>\n"); printf("\n"); - printf(" <list of objects> is a comma separated list of object names, meaning that\n"); - printf(" layout information is supplied for those objects. If no names are\n"); - printf(" specified, the layout type is applied to all objects\n"); - printf(" <layout type> can be:\n"); - printf(" CHUNK, to apply chunking layout\n"); - printf(" COMPA, to apply compact layout\n"); - printf(" CONTI, to apply continuous layout\n"); - printf(" <layout parameters> is optional layout information\n"); - printf(" CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension\n"); - printf(" COMPA (no parameter)\n"); - printf(" CONTI (no parameter)\n"); + printf(" <list of objects> is a comma separated list of object names, meaning that\n"); + printf(" layout information is supplied for those objects. If no names are\n"); + printf(" specified, the layout type is applied to all objects\n"); + printf(" <layout type> can be:\n"); + printf(" CHUNK, to apply chunking layout\n"); + printf(" COMPA, to apply compact layout\n"); + printf(" CONTI, to apply continuous layout\n"); + printf(" <layout parameters> is optional layout information\n"); + printf(" CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension\n"); + printf(" COMPA (no parameter)\n"); + printf(" CONTI (no parameter)\n"); printf("\n"); printf("Examples of use:\n"); printf("\n"); @@ -429,6 +447,30 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) } break; + case 'S': + { + char strategy[MAX_NC_NAME]; + + strcpy(strategy, opt_arg); + if(!strcmp(strategy, "ALL_PERSIST")) + options->fs_strategy = H5F_FILE_SPACE_ALL_PERSIST; + else if(!strcmp(strategy, "ALL")) + options->fs_strategy = H5F_FILE_SPACE_ALL; + else if(!strcmp(strategy, "AGGR_VFD")) + options->fs_strategy = H5F_FILE_SPACE_AGGR_VFD; + else if(!strcmp(strategy, "VFD")) + options->fs_strategy = H5F_FILE_SPACE_VFD; + else { + error_msg(progname, "invalid file space management strategy\n", opt_arg ); + exit(EXIT_FAILURE); + } + break; + } + + case 'T': + + options->fs_threshold = (hsize_t)atol( opt_arg ); + break; } /* switch */ @@ -484,7 +526,7 @@ void read_info(const char *filename, if ((fp = fopen(data_file, "r")) == (FILE *)NULL) { error_msg(progname, "cannot open options file %s\n", filename); - exit(1); + exit(EXIT_FAILURE); } /* cycle until end of file reached */ @@ -521,7 +563,7 @@ void read_info(const char *filename, if (h5repack_addfilter(comp_info,options)==-1){ error_msg(progname, "could not add compression option\n"); - exit(1); + exit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -551,7 +593,7 @@ void read_info(const char *filename, if (h5repack_addlayout(comp_info,options)==-1){ error_msg(progname, "could not add chunck option\n"); - exit(1); + exit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -560,7 +602,7 @@ void read_info(const char *filename, */ else { error_msg(progname, "bad file format for %s", filename); - exit(1); + exit(EXIT_FAILURE); } } |