From 68607efcd10222ed1b1d19308d3586eb65fe3644 Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Tue, 6 Jan 2004 12:49:00 -0500 Subject: [svn-r8021] Purpose: h5repack new features Description: added support/tests for multi filters Solution: Platforms tested: linux solaris AIX Misc. update: --- tools/h5repack/h5repack.c | 34 ++++- tools/h5repack/h5repack.h | 27 ++-- tools/h5repack/h5repack_copy.c | 10 +- tools/h5repack/h5repack_filters.c | 225 +++++++++++++++++++--------------- tools/h5repack/h5repack_layout.c | 1 - tools/h5repack/h5repack_opttable.c | 131 +++++++++++++------- tools/h5repack/h5repack_verify.c | 173 +++++++++++++++++++++++++- tools/h5repack/testh5repack_filters.c | 10 +- tools/h5repack/testh5repack_main.c | 102 ++++++++++++--- 9 files changed, 521 insertions(+), 192 deletions(-) diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index e4a83a0..147b6db 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -23,6 +23,25 @@ static int check_options(pack_opt_t *options); + +/*------------------------------------------------------------------------- + * Function: aux_initglb_filter + * + * Purpose: auxiliary function, initialize the options global filter + * + * Return: void + * + *------------------------------------------------------------------------- + */ +static void aux_initglb_filter(pack_opt_t *options) +{ + int k; + options->filter_g.filtn = -1; + for ( k=0; kfilter_g.cd_values[k] = -1; +} + + /*------------------------------------------------------------------------- * Function: h5repack * @@ -130,6 +149,7 @@ int h5repack_addfilter(const char* str, if (options->all_filter==1) { /* if we are compressing all set the global filter type */ + aux_initglb_filter(options); options->filter_g=filt; } @@ -294,24 +314,26 @@ static int check_options(pack_opt_t *options) { pack_info_t pack = options->op_tbl->objs[i]; char* name = pack.path; - if (pack.filter.filtn>0) + + for ( j=0; jverbose) { printf("\t<%s> with %s filter", name, - get_sfilter(pack.filter.filtn)); + get_sfilter(pack.filter[j].filtn)); } + has_cp=1; /*check for invalid combination of options */ - switch (pack.filter.filtn) + switch (pack.filter[j].filtn) { default: break; case H5Z_FILTER_SZIP: - szip_pixels_per_block=pack.filter.cd_values[0]; + szip_pixels_per_block=pack.filter[j].cd_values[0]; /* check szip parameters */ if (check_szip(pack.chunk.rank, @@ -325,7 +347,7 @@ static int check_options(pack_opt_t *options) Reset this object filter info */ - options->op_tbl->objs[i].filter.filtn=-1; + options->op_tbl->objs[i].filter[j].filtn=-1; options->op_tbl->objs[i].chunk.rank=-1; printf("\tObject <%s> cannot be filtered\n",name); @@ -334,7 +356,7 @@ static int check_options(pack_opt_t *options) break; } /* switch */ - } /* filtn */ + } /* j */ } /* i */ if (options->all_filter==1 && has_cp){ diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index 16e0f6a..965219e 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -64,13 +64,18 @@ typedef struct { int rank; } chunk_info_t; +/* we currently define a maximum value for the filters array, + that corresponds to the current library filters */ +#define H5_REPACK_MAX_NFILTERS 4 + /* information for one object, contains PATH, CHUNK info and FILTER info */ typedef struct { - char path[MAX_NC_NAME]; /* name of object */ - filter_info_t filter; /* filter information */ - H5D_layout_t layout; /* layout information */ - chunk_info_t chunk; /* chunk information */ - hid_t refobj_id; /* object ID, references */ + char path[MAX_NC_NAME]; /* name of object */ + filter_info_t filter[H5_REPACK_MAX_NFILTERS]; /* filter array */ + int nfilters; /* current number of filters */ + H5D_layout_t layout; /* layout information */ + chunk_info_t chunk; /* chunk information */ + hid_t refobj_id; /* object ID, references */ } pack_info_t; /* store a table of all objects */ @@ -115,6 +120,9 @@ int h5repack_addlayout (const char* str, pack_opt_t *options); int h5repack_init (pack_opt_t *options, int verbose); int h5repack_end (pack_opt_t *options); int h5repack_verify (const char *fname,pack_opt_t *options); +int h5repack_cmpdcpl (const char *fname1, + const char *fname2); + #ifdef __cplusplus } @@ -177,10 +185,10 @@ int filter_this(const char* name, pack_opt_t *options, pack_info_t *pack); /* info about object to filter */ -int apply_filter(hid_t dcpl_id, - size_t size, /* size of datatype in bytes */ - pack_opt_t *options, /* repack options */ - pack_info_t *pack); /* info about object to filter */ +int apply_filters(hid_t dcpl_id, + size_t size, /* size of datatype in bytes */ + pack_opt_t *options, /* repack options */ + pack_info_t *pack); /* info about object to filter */ int has_filter(hid_t dcpl_id, H5Z_filter_t filtnin); @@ -211,7 +219,6 @@ int layout_this(hid_t dcpl_id, /* DCPL from input object */ pack_info_t *pack /*OUT*/) /* object to apply layout */; int apply_layout(hid_t dcpl_id, - pack_opt_t *options, /* repack options */ pack_info_t *pack); /* info about object */ diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index cfdb6e7..2d6752b 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -242,7 +242,7 @@ int do_copy_file(hid_t fidin, { /* the information about the object to be filtered/"layouted" */ - pack_info_t pack; + pack_info_t obj; /* get the storage size of the input dataset */ dsize_in=H5Dget_storage_size(dset_in); @@ -265,9 +265,9 @@ int do_copy_file(hid_t fidin, * if the layout could not be applied, continue *------------------------------------------------------------------------- */ - if (layout_this(dcpl_id,travt->objs[i].name,options,&pack)) + if (layout_this(dcpl_id,travt->objs[i].name,options,&obj)) { - if (apply_layout(dcpl_id,options,&pack)<0) + if (apply_layout(dcpl_id,&obj)<0) continue; } @@ -276,9 +276,9 @@ int do_copy_file(hid_t fidin, * if the filter could not be applied, continue *------------------------------------------------------------------------- */ - if (filter_this(travt->objs[i].name,options,&pack)) + if (filter_this(travt->objs[i].name,options,&obj)) { - if (apply_filter(dcpl_id,H5Tget_size(mtype_id),options,&pack)<0) + if (apply_filters(dcpl_id,H5Tget_size(mtype_id),options,&obj)<0) continue; } diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index 5f7f641..e245c35 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -16,6 +16,31 @@ #include "h5test.h" #include "h5repack.h" + +/*------------------------------------------------------------------------- + * Function: aux_objinsert_filter + * + * Purpose: auxiliary function, inserts the filter in object OBJ + * + * Return: void + * + *------------------------------------------------------------------------- + */ +static void aux_objinsert_filter(pack_info_t *obj, + filter_info_t filt) +{ + int j; + + for ( j=0; jfilter[j].filtn = -1; + } + + obj->nfilters=1; + obj->filter[0]=filt; + +} + /*------------------------------------------------------------------------- * Function: filter_this * @@ -30,56 +55,58 @@ * *------------------------------------------------------------------------- */ - int filter_this(const char* name, /* object name from traverse list */ pack_opt_t *options, /* repack options */ - pack_info_t *obj) /* info about object to filter */ + pack_info_t *obj /*OUT*/) /* info about object to filter */ { char *pdest; int result; - int i; - + int i, j; + /* if we are applying to all objects just return true */ if (options->all_filter) { /* assign the global filter and chunk info to the OBJ info */ - obj->filter=options->filter_g; + aux_objinsert_filter( obj, options->filter_g ); obj->chunk=options->chunk_g; return 1; } - + for ( i=0; iop_tbl->nelems; i++) { - if (options->op_tbl->objs[i].filter.filtn != -1 ) + for ( j=0; jop_tbl->objs[i].nfilters; j++) { - if (strcmp(options->op_tbl->objs[i].path,name)==0) - { - *obj=options->op_tbl->objs[i]; - return 1; - } - - pdest = strstr(name,options->op_tbl->objs[i].path); - result = (int)(pdest - name); - - /* found at position 1, meaning without '/' */ - if( pdest != NULL && result==1 ) + if (options->op_tbl->objs[i].filter[j].filtn != -1 ) { - *obj=options->op_tbl->objs[i]; - return 1; - } - } - } - + if (strcmp(options->op_tbl->objs[i].path,name)==0) + { + *obj=options->op_tbl->objs[i]; + return 1; + } + + pdest = strstr(name,options->op_tbl->objs[i].path); + result = (int)(pdest - name); + + /* found at position 1, meaning without '/' */ + if( pdest != NULL && result==1 ) + { + *obj=options->op_tbl->objs[i]; + return 1; + } + } /*if*/ + }/*j*/ + }/*i*/ + return 0; } /*------------------------------------------------------------------------- - * Function: apply_filter + * Function: apply_filters * - * Purpose: apply a filter to the property list; do extra checking - * in the case of SZIP + * Purpose: apply the filters in the object to the property list; + * do extra checking in the case of SZIP * * Return: 0, ok, -1 no * @@ -90,10 +117,10 @@ int filter_this(const char* name, /* object name from traverse list */ *------------------------------------------------------------------------- */ -int apply_filter(hid_t dcpl_id, - size_t size, /* size of datatype in bytes */ - pack_opt_t *options, /* repack options */ - pack_info_t *obj) /* info about object to filter */ +int apply_filters(hid_t dcpl_id, + size_t size, /* size of datatype in bytes */ + pack_opt_t *options, /* repack options */ + pack_info_t *obj) /* info about object to filter */ { int nfilters; /* number of filters */ unsigned filt_flags; /* filter flags */ @@ -103,7 +130,7 @@ int apply_filter(hid_t dcpl_id, size_t cd_num; /* filter client data counter */ char f_name[256]; /* filter/file name */ char s[64]; /* temporary string buffer */ - int i; + int i, j; unsigned aggression; /* the deflate level */ unsigned szip_options_mask=H5_SZIP_NN_OPTION_MASK; unsigned szip_pixels_per_block; @@ -148,77 +175,79 @@ int apply_filter(hid_t dcpl_id, H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC H5Z_FILTER_SZIP 4 , szip compression */ - - switch (obj->filter.filtn) + for ( j=0; jnfilters; j++) { - case H5Z_FILTER_NONE: - - break; - - - case H5Z_FILTER_DEFLATE: - - - aggression=obj->filter.cd_values[0]; - - /* set up for deflated data */ - if(H5Pset_chunk(dcpl_id, obj->chunk.rank, obj->chunk.chunk_lengths)<0) - return -1; - if(H5Pset_deflate(dcpl_id,aggression)<0) - return -1; - - break; - - - case H5Z_FILTER_SZIP: - - szip_pixels_per_block=obj->filter.cd_values[0]; - - /* check szip parameters */ - if (check_szip(obj->chunk.rank, - obj->chunk.chunk_lengths, - size, - szip_options_mask, - szip_pixels_per_block)==1) + switch (obj->filter[j].filtn) { - /* set up for szip data */ - if(H5Pset_chunk(dcpl_id,obj->chunk.rank,obj->chunk.chunk_lengths)<0) + case H5Z_FILTER_NONE: + + break; + + + case H5Z_FILTER_DEFLATE: + + + aggression=obj->filter[j].cd_values[0]; + + /* set up for deflated data */ + if(H5Pset_chunk(dcpl_id, obj->chunk.rank, obj->chunk.chunk_lengths)<0) return -1; - if (H5Pset_szip(dcpl_id, szip_options_mask, szip_pixels_per_block)<0) + if(H5Pset_deflate(dcpl_id,aggression)<0) return -1; - } - else - { - printf("SZIP filter cannot be applied\n"); - } - - break; - - - case H5Z_FILTER_SHUFFLE: - - if(H5Pset_chunk(dcpl_id, obj->chunk.rank, obj->chunk.chunk_lengths)<0) - return -1; - if (H5Pset_shuffle(dcpl_id)<0) - return -1; - - break; - - case H5Z_FILTER_FLETCHER32: - - if(H5Pset_chunk(dcpl_id, obj->chunk.rank, obj->chunk.chunk_lengths)<0) - return -1; - if (H5Pset_fletcher32(dcpl_id)<0) - return -1; - - break; - - - default: - break; - - } /* switch */ + break; + + + case H5Z_FILTER_SZIP: + + szip_pixels_per_block=obj->filter[j].cd_values[0]; + + /* check szip parameters */ + if (check_szip(obj->chunk.rank, + obj->chunk.chunk_lengths, + size, + szip_options_mask, + szip_pixels_per_block)==1) + { + /* set up for szip data */ + if(H5Pset_chunk(dcpl_id,obj->chunk.rank,obj->chunk.chunk_lengths)<0) + return -1; + if (H5Pset_szip(dcpl_id, szip_options_mask, szip_pixels_per_block)<0) + return -1; + + } + else + { + printf("SZIP filter cannot be applied\n"); + } + + break; + + + case H5Z_FILTER_SHUFFLE: + + if(H5Pset_chunk(dcpl_id, obj->chunk.rank, obj->chunk.chunk_lengths)<0) + return -1; + if (H5Pset_shuffle(dcpl_id)<0) + return -1; + + break; + + case H5Z_FILTER_FLETCHER32: + + if(H5Pset_chunk(dcpl_id, obj->chunk.rank, obj->chunk.chunk_lengths)<0) + return -1; + if (H5Pset_fletcher32(dcpl_id)<0) + return -1; + + break; + + + default: + break; + + } /* switch */ + }/*j*/ return 0; } diff --git a/tools/h5repack/h5repack_layout.c b/tools/h5repack/h5repack_layout.c index 0a673d9..1cf1680 100644 --- a/tools/h5repack/h5repack_layout.c +++ b/tools/h5repack/h5repack_layout.c @@ -154,7 +154,6 @@ int layout_this(hid_t dcpl_id, /* DCPL from input object */ */ int apply_layout(hid_t dcpl_id, - pack_opt_t *options, /* repack options */ pack_info_t *obj) /* info about object */ { diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c index a18c508..9449556 100644 --- a/tools/h5repack/h5repack_opttable.c +++ b/tools/h5repack/h5repack_opttable.c @@ -17,6 +17,68 @@ #include "h5repack.h" +/*------------------------------------------------------------------------- + * Function: aux_tblinsert_filter + * + * Purpose: auxiliary function, inserts the filter in object OBJS[ I ] + * + * Return: void + * + *------------------------------------------------------------------------- + */ + +static void aux_tblinsert_filter(pack_opttbl_t *table, + int I, + filter_info_t filt) +{ + if (table->objs[ I ].nfiltersobjs[ I ].filter[ table->objs[ I ].nfilters++ ] = filt; + } + else + { + printf("Cannot insert the filter in this object.\ + Maximum capacity exceeded\n"); + } +} + + +/*------------------------------------------------------------------------- + * Function: aux_inctable + * + * Purpose: auxiliary function, increases the size of the collection by N_OBJS + * + * Return: 0, ok, -1, fail + * + *------------------------------------------------------------------------- + */ + +static int aux_inctable(pack_opttbl_t *table, int n_objs ) +{ + int i, j, k; + + table->size += n_objs; + table->objs = (pack_info_t*)realloc(table->objs, table->size * sizeof(pack_info_t)); + if (table->objs==NULL) { + printf("Error: not enough memory for options table\n"); + return -1; + } + for (i = table->nelems; i < table->size; i++) + { + strcpy(table->objs[i].path,"\0"); + for ( j=0; jobjs[i].filter[j].filtn = -1; + for ( k=0; kobjs[i].filter[j].cd_values[k] = -1; + } + table->objs[i].chunk.rank = -1; + table->objs[i].refobj_id = -1; + table->objs[i].layout = -1; + table->objs[i].nfilters = 0; + } + return 0; +} /*------------------------------------------------------------------------- * Function: options_table_init @@ -30,7 +92,7 @@ int options_table_init( pack_opttbl_t **tbl ) { - int i, j; + int i, j, k; pack_opttbl_t* table = (pack_opttbl_t*) malloc(sizeof(pack_opttbl_t)); if (table==NULL) { printf("Error: not enough memory for options table\n"); @@ -45,15 +107,20 @@ int options_table_init( pack_opttbl_t **tbl ) return -1; } - for ( i=0; isize; i++) { - strcpy(table->objs[i].path,"\0"); - table->objs[i].filter.filtn = -1; - for ( j=0; jobjs[i].filter.cd_values[j] = -1; - table->objs[i].chunk.rank = -1; - table->objs[i].refobj_id = -1; - table->objs[i].layout = -1; + for ( i=0; isize; i++) + { + strcpy(table->objs[i].path,"\0"); + for ( j=0; jobjs[i].filter[j].filtn = -1; + for ( k=0; kobjs[i].filter[j].cd_values[k] = -1; } + table->objs[i].chunk.rank = -1; + table->objs[i].refobj_id = -1; + table->objs[i].layout = -1; + table->objs[i].nfilters = 0; + } *tbl = table; return 0; @@ -94,24 +161,12 @@ int options_add_layout( obj_list_t *obj_list, { int i, j, k, I, added=0, found=0; - if (table->nelems+n_objs >= table->size) { - table->size += n_objs; - table->objs = (pack_info_t*)realloc(table->objs, table->size * sizeof(pack_info_t)); - if (table->objs==NULL) { - printf("Error: not enough memory for options table\n"); + /* increase the size of the collection by N_OBJS if necessary */ + if (table->nelems+n_objs >= table->size) + { + if (aux_inctable(table,n_objs)<0) return -1; - } - for (i = table->nelems; i < table->size; i++) { - strcpy(table->objs[i].path,"\0"); - table->objs[i].filter.filtn = -1; - for ( j=0; jobjs[i].filter.cd_values[j] = -1; - table->objs[i].chunk.rank = -1; - table->objs[i].refobj_id = -1; - table->objs[i].layout = -1; - } } - /* search if this object is already in the table; "path" is the key */ if (table->nelems>0) @@ -205,22 +260,11 @@ int options_add_filter(obj_list_t *obj_list, int i, j, I, added=0, found=0; - if (table->nelems+n_objs >= table->size) { - table->size += n_objs; - table->objs = (pack_info_t*)realloc(table->objs, table->size * sizeof(pack_info_t)); - if (table->objs==NULL) { - printf("Error: not enough memory for options table\n"); + /* increase the size of the collection by N_OBJS if necessary */ + if (table->nelems+n_objs >= table->size) + { + if (aux_inctable(table,n_objs)<0) return -1; - } - for (i = table->nelems; i < table->size; i++) { - strcpy(table->objs[i].path,"\0"); - table->objs[i].filter.filtn = -1; - for ( j=0; jobjs[i].filter.cd_values[j] = -1; - table->objs[i].chunk.rank = -1; - table->objs[i].refobj_id = -1; - table->objs[i].layout = -1; - } } /* search if this object is already in the table; "path" is the key */ @@ -236,8 +280,7 @@ int options_add_filter(obj_list_t *obj_list, if (strcmp(obj_list[j].obj,table->objs[i].path)==0) { /* insert */ - - table->objs[i].filter = filt; + aux_tblinsert_filter(table,i,filt); found=1; break; } /* if */ @@ -249,7 +292,7 @@ int options_add_filter(obj_list_t *obj_list, I = table->nelems + added; added++; strcpy(table->objs[I].path,obj_list[j].obj); - table->objs[I].filter = filt; + aux_tblinsert_filter(table,I,filt); } } /* j */ } @@ -263,7 +306,7 @@ int options_add_filter(obj_list_t *obj_list, I = table->nelems + added; added++; strcpy(table->objs[I].path,obj_list[j].obj); - table->objs[I].filter = filt; + aux_tblinsert_filter(table,I,filt); } } diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index e2545bc..6961731 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -156,7 +156,7 @@ int h5repack_verify(const char *fname, hid_t dset_id; /* dataset ID */ hid_t dcpl_id; /* dataset creation property list ID */ hid_t space_id; /* space ID */ - int ret=1, i; + int ret=1, i, j; trav_table_t *travt=NULL; /* open the file */ @@ -166,7 +166,7 @@ int h5repack_verify(const char *fname, for ( i=0; iop_tbl->nelems; i++) { char* name=options->op_tbl->objs[i].path; - pack_info_t obj=options->op_tbl->objs[i]; + pack_info_t *obj = &options->op_tbl->objs[i]; /*------------------------------------------------------------------------- * open @@ -183,14 +183,17 @@ int h5repack_verify(const char *fname, * filter check *------------------------------------------------------------------------- */ - if (has_filter(dcpl_id,obj.filter.filtn)==0) - ret=0; + for ( j=0; jnfilters; j++) + { + if (has_filter(dcpl_id,obj->filter[j].filtn)==0) + ret=0; + } /*------------------------------------------------------------------------- * layout check *------------------------------------------------------------------------- */ - if (has_layout(dcpl_id,&obj)==0) + if (has_layout(dcpl_id,obj)==0) ret=0; /*------------------------------------------------------------------------- @@ -306,3 +309,163 @@ error: return -1; } + + +/*------------------------------------------------------------------------- + * Function: h5repack_cmpdcpl + * + * Purpose: compare 2 files for identical property lists of all objects + * + * Return: 1=identical, 0=not identical, -1=error + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: December 31, 2003 + * + *------------------------------------------------------------------------- + */ + +int h5repack_cmpdcpl(const char *fname1, + const char *fname2) +{ + hid_t fid1; /* file ID */ + hid_t fid2; /* file ID */ + hid_t dset1; /* dataset ID */ + hid_t dset2; /* dataset ID */ + hid_t dcpl1; /* dataset creation property list ID */ + hid_t dcpl2; /* dataset creation property list ID */ + trav_table_t *travt1=NULL; + trav_table_t *travt2=NULL; + int ret=1, i; + +/*------------------------------------------------------------------------- + * open the files first; if they are not valid, no point in continuing + *------------------------------------------------------------------------- + */ + + /* disable error reporting */ + H5E_BEGIN_TRY { + + /* Open the files */ + if ((fid1=H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT))<0 ) + { + printf("<%s>: No such file or directory\n", fname1 ); + return -1; + } + if ((fid2=H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT))<0 ) + { + printf("<%s>: No such file or directory\n", fname2 ); + H5Fclose(fid1); + return -1; + } + /* enable error reporting */ + } H5E_END_TRY; + +/*------------------------------------------------------------------------- + * get file table list of objects + *------------------------------------------------------------------------- + */ + trav_table_init(&travt1); + trav_table_init(&travt2); + if (h5trav_gettable(fid1,travt1)<0) + goto error; + if (h5trav_gettable(fid2,travt2)<0) + goto error; + + +/*------------------------------------------------------------------------- + * traverse the suppplied object list + *------------------------------------------------------------------------- + */ + + for ( i=0; i < travt1->nobjs; i++) + { + switch ( travt1->objs[i].type ) + { +/*------------------------------------------------------------------------- + * nothing to do for groups, links and types + *------------------------------------------------------------------------- + */ + default: + break; + +/*------------------------------------------------------------------------- + * H5G_DATASET + *------------------------------------------------------------------------- + */ + case H5G_DATASET: + if ((dset1=H5Dopen(fid1,travt1->objs[i].name))<0) + goto error; + if ((dset2=H5Dopen(fid2,travt1->objs[i].name))<0) + goto error; + if ((dcpl1=H5Dget_create_plist(dset1))<0) + goto error; + if ((dcpl2=H5Dget_create_plist(dset2))<0) + goto error; + +/*------------------------------------------------------------------------- + * compare the property lists + *------------------------------------------------------------------------- + */ + if ((ret=H5Pequal(dcpl1,dcpl2))<0) + goto error; + + if (ret==0) + { + printf("Property lists for <%s> are different\n",travt1->objs[i].name); + } + +/*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + if (H5Pclose(dcpl1)<0) + goto error; + if (H5Pclose(dcpl2)<0) + goto error; + if (H5Dclose(dset1)<0) + goto error; + if (H5Dclose(dset2)<0) + goto error; + + break; + + } /*switch*/ + } /*i*/ + +/*------------------------------------------------------------------------- + * free + *------------------------------------------------------------------------- + */ + + trav_table_free(travt1); + trav_table_free(travt2); + +/*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + + H5Fclose(fid1); + H5Fclose(fid2); + return ret; + +/*------------------------------------------------------------------------- + * error + *------------------------------------------------------------------------- + */ + +error: + H5E_BEGIN_TRY { + H5Pclose(dcpl1); + H5Pclose(dcpl2); + H5Dclose(dset1); + H5Dclose(dset2); + H5Fclose(fid1); + H5Fclose(fid2); + trav_table_free(travt1); + trav_table_free(travt2); + } H5E_END_TRY; + return -1; + +} diff --git a/tools/h5repack/testh5repack_filters.c b/tools/h5repack/testh5repack_filters.c index 3313d77..2c03702 100644 --- a/tools/h5repack/testh5repack_filters.c +++ b/tools/h5repack/testh5repack_filters.c @@ -38,7 +38,7 @@ int make_deflate(hid_t loc_id) hid_t sid; /* dataspace ID */ hsize_t dims[RANK]={DIM1,DIM2}; hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; - int buf[40][20]; + int buf[DIM1][DIM2]; int i, j, n=0; for (i=0; i + * January 5, 2004 + * + *------------------------------------------------------------------------- + */ +static int +test_filterqueue(void) +{ + pack_opt_t pack_options; + diff_opt_t diff_options; + memset(&diff_options, 0, sizeof (diff_opt_t)); + memset(&pack_options, 0, sizeof (pack_opt_t)); + + TESTING(" filter queue"); +/*------------------------------------------------------------------------- + * add some filters + *------------------------------------------------------------------------- + */ + + if (h5repack_init (&pack_options, 0)<0) + TEST_ERROR; + if (h5repack_addlayout("dset1:CHUNK 20x10",&pack_options)<0) + TEST_ERROR; + if (h5repack_addfilter("dset1:FLET",&pack_options)<0) + TEST_ERROR; + if (h5repack_addfilter("dset1:SHUF",&pack_options)<0) + TEST_ERROR; + if (h5repack_addfilter("dset1:GZIP 1",&pack_options)<0) + TEST_ERROR; +#if 0 + if (h5repack_addfilter("dset1:SZIP 8",&pack_options)<0) + TEST_ERROR; +#endif + if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) + TEST_ERROR; + if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) + TEST_ERROR; + if (h5repack_verify(FNAME4OUT,&pack_options)<=0) + TEST_ERROR; + if (h5repack_end (&pack_options)<0) + TEST_ERROR; + PASSED(); + return 0; + +error: + return 1; +} /*------------------------------------------------------------------------- @@ -683,13 +745,12 @@ error: * Failure: non-zero * * Programmer: Pedro Vicente - * September, 19, 2003 - * - * Modifications: + * January, 5, 2004 * *------------------------------------------------------------------------- */ + int main (void) { int nerrors=0; @@ -701,8 +762,6 @@ int main (void) if (make_testfiles()<0) goto error; -#if 1 - /* test a copy with no filters */ nerrors += test_copy(); @@ -721,22 +780,29 @@ int main (void) /* test a copy with layout CHUNK options */ nerrors += test_layout_chunked(); -#endif - -#if 1 - /* test a copy with layout CONTI options */ nerrors += test_layout_contiguous(); -#endif + /* test a copy with layout COMPA options */ + nerrors += test_layout_compact(); -#if 1 + /* test a copy with the shuffle filter */ + nerrors += test_filter_shuffle(); + + /* test a copy with the checksum filter */ + nerrors += test_filter_checksum(); + + /* test a copy with layout CHUNK options */ + nerrors += test_layout_chunked(); + + /* test a copy with layout CONTI options */ + nerrors += test_layout_contiguous(); /* test a copy with layout COMPA options */ nerrors += test_layout_compact(); -#endif - + /* test a copy with all available filters */ + nerrors += test_filterqueue(); /* check for errors */ if (nerrors) @@ -753,3 +819,5 @@ error: return 0; } + + -- cgit v0.12