diff options
-rw-r--r-- | tools/h5repack/h5repack.c | 5 | ||||
-rw-r--r-- | tools/h5repack/h5repack.h | 7 | ||||
-rw-r--r-- | tools/h5repack/h5repack_copy.c | 58 | ||||
-rw-r--r-- | tools/h5repack/h5repack_filters.c | 2 | ||||
-rw-r--r-- | tools/h5repack/h5repack_list.c | 2 | ||||
-rw-r--r-- | tools/h5repack/h5repack_opttable.c | 12 | ||||
-rw-r--r-- | tools/h5repack/h5repack_verify.c | 7 | ||||
-rw-r--r-- | tools/h5repack/h5repacktst.c | 27 | ||||
-rw-r--r-- | tools/lib/h5diff.c | 2 | ||||
-rw-r--r-- | tools/lib/h5trav.c | 22 | ||||
-rw-r--r-- | tools/lib/h5trav.h | 22 | ||||
-rw-r--r-- | tools/lib/h5trav_table.c | 14 |
12 files changed, 110 insertions, 70 deletions
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index 3469704..2c220c3 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -247,8 +247,9 @@ int h5repack_addlayout(const char* str, */ static int check_options(pack_opt_t *options) { - int i, k, j, has_cp=0, has_ck=0; - char slayout[30]; + unsigned int i; + int k, j, has_cp=0, has_ck=0; + char slayout[30]; /*------------------------------------------------------------------------- * objects to layout diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index 0f5ccfe..9b1d911 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -80,9 +80,9 @@ typedef struct { /* store a table of all objects */ typedef struct { - int size; - int nelems; - pack_info_t *objs; + unsigned int size; + unsigned int nelems; + pack_info_t *objs; } pack_opttbl_t; @@ -102,7 +102,6 @@ typedef struct { int verbose; /*verbose mode */ hsize_t threshold; /*minimum size to compress, in bytes */ int use_native; /*use a native type in write */ - int have_fc_f; /*has input to use filter/chunking flag */ } pack_opt_t; diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 03da178..f6b738c 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -24,7 +24,6 @@ extern char *progname; static int do_create_refs; - #define PER(A,B) { per = 0; \ if (A!=0) \ per = (float)fabs( ((float)B - (float)A) / (float) A ); \ @@ -317,9 +316,12 @@ int do_copy_objects(hid_t fidin, float per; /* percent utilization of storage */ void *buf=NULL; /* buffer for raw data */ void *sm_buf=NULL; /* buffer for raw data */ - int i, j; + unsigned i; int nfilters; /* number of filters in DCPL */ H5D_layout_t layout; +#if defined(H5REPACK_GETTIME) + time_t start_time, finish_time, time_secs; +#endif /*------------------------------------------------------------------------- * copy the suppplied object list @@ -411,6 +413,11 @@ int do_copy_objects(hid_t fidin, options->all_filter==1 || options->all_layout==1 ) { + int j; + +#if defined(H5REPACK_GETTIME) + time( &start_time ); +#endif if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0) goto error; if ((f_space_id=H5Dget_space(dset_in))<0) @@ -540,6 +547,7 @@ int do_copy_objects(hid_t fidin, hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */ hsize_t hs_nelmts; /*elements in request */ hsize_t zero[8]; /*vector of zeros */ + int k; /* check if we have VL data in the dataset's datatype */ if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE) @@ -551,9 +559,9 @@ int do_copy_objects(hid_t fidin, */ sm_nbytes = p_type_nbytes; - for (i = rank; i > 0; --i) { - sm_size[i - 1] = MIN(dims[i - 1], H5TOOLS_BUFSIZE / sm_nbytes); - sm_nbytes *= sm_size[i - 1]; + for (k = rank; k > 0; --k) { + sm_size[k - 1] = MIN(dims[k - 1], H5TOOLS_BUFSIZE / sm_nbytes); + sm_nbytes *= sm_size[k - 1]; assert(sm_nbytes > 0); } sm_buf = HDmalloc((size_t)sm_nbytes); @@ -570,10 +578,10 @@ int do_copy_objects(hid_t fidin, /* calculate the hyperslab size */ if (rank > 0) { - for (i = 0, hs_nelmts = 1; i < rank; i++) + for (k = 0, hs_nelmts = 1; k < rank; k++) { - hs_size[i] = MIN(dims[i] - hs_offset[i], sm_size[i]); - hs_nelmts *= hs_size[i]; + hs_size[k] = MIN(dims[k] - hs_offset[k], sm_size[k]); + hs_nelmts *= hs_size[k]; } if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL)<0) @@ -599,14 +607,14 @@ int do_copy_objects(hid_t fidin, H5Dvlen_reclaim(wtype_id, sm_space, H5P_DEFAULT, sm_buf); /* calculate the next hyperslab offset */ - for (i = rank, carry = 1; i > 0 && carry; --i) + for (k = rank, carry = 1; k > 0 && carry; --k) { - hs_offset[i - 1] += hs_size[i - 1]; - if (hs_offset[i - 1] == dims[i - 1]) - hs_offset[i - 1] = 0; + hs_offset[k - 1] += hs_size[k - 1]; + if (hs_offset[k - 1] == dims[k - 1]) + hs_offset[k - 1] = 0; else carry = 0; - } /* i */ + } /* k */ } /* elmtno */ H5Sclose(sm_space); @@ -677,6 +685,12 @@ int do_copy_objects(hid_t fidin, if (H5Dclose(dset_in)<0) goto error; +#if defined(H5REPACK_GETTIME) + time( &finish_time ); + time_secs = finish_time-start_time; + printf("time1=%d secs\n",time_secs); +#endif + } /*------------------------------------------------------------------------- * we do not have request for filter/chunking use H5Ocopy instead @@ -686,6 +700,10 @@ int do_copy_objects(hid_t fidin, { hid_t pid; +#if defined(H5REPACK_GETTIME) + time( &start_time ); +#endif + /* create property to pass copy options */ if ( (pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) goto error; @@ -707,6 +725,13 @@ int do_copy_objects(hid_t fidin, if (H5Pclose(pid)<0) goto error; +#if defined(H5REPACK_GETTIME) + time( &finish_time ); + time_secs = finish_time-start_time; + printf("time2=%d secs\n",time_secs); +#endif + + } /* end do we have request for filter/chunking */ @@ -1003,7 +1028,7 @@ error: static int do_hardlinks(hid_t fidout,trav_table_t *travt) { - int i, j; + unsigned int i, j; for ( i = 0; i < travt->nobjs; i++) { @@ -1093,7 +1118,8 @@ int do_copy_refobjs(hid_t fidin, int rank; /* rank of dataset */ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ int next; /* external files */ - int i, j; + unsigned i; + int j; /*------------------------------------------------------------------------- * browse @@ -1739,7 +1765,7 @@ static const char* MapIdToName(hid_t refobj_id, hid_t fid; H5G_stat_t refstat; /* Stat for the refobj id */ H5G_stat_t objstat; /* Stat for objects in the file */ - int i; + unsigned int i; /* obtain information to identify the referenced object uniquely */ if(H5Gget_objinfo(refobj_id, ".", 0, &refstat) <0) diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index 60a0336..a525e0d 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -32,7 +32,7 @@ int aux_find_obj(const char* name, /* object name from traverse list */ { char *pdest; int result; - int i; + unsigned int i; for ( i=0; i<options->op_tbl->nelems; i++) { diff --git a/tools/h5repack/h5repack_list.c b/tools/h5repack/h5repack_list.c index 9912732..cb9cad9 100644 --- a/tools/h5repack/h5repack_list.c +++ b/tools/h5repack/h5repack_list.c @@ -39,7 +39,7 @@ int check_objects(const char* fname, pack_opt_t *options) { hid_t fid; - int i; + unsigned int i; trav_table_t *travt=NULL; /*------------------------------------------------------------------------- diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c index a0b1698..c77837e 100644 --- a/tools/h5repack/h5repack_opttable.c +++ b/tools/h5repack/h5repack_opttable.c @@ -122,7 +122,7 @@ static void aux_tblinsert_layout(pack_opttbl_t *table, static int aux_inctable(pack_opttbl_t *table, int n_objs ) { - int i; + unsigned int i; table->size += n_objs; table->objs = (pack_info_t*)realloc(table->objs, table->size * sizeof(pack_info_t)); @@ -149,7 +149,7 @@ static int aux_inctable(pack_opttbl_t *table, int n_objs ) int options_table_init( pack_opttbl_t **tbl ) { - int i; + unsigned int i; pack_opttbl_t* table = (pack_opttbl_t*) malloc(sizeof(pack_opttbl_t)); if (table==NULL) { error_msg(progname, "not enough memory for options table\n"); @@ -206,7 +206,8 @@ int options_add_layout( obj_list_t *obj_list, pack_info_t *pack, pack_opttbl_t *table ) { - int i, j, I, added=0, found=0; + unsigned int i; + int j, I, added=0, found=0; /* increase the size of the collection by N_OBJS if necessary */ if (table->nelems+n_objs >= table->size) @@ -304,7 +305,8 @@ int options_add_filter(obj_list_t *obj_list, pack_opttbl_t *table ) { - int i, j, I, added=0, found=0; + unsigned int i; + int j, I, added=0, found=0; /* increase the size of the collection by N_OBJS if necessary */ if (table->nelems+n_objs >= table->size) @@ -387,7 +389,7 @@ int options_add_filter(obj_list_t *obj_list, pack_info_t* options_get_object( const char *path, pack_opttbl_t *table ) { - int i; + unsigned int i; for ( i = 0; i < table->nelems; i++) { diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index a19f9f6..2247171 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -173,7 +173,9 @@ int h5repack_verify(const char *fname, hid_t dset_id=-1; /* dataset ID */ hid_t dcpl_id=-1; /* dataset creation property list ID */ hid_t space_id=-1; /* space ID */ - int ret=1, i, j; + int ret=1; + unsigned int i; + int j; trav_table_t *travt=NULL; /* open the file */ @@ -355,7 +357,8 @@ int h5repack_cmpdcpl(const char *fname1, hid_t dcpl2=-1; /* dataset creation property list ID */ trav_table_t *travt1=NULL; trav_table_t *travt2=NULL; - int ret=1, i; + int ret=1; + unsigned int i; /*------------------------------------------------------------------------- * open the files first; if they are not valid, no point in continuing diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index 801ed5a..df231aa 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -98,7 +98,7 @@ int make_nbit(hid_t loc_id); int make_scaleoffset(hid_t loc_id); int make_all(hid_t loc_id); int make_fill(hid_t loc_id); -int make_big(hid_t loc_id); +int make_big(hid_t loc_id, int set_chunk); int make_testfiles(void); void write_dset_in(hid_t loc_id,const char* dset_name,hid_t file_id,int make_diffs ); void write_attr_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs ); @@ -1448,12 +1448,12 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- - * create a big file + * create a big dataset *------------------------------------------------------------------------- */ if((loc_id = H5Fcreate(FNAME14,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) return -1; - if (make_big(loc_id)<0) + if (make_big(loc_id, 1)<0) goto out; if(H5Fclose(loc_id)<0) return -1; @@ -2554,13 +2554,14 @@ out: /*------------------------------------------------------------------------- * Function: make_big * - * Purpose: used in test read by hyperslabs. create a dataset with 1GB dimensions - * by iterating trough 1MB hyperslabs + * Purpose: used in test read by hyperslabs. Can create 1GB datasets, either with + * chunk layout or with contiguous layout, by iterating trough 1MB hyperslabs. + * Only 1 hyperslab is written. Only the chunk case is called. * *------------------------------------------------------------------------- */ -int make_big(hid_t loc_id) +int make_big(hid_t loc_id, int set_chunk) { hid_t did=-1; hid_t f_sid=-1; @@ -2577,17 +2578,25 @@ int make_big(hid_t loc_id) char *buf=NULL; int i, j, s; char c; + char name[20]; + + strcpy(name,"conti"); /* create */ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) goto out; if (H5Pset_fill_value(dcpl, H5T_NATIVE_CHAR, &fillvalue)<0) goto out; - if(H5Pset_chunk(dcpl, 1, chunk_dims)<0) - goto out; + + if (set_chunk) + { + strcpy(name,"chunk"); + if(H5Pset_chunk(dcpl, 1, chunk_dims)<0) + goto out; + } if ((f_sid = H5Screate_simple(1,dims,NULL))<0) goto out; - if ((did = H5Dcreate(loc_id,"big",H5T_NATIVE_CHAR,f_sid,dcpl))<0) + if ((did = H5Dcreate(loc_id,name,H5T_NATIVE_CHAR,f_sid,dcpl))<0) goto out; if ((m_sid = H5Screate_simple(1, hs_size, hs_size))<0) goto out; diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 7907d38..bc0f7cc 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -382,7 +382,7 @@ hsize_t diff_match (hid_t file1_id, unsigned infile[2]; char c1, c2; hsize_t nfound = 0; - int i; + unsigned i; /*------------------------------------------------------------------------- * build the list diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index dc145ec..4ef495d 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -146,15 +146,15 @@ int h5trav_getindex( const char *obj, int nobjs, trav_info_t *info ) void h5trav_freeinfo( trav_info_t *info, int nobjs ) { int i; - if ( info ) - { - for ( i = 0; i < nobjs; i++) - { - if (info[i].name) - HDfree( info[i].name ); - } - HDfree(info); - } + if ( info ) + { + for ( i = 0; i < nobjs; i++) + { + if (info[i].name) + HDfree( info[i].name ); + } + HDfree(info); + } } @@ -625,7 +625,7 @@ void h5trav_printinfo(int nobjs, trav_info_t *travi) */ void h5trav_printtable(trav_table_t *table) { - int i, j; + unsigned int i, j; for ( i = 0; i < table->nobjs; i++) { @@ -678,7 +678,7 @@ int h5trav_getindext(const char *name, trav_table_t *table) { char *pdest; int result; - int i, j; + unsigned int i, j; for ( i = 0; i < table->nobjs; i++) { diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h index 40fa63d..4befcde 100644 --- a/tools/lib/h5trav.h +++ b/tools/lib/h5trav.h @@ -21,16 +21,16 @@ * public struct to store name and type of an object * the TYPE can be: * H5G_UNKNOWN = -1, - * H5G_GROUP, Object is a group - * H5G_DATASET, Object is a dataset - * H5G_TYPE, Object is a named data type - * H5G_LINK, Object is a symbolic link + * H5G_GROUP, Object is a group + * H5G_DATASET, Object is a dataset + * H5G_TYPE, Object is a named data type + * H5G_LINK, Object is a symbolic link *------------------------------------------------------------------------- */ typedef struct trav_info_t { - char *name; - H5G_obj_t type; + char *name; + H5G_obj_t type; } trav_info_t; @@ -39,7 +39,7 @@ typedef struct trav_info_t { *------------------------------------------------------------------------- */ typedef struct trav_link_t { - char *new_name; + char *new_name; } trav_link_t; @@ -56,7 +56,7 @@ typedef struct trav_obj_t { H5G_obj_t type; /* type of object */ trav_link_t *links; /* array of possible link names */ int sizelinks; /* size of links array */ - int nlinks; /* number of links */ + unsigned nlinks; /* number of links */ } trav_obj_t; @@ -66,9 +66,9 @@ typedef struct trav_obj_t { */ typedef struct trav_table_t { - int size; - int nobjs; - trav_obj_t *objs; + unsigned size; + unsigned nobjs; + trav_obj_t *objs; } trav_table_t; diff --git a/tools/lib/h5trav_table.c b/tools/lib/h5trav_table.c index 2ebcd6b..5fb8c75 100644 --- a/tools/lib/h5trav_table.c +++ b/tools/lib/h5trav_table.c @@ -32,7 +32,7 @@ int trav_table_search(haddr_t objno, trav_table_t *table ) { - int i; + unsigned int i; for (i = 0; i < table->nobjs; i++) if (table->objs[i].objno == objno) @@ -61,7 +61,7 @@ void trav_table_add(haddr_t objno, H5G_obj_t type, trav_table_t *table) { - int i; + unsigned int i; if (table->nobjs == table->size) { table->size *= 2; @@ -110,7 +110,7 @@ void trav_table_addflags(unsigned *flags, H5G_obj_t type, trav_table_t *table) { - int i; + unsigned int i; if (table->nobjs == table->size) { table->size *= 2; @@ -157,7 +157,7 @@ void trav_table_addflags(unsigned *flags, void trav_table_init( trav_table_t **tbl ) { - int i; + unsigned int i; trav_table_t* table = (trav_table_t*) HDmalloc(sizeof(trav_table_t)); table->size = 20; @@ -197,7 +197,7 @@ void trav_table_init( trav_table_t **tbl ) void trav_table_free( trav_table_t *table ) { - int i, j; + unsigned int i, j; for ( i = 0; i < table->nobjs; i++) { @@ -234,14 +234,14 @@ void trav_table_addlink(trav_table_t *table, int j /* the object index */, char *path ) { - int k; + unsigned int k; /* already inserted */ if (strcmp(table->objs[j].name,path)==0) return; /* allocate space if necessary */ - if (table->objs[j].nlinks == table->objs[j].sizelinks) { + if (table->objs[j].nlinks == (unsigned)table->objs[j].sizelinks) { table->objs[j].sizelinks += 2; table->objs[j].links = (trav_link_t*)HDrealloc(table->objs[j].links, |