diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/src/h5dump/h5dump.c | 2 | ||||
-rw-r--r-- | tools/src/h5import/h5import.c | 2 | ||||
-rw-r--r-- | tools/src/h5stat/h5stat.c | 6 | ||||
-rw-r--r-- | tools/test/h5dump/h5dumpgentest.c | 2 | ||||
-rw-r--r-- | tools/test/h5repack/h5repacktst.c | 2 | ||||
-rw-r--r-- | tools/test/h5repack/testh5repack_detect_szip.c | 4 | ||||
-rw-r--r-- | tools/test/h5stat/h5stat_gentest.c | 14 | ||||
-rw-r--r-- | tools/test/misc/h5clear_gentest.c | 138 | ||||
-rw-r--r-- | tools/test/misc/h5perf_gentest.c | 666 | ||||
-rw-r--r-- | tools/test/misc/talign.c | 10 | ||||
-rw-r--r-- | tools/test/perform/perf.c | 12 | ||||
-rw-r--r-- | tools/test/perform/sio_engine.c | 12 |
12 files changed, 435 insertions, 435 deletions
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index b9e37e8..c93a2eb 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -1722,7 +1722,7 @@ h5_fileaccess(void) for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { memb_fapl[mt] = H5P_DEFAULT; memb_map[mt] = mt; - sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); + HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); memb_name[mt] = sv[mt]; memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); } diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 16c0d8c..1eef5ab 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -3753,7 +3753,7 @@ void setDefaultValues(struct Input *in, int count) in->path.count = 1; HDstrcpy(temp, "dataset"); - sprintf(num, "%d", count); + HDsprintf(num, "%d", count); HDstrcat(temp, num); HDstrcpy(in->path.group[0], temp); diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index bd10e8b..5e9339f 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -1226,7 +1226,7 @@ print_group_info(const iter_t *iter) unsigned long total; /* Total count for various statistics */ unsigned u; /* Local index variable */ - printf("Small groups (with 0 to %u links):\n", sgroups_threshold-1); + HDprintf("Small groups (with 0 to %u links):\n", sgroups_threshold-1); total = 0; for(u = 0; u < (unsigned)sgroups_threshold; u++) { if(iter->num_small_groups[u] > 0) { @@ -1512,7 +1512,7 @@ print_freespace_info(const iter_t *iter) HDfprintf(stdout, "Free-space persist: %s\n", iter->fs_persist ? "TRUE" : "FALSE"); HDfprintf(stdout, "Free-space section threshold: %Hu bytes\n", iter->fs_threshold); - printf("Small size free-space sections (< %u bytes):\n", (unsigned)SIZE_SMALL_SECTS); + HDprintf("Small size free-space sections (< %u bytes):\n", (unsigned)SIZE_SMALL_SECTS); total = 0; for(u = 0; u < SIZE_SMALL_SECTS; u++) { if(iter->num_small_sects[u] > 0) { @@ -1520,7 +1520,7 @@ print_freespace_info(const iter_t *iter) total += iter->num_small_sects[u]; } /* end if */ } /* end for */ - printf("\tTotal # of small size sections: %lu\n", total); + HDprintf("\tTotal # of small size sections: %lu\n", total); HDprintf("Free-space section bins:\n"); diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index cb77771..ef44ebb 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -1987,7 +1987,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of string array", i); + HDsprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of string array", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index 057cbbd..ec8df3c 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -4120,7 +4120,7 @@ int write_dset_in(hid_t loc_id, dbuf = (double*)HDmalloc( size ); if (NULL == dbuf) { - printf ("\nError: Cannot allocate memory for \"arrayd\" data buffer size %dMB.\n", (int) size / 1000000 ); + HDprintf ("\nError: Cannot allocate memory for \"arrayd\" data buffer size %dMB.\n", (int) size / 1000000 ); goto out; } diff --git a/tools/test/h5repack/testh5repack_detect_szip.c b/tools/test/h5repack/testh5repack_detect_szip.c index 6e7a24e..6b86dd5 100644 --- a/tools/test/h5repack/testh5repack_detect_szip.c +++ b/tools/test/h5repack/testh5repack_detect_szip.c @@ -50,10 +50,10 @@ int main(void) #ifdef H5_HAVE_FILTER_SZIP if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { - printf("yes\n"); + HDprintf("yes\n"); return(1); } #endif /* H5_HAVE_FILTER_SZIP */ - printf("no\n"); + HDprintf("no\n"); return(0); } diff --git a/tools/test/h5stat/h5stat_gentest.c b/tools/test/h5stat/h5stat_gentest.c index ae11032..2edfcf6 100644 --- a/tools/test/h5stat/h5stat_gentest.c +++ b/tools/test/h5stat/h5stat_gentest.c @@ -88,7 +88,7 @@ gen_newgrat_file(const char *fname) /* Create NUM_GRPS groups in the root group */ for(i = 1; i <= NUM_GRPS; i++) { - sprintf(name, "%s%d", GROUP_NAME,i); + HDsprintf(name, "%s%d", GROUP_NAME,i); if((gid = H5Gcreate2(fid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; if(H5Gclose(gid) < 0) @@ -109,7 +109,7 @@ gen_newgrat_file(const char *fname) /* Create NUM_ATTRS for the dataset */ for(i = 1; i <= NUM_ATTRS; i++) { - sprintf(attrname, "%s%d", ATTR_NAME,i); + HDsprintf(attrname, "%s%d", ATTR_NAME,i); if((attr_id = H5Acreate2(did, attrname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; if(H5Aclose(attr_id) < 0) @@ -190,7 +190,7 @@ gen_threshold_file(const char *fname) /* Create 11 attributes for the dataset */ for(i = 1; i <= (THRES_NUM+1); i++) { - sprintf(name, "%s%d", THRES_ATTR_NAME,i); + HDsprintf(name, "%s%d", THRES_ATTR_NAME,i); if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; if(H5Aclose(attr_id) < 0) @@ -217,7 +217,7 @@ gen_threshold_file(const char *fname) /* Create 10 attributes for the 2-D dataset */ for(i = 1; i <= THRES_NUM; i++) { - sprintf(name, "%s%d", THRES_ATTR_NAME,i); + HDsprintf(name, "%s%d", THRES_ATTR_NAME,i); if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; if(H5Aclose(attr_id) < 0) @@ -241,7 +241,7 @@ gen_threshold_file(const char *fname) /* Create 10 1-D datasets with non-zero dimension size for the group */ for(i = 1; i <= THRES_NUM; i++) { /* set up dataset name */ - sprintf(name, "%s%d", THRES_DSET_NAME,i); + HDsprintf(name, "%s%d", THRES_DSET_NAME,i); /* Create the dataset */ if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -264,7 +264,7 @@ gen_threshold_file(const char *fname) /* Create 25 attributes for the group */ for(i = 1; i <= THRES_NUM_25; i++) { /* Set up attribute name */ - sprintf(name, "%s%d", THRES_ATTR_GRP_NAME,i); + HDsprintf(name, "%s%d", THRES_ATTR_GRP_NAME,i); /* Create the attribute */ if((attr_id = H5Acreate2(gid, name, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -286,7 +286,7 @@ gen_threshold_file(const char *fname) /* Create 9 1-D datasets with non-zero dimension size for the group */ for(i = 1; i < THRES_NUM; i++) { /* set up dataset name */ - sprintf(name, "%s%d", THRES_DSET_NAME,i); + HDsprintf(name, "%s%d", THRES_DSET_NAME,i); /* Create the dataset */ if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) diff --git a/tools/test/misc/h5clear_gentest.c b/tools/test/misc/h5clear_gentest.c index 7f80c23..96d7e75e7 100644 --- a/tools/test/misc/h5clear_gentest.c +++ b/tools/test/misc/h5clear_gentest.c @@ -15,10 +15,10 @@ /* The HDF5 test files */ const char *FILENAME[] = { - "h5clear_sec2_v3.h5", /* 0 -- sec2 file with superblock version 3 */ - "h5clear_log_v3.h5", /* 1 -- log file with superblock veresion 3 */ - "h5clear_sec2_v0.h5", /* 2 -- sec2 file with superblock version 0 */ - "h5clear_sec2_v2.h5" /* 3 -- sec2 file with superblock version 2 */ + "h5clear_sec2_v3.h5", /* 0 -- sec2 file with superblock version 3 */ + "h5clear_log_v3.h5", /* 1 -- log file with superblock veresion 3 */ + "h5clear_sec2_v0.h5", /* 2 -- sec2 file with superblock version 0 */ + "h5clear_sec2_v2.h5" /* 3 -- sec2 file with superblock version 2 */ }; const char *FILENAME_ENHANCE[] = { @@ -28,12 +28,12 @@ const char *FILENAME_ENHANCE[] = { "h5clear_fsm_persist_user_equal.h5", /* 3: user block, persisting free-space, stored EOA = actual EOF */ "h5clear_fsm_persist_user_greater.h5", /* 4: user block, persisting free-space, stored EOA > actual EOF */ "h5clear_fsm_persist_user_less.h5", /* 5: user block, persisting free-space, stored EOA < actual EOF */ - "h5clear_status_noclose.h5", /* 6 -- v3 superblock, nonzero status_flags, no flush, exit, + "h5clear_status_noclose.h5", /* 6 -- v3 superblock, nonzero status_flags, no flush, exit, stored EOA < actual EOF */ "h5clear_fsm_persist_noclose.h5" /* 7 -- persisting free-space, no flush, exit, stored EOA < actual EOF */ }; -#define KB 1024U +#define KB 1024U #define CACHE_IMAGE_FILE "h5clear_mdc_image.h5" #define DSET "DSET" @@ -42,14 +42,14 @@ const char *FILENAME_ENHANCE[] = { #define USERBLOCK 512 /*------------------------------------------------------------------------- - * Function: gen_cache_image_file + * Function: gen_cache_image_file * - * Purpose: To create a file with cache image feature enabled. + * Purpose: To create a file with cache image feature enabled. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Vailin Choi; March 2017 + * Programmer: Vailin Choi; March 2017 * *------------------------------------------------------------------------- */ @@ -136,9 +136,9 @@ error: } /* gen_cache_image_file() */ /*------------------------------------------------------------------------- - * Function: gen_enhance_files + * Function: gen_enhance_files * - * Purpose: To create the first 6 files in FILENAME_ENHANCE[]: + * Purpose: To create the first 6 files in FILENAME_ENHANCE[]: * (0) FILENAME_ENHANCE[0]: "h5clear_fsm_persist_equal.h5" * (1) FILENAME_ENHANCE[1]: "h5clear_fsm_persist_greater.h5" * (2) FILENAME_ENHANCE[2]: "h5clear_fsm_persist_less.h5" @@ -149,15 +149,15 @@ error: * value to the location where the EOA is stored in the superblock. * Also modify the chksum in the superblock due to this change. * - * The first call to this routine (without user block) will generate + * The first call to this routine (without user block) will generate * the first 3 files. * The second call to this routine (with user block) will generate * the last 3 files. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Vailin Choi; March 2017 + * Programmer: Vailin Choi; March 2017 * *------------------------------------------------------------------------- */ @@ -190,7 +190,7 @@ gen_enhance_files(hbool_t user) if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0) goto error; - /* + /* * Create the file, then write invalid EOA to the file. */ for(i = 0+u; i < 3+u; i++) { @@ -221,21 +221,21 @@ gen_enhance_files(hbool_t user) if(H5Fclose(fid) < 0) goto error; - /* + /* * No further action for: - * --FILENAME_ENHANCE[0]: "h5clear_fsm_persist_equal.h5" + * --FILENAME_ENHANCE[0]: "h5clear_fsm_persist_equal.h5" * --FILENAME_ENHANCE[3]: "h5clear_fsm_persist_user_equal.h5", */ if(!(i % 3)) continue; - /* + /* * For the following files: * --FILENAME_ENHANCE[1]: "h5clear_fsm_persist_greater.h5" * --FILENAME_ENHANCE[2]: "h5clear_fsm_persist_less.h5" * --FILENAME_ENHANCE[4]: "h5clear_fsm_persist_greater.h5" * --FILENAME_ENHANCE[5]: "h5clear_fsm_persist_less.h5" * - * Write invalid value to the location for stored eoa and + * Write invalid value to the location for stored eoa and * update the chksum value. */ /* Open the file */ @@ -306,9 +306,9 @@ error: } /* gen_enhance_files() */ /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Generate test files used by h5clear. + * Purpose: Generate test files used by h5clear. * * (A) gen_cache_image_file(): * --generate a file with cache image feature @@ -317,10 +317,10 @@ error: * --generate the first 6 files in FILENAME_ENHANCE[]: * (0) "h5clear_fsm_persist_equal.h5" * (1) "h5clear_fsm_persist_greater.h5" - * (2) "h5clear_fsm_persist_less.h5" - * (3) "h5clear_fsm_persist_user_equal.h5" + * (2) "h5clear_fsm_persist_less.h5" + * (3) "h5clear_fsm_persist_user_equal.h5" * (4) "h5clear_fsm_persist_user_greater.h5" - * (5) "h5clear_fsm_persist_user_less.h5" + * (5) "h5clear_fsm_persist_user_less.h5" * * (C) Generate the following FILENAME[] files in main(): * (0a) "h5clear_sec2_v3.h5" @@ -328,43 +328,43 @@ error: * (1a) "h5clear_log_v3.h5", * (1b) "latest_h5clear_log_v3.h5" * (2) "h5clear_sec2_v0.h5" - * (3) "h5clear_sec2_v2.h5" - * - * These HDF5 files are created with non-zero status_flags in + * (3) "h5clear_sec2_v2.h5" + * + * These HDF5 files are created with non-zero status_flags in * the superblock via flushing and exiting without closing the * library. - * Due to file locking, status_flags in the superblock will be - * nonzero after H5Fcreate. The library will clear status_flags - * on file closing. + * Due to file locking, status_flags in the superblock will be + * nonzero after H5Fcreate. The library will clear status_flags + * on file closing. * This program, after "H5Fcreate" the files, exits without - * going through library closing. Thus, status_flags for these - * files are not cleared. - * The library will check consistency of status_flags when - * opening a file with superblock >= v3 and will return error + * going through library closing. Thus, status_flags for these + * files are not cleared. + * The library will check consistency of status_flags when + * opening a file with superblock >= v3 and will return error * accordingly. - * The library will not check status_flags when opening a file - * with < v3 superblock. - * These files are used by "h5clear" to see if the tool clears - * status_flags properly so users can open the files afterwards. - * + * The library will not check status_flags when opening a file + * with < v3 superblock. + * These files are used by "h5clear" to see if the tool clears + * status_flags properly so users can open the files afterwards. + * * (D) Generate the last two files in FILENAME_ENHANCE[] in main(): - * (6) "h5clear_status_noclose.h5", + * (6) "h5clear_status_noclose.h5", * (7) "h5clear_fsm_persist_noclose.h5" * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Vailin Choi; July 2013 + * Programmer: Vailin Choi; July 2013 * *------------------------------------------------------------------------- */ int main(void) { - hid_t fid = -1; /* File ID */ - hid_t fcpl = -1; /* File creation property list */ - hid_t fapl = -1, new_fapl = -1; /* File access property lists */ - char fname[512]; /* File name */ + hid_t fid = -1; /* File ID */ + hid_t fcpl = -1; /* File creation property list */ + hid_t fapl = -1, new_fapl = -1; /* File access property lists */ + char fname[512]; /* File name */ unsigned new_format; /* To use latest library format or not */ hid_t sid = -1; /* Dataspace ID */ hid_t did = -1; /* Dataset ID */ @@ -382,7 +382,7 @@ main(void) if(gen_enhance_files(TRUE) < 0) goto error; - /* + /* * Generate files in FILENAME[] */ /* Create a copy of the file access property list */ @@ -396,13 +396,13 @@ main(void) if(H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) goto error; - /* + /* * Files created within this for loop will have v3 superblock and nonzero status_flags * --FILENAME[0]: "h5clear_sec2_v3.h5", "latest_h5clear_sec2_v3.h5" * --FILENAME[1]: "h5clear_log_v3.h5", "latest_h5clear_log_v3.h5" */ for(new_format = FALSE; new_format <= TRUE; new_format++) { - hid_t fapl2, my_fapl; /* File access property lists */ + hid_t fapl2, my_fapl; /* File access property lists */ /* Set to use the appropriate file access property list */ if(new_format) @@ -415,14 +415,14 @@ main(void) if((my_fapl = H5Pcopy(fapl2)) < 0) goto error; /* Create the file */ - sprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[0]); - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, my_fapl)) < 0) + HDsprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[0]); + if((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, my_fapl)) < 0) goto error; /* Flush the file */ if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) goto error; - + /* Close the property list */ if(H5Pclose(my_fapl) < 0) goto error; @@ -439,8 +439,8 @@ main(void) goto error; /* Create the file */ - sprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[1]); - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, my_fapl)) < 0) + HDsprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[1]); + if((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, my_fapl)) < 0) goto error; /* Flush the file */ @@ -453,11 +453,11 @@ main(void) } /* end for */ - /* + /* * Create a sec2 file with v0 superblock but nonzero status_flags: * FILENAME[2]: "h5clear_sec2_v0.h5" */ - if((fid = H5Fcreate(FILENAME[2], H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if((fid = H5Fcreate(FILENAME[2], H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; /* Flush the file */ @@ -465,9 +465,9 @@ main(void) goto error; - /* + /* * Create a sec2 file with v2 superblock but nonzero status_flags: - * FILENAME[3]: "h5clear_sec2_v2.h5" + * FILENAME[3]: "h5clear_sec2_v2.h5" */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) goto error; @@ -476,14 +476,14 @@ main(void) if(H5Pset_shared_mesg_index(fcpl, 0, H5O_SHMESG_DTYPE_FLAG, 50) < 0) goto error; - if((fid = H5Fcreate(FILENAME[3], H5F_ACC_TRUNC, fcpl, fapl)) < 0) + if((fid = H5Fcreate(FILENAME[3], H5F_ACC_TRUNC, fcpl, fapl)) < 0) goto error; /* Flush the file */ if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) goto error; - + /* Close the property lists */ if(H5Pclose(fapl) < 0) goto error; @@ -492,10 +492,10 @@ main(void) if(H5Pclose(fcpl) < 0) goto error; - /* + /* * Create the last two files in FILENAME_ENHANCE[]: * --FILENAME_ENHANCE[6]: h5clear_status_noclose.h5 - * --FILENAME_ENHANCE[7]: h5clear_fsm_persist_noclose.h5 + * --FILENAME_ENHANCE[7]: h5clear_fsm_persist_noclose.h5 */ /* * FILENAME_ENHANCE[6]: h5clear_status_noclose.h5 @@ -503,7 +503,7 @@ main(void) * --version 3 superblock * --nonzero status_flags * --does not persist free-space - * --does not flush the file, just exit without closing file: + * --does not flush the file, just exit without closing file: * --this file is similar to the user-suppplied test file attached with HDFFV-10347 */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) @@ -542,8 +542,8 @@ main(void) /* Does not flush and does not close the file */ - /* - * FILENAME_ENHANCE[7]: h5clear_fsm_persist_noclose.h5 + /* + * FILENAME_ENHANCE[7]: h5clear_fsm_persist_noclose.h5 * --stored EOA < actual EOF * --persisting free-space * --undefined fsinfo.eoa_pre_fsm_fsalloc diff --git a/tools/test/misc/h5perf_gentest.c b/tools/test/misc/h5perf_gentest.c index 3784278..f50e5fb 100644 --- a/tools/test/misc/h5perf_gentest.c +++ b/tools/test/misc/h5perf_gentest.c @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /***************************************************************************** - This test generates attributes, groups, and datasets of many types. It - creates a large number of attributes, groups, and datasets by specifying + This test generates attributes, groups, and datasets of many types. It + creates a large number of attributes, groups, and datasets by specifying -a, -g, -d options respectively. Using "-h" option to see details. Programmer: Peter Cao <xcao@hdfgroup.org>, Jan. 2013 @@ -31,7 +31,7 @@ #define MAXVLEN 10 #define FIXED_LEN 8 -typedef enum { SOLID=0, LIQUID, GAS, PLASMA } phase_t; +typedef enum { SOLID=0, LIQUID, GAS, PLASMA } phase_t; typedef struct { int i; @@ -43,24 +43,24 @@ typedef struct { float f_array[FIXED_LEN]; hvl_t i_vlen; char *s_vlen; -} test_comp_t; +} test_comp_t; typedef struct { int zipcode; char *city; -} zipcode_t; +} zipcode_t; int add_attrs(hid_t oid, int idx); int add_attr(hid_t oid, const char *name, hid_t tid, hid_t sid, void *buf) ; -herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, - int nattrs, hsize_t nrows, hsize_t dim0, hsize_t chunk, int vlen, - int compressed, int latest); +herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, + int nattrs, hsize_t nrows, hsize_t dim0, hsize_t chunk, int vlen, + int compressed, int latest); int main (int argc, char *argv[]) { char fname[32]; - int i, ngrps=NGROUPS, ndsets=NDSETS, nattrs=NATTRS, dim0=DIM0, - chunk=DIM0/10+1, nrows=NROWS, vlen=MAXVLEN, l=0, z=0; + int i, ngrps=NGROUPS, ndsets=NDSETS, nattrs=NATTRS, dim0=DIM0, + chunk=DIM0/10+1, nrows=NROWS, vlen=MAXVLEN, l=0, z=0; memset(fname, 0, 32); for (i=1; i<argc; i++) { @@ -83,92 +83,92 @@ int main (int argc, char *argv[]) else if (strcmp(argv[i], "-l")==0) l = 1; else if (strcmp(argv[i], "-z")==0) - z = 1; + z = 1; else if (strcmp(argv[i], "-h")==0) { - printf("\nOPTONS:\n"); - printf("\t-f F:\tname of the test file (default: %s).\n", FNAME); - printf("\t-g N:\tnumber of top level groups (default: %d).\n", NGROUPS); - printf("\t-d N:\tnumber of datasets (default: %d).\n", NDSETS); - printf("\t-a N:\tnumber of attributes (default: %d).\n", NATTRS); - printf("\t-r N:\tnumber of rows in the large compound dataset (default: %d).\n", NROWS); - printf("\t-s N:\tsize of dim0 in datasets (default: %d).\n", DIM0); - printf("\t-c N:\tchunk size of dim0 (default: %d).\n", (DIM0/10+1)); - printf("\t-v N:\tmax vlen size (default: %d).\n", MAXVLEN); - printf("\t-l:\tuse latest format (default: no).\n"); - printf("\t-z:\tuse gzip compression (default: no).\n"); - printf("\t-h:\tthis help information.\n"); - printf("Example:\n"); - printf("\t./a.out -f test.h5 -g 10000 -d 5000 -a 500 -r 10000 -s 200 -c 20 -v 40 -l -z\n\n"); + HDprintf("\nOPTONS:\n"); + HDprintf("\t-f F:\tname of the test file (default: %s).\n", FNAME); + HDprintf("\t-g N:\tnumber of top level groups (default: %d).\n", NGROUPS); + HDprintf("\t-d N:\tnumber of datasets (default: %d).\n", NDSETS); + HDprintf("\t-a N:\tnumber of attributes (default: %d).\n", NATTRS); + HDprintf("\t-r N:\tnumber of rows in the large compound dataset (default: %d).\n", NROWS); + HDprintf("\t-s N:\tsize of dim0 in datasets (default: %d).\n", DIM0); + HDprintf("\t-c N:\tchunk size of dim0 (default: %d).\n", (DIM0/10+1)); + HDprintf("\t-v N:\tmax vlen size (default: %d).\n", MAXVLEN); + HDprintf("\t-l:\tuse latest format (default: no).\n"); + HDprintf("\t-z:\tuse gzip compression (default: no).\n"); + HDprintf("\t-h:\tthis help information.\n"); + HDprintf("Example:\n"); + HDprintf("\t./a.out -f test.h5 -g 10000 -d 5000 -a 500 -r 10000 -s 200 -c 20 -v 40 -l -z\n\n"); exit(0); } } - + if (strlen(fname)<=0) - sprintf(fname, FNAME); + HDsprintf(fname, FNAME); + + create_perf_test_file(fname, ngrps, ndsets, nattrs, (hsize_t)nrows, + (hsize_t)dim0, (hsize_t)chunk, vlen, z, l); - create_perf_test_file(fname, ngrps, ndsets, nattrs, (hsize_t)nrows, - (hsize_t)dim0, (hsize_t)chunk, vlen, z, l); - return 0; } /***************************************************************************** - This function generates attributes, groups, and datasets of many types. + This function generates attributes, groups, and datasets of many types. Parameters: - fname: file_name. - ngrps: number of top level groups. - ndsets: number of datasets. - attrs: number of attributes. - nrow: number of rows in a dataset. - chunk: chunk size (single number). - vlen: max vlen size. - comp: use latest format. - latest: use gzip comnpression. - + fname: file_name. + ngrps: number of top level groups. + ndsets: number of datasets. + attrs: number of attributes. + nrow: number of rows in a dataset. + chunk: chunk size (single number). + vlen: max vlen size. + comp: use latest format. + latest: use gzip comnpression. + Return: Non-negative on success/Negative on failure - + Programmer: Peter Cao <xcao@hdfgroup.org>, Jan. 2013 ****************************************************************************/ -herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, - int nattrs, hsize_t nrows, hsize_t dim0, hsize_t chunk, int vlen, - int compressed, int latest) +herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, + int nattrs, hsize_t nrows, hsize_t dim0, hsize_t chunk, int vlen, + int compressed, int latest) { int i, j, k; - hid_t fid, sid_null, sid_scalar, sid_1d, sid_2d, did, aid, sid_2, sid_large, - fapl=H5P_DEFAULT, dcpl=H5P_DEFAULT, gid1, gid2, cmp_tid, tid_str, - tid_enum, tid_array_f, tid_vlen_i, tid_vlen_s; + hid_t fid, sid_null, sid_scalar, sid_1d, sid_2d, did, aid, sid_2, sid_large, + fapl=H5P_DEFAULT, dcpl=H5P_DEFAULT, gid1, gid2, cmp_tid, tid_str, + tid_enum, tid_array_f, tid_vlen_i, tid_vlen_s; char name[32], tmp_name1[32], tmp_name2[32], tmp_name3[32]; - hsize_t dims[1]={dim0}, dims2d[2]={dim0, (dim0/4+1)}, dims_array[1]={FIXED_LEN}, - dim1[1]={2}; + hsize_t dims[1]={dim0}, dims2d[2]={dim0, (dim0/4+1)}, dims_array[1]={FIXED_LEN}, + dim1[1]={2}; char *enum_names[4] = {"SOLID", "LIQUID", "GAS", "PLASMA"}; test_comp_t *buf_comp=NULL, *buf_comp_large=NULL; int *buf_int=NULL; float (*buf_float_a)[FIXED_LEN]=NULL; double **buf_double2d=NULL; hvl_t *buf_vlen_i=NULL; - char (*buf_str)[FIXED_LEN]; - char **buf_vlen_s=NULL; - hobj_ref_t buf_ref[2]; - hdset_reg_ref_t buf_reg_ref[2]; + char (*buf_str)[FIXED_LEN]; + char **buf_vlen_s=NULL; + hobj_ref_t buf_ref[2]; + hdset_reg_ref_t buf_reg_ref[2]; size_t offset, len; herr_t status; - char *names[NTYPES] = { "int", "ulong", "float", "double", "fixed string", - "enum", "fixed float array", "vlen int array", "vlen strings"}; - hid_t types[NTYPES] = { H5T_NATIVE_INT, H5T_NATIVE_UINT64, H5T_NATIVE_FLOAT, + char *names[NTYPES] = { "int", "ulong", "float", "double", "fixed string", + "enum", "fixed float array", "vlen int array", "vlen strings"}; + hid_t types[NTYPES] = { H5T_NATIVE_INT, H5T_NATIVE_UINT64, H5T_NATIVE_FLOAT, H5T_NATIVE_DOUBLE, tid_str, tid_enum, tid_array_f, tid_vlen_i, tid_vlen_s}; - hsize_t coords[4][2] = { {0, 1}, {3, 5}, {1, 0}, {2, 4}}, start=0, stride=1, count=1; - - if (nrows < NROWS) nrows = NROWS; + hsize_t coords[4][2] = { {0, 1}, {3, 5}, {1, 0}, {2, 4}}, start=0, stride=1, count=1; + + if (nrows < NROWS) nrows = NROWS; if (ngrps<NGROUPS) ngrps=NGROUPS; - if (ndsets<NDSETS) ndsets=NDSETS; - if (nattrs<NATTRS) nattrs=NATTRS; - if (dim0<DIM0) dim0=DIM0; + if (ndsets<NDSETS) ndsets=NDSETS; + if (nattrs<NATTRS) nattrs=NATTRS; + if (dim0<DIM0) dim0=DIM0; if (chunk>dim0) chunk=dim0/4; if (chunk<1) chunk = 1; - if (vlen<1) vlen = MAXVLEN; + if (vlen<1) vlen = MAXVLEN; - /* create fixed string datatype */ + /* create fixed string datatype */ types[4] = tid_str = H5Tcopy (H5T_C_S1); H5Tset_size (tid_str, FIXED_LEN); @@ -181,15 +181,15 @@ herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, /* create float array datatype */ types[6] = tid_array_f = H5Tarray_create (H5T_NATIVE_FLOAT, 1, dims_array); - + /* create variable length integer datatypes */ types[7] = tid_vlen_i = H5Tvlen_create (H5T_NATIVE_INT); - + /* create variable length string datatype */ types[8] = tid_vlen_s = H5Tcopy (H5T_C_S1); H5Tset_size (tid_vlen_s, H5T_VARIABLE); - - /* create compound datatypes */ + + /* create compound datatypes */ cmp_tid = H5Tcreate (H5T_COMPOUND, sizeof (test_comp_t)); offset = 0; for (i=0; i<NTYPES-2; i++) { @@ -197,31 +197,31 @@ herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, offset += H5Tget_size(types[i]); } - H5Tinsert(cmp_tid, names[7], offset, types[7]); - offset += sizeof (hvl_t); - H5Tinsert(cmp_tid, names[8], offset, types[8]); + H5Tinsert(cmp_tid, names[7], offset, types[7]); + offset += sizeof (hvl_t); + H5Tinsert(cmp_tid, names[8], offset, types[8]); - /* create dataspace */ + /* create dataspace */ sid_1d = H5Screate_simple (1, dims, NULL); sid_2d = H5Screate_simple (2, dims2d, NULL); sid_2 = H5Screate_simple (1, dim1, NULL); - sid_large = H5Screate_simple (1, &nrows, NULL); - sid_null = H5Screate (H5S_NULL); - sid_scalar = H5Screate (H5S_SCALAR); - - /* create fid access property */ - fapl = H5Pcreate (H5P_FILE_ACCESS); + sid_large = H5Screate_simple (1, &nrows, NULL); + sid_null = H5Screate (H5S_NULL); + sid_scalar = H5Screate (H5S_SCALAR); + + /* create fid access property */ + fapl = H5Pcreate (H5P_FILE_ACCESS); H5Pset_libver_bounds (fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); - /* create dataset creation property */ + /* create dataset creation property */ dcpl = H5Pcreate (H5P_DATASET_CREATE); - /* set dataset chunk */ + /* set dataset chunk */ if (chunk>0) { H5Pset_chunk (dcpl, 1, &chunk); } - /* set dataset compression */ + /* set dataset compression */ if (compressed) { if (chunk<=0) { chunk = dim0/10+1;; @@ -229,54 +229,54 @@ herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, } H5Pset_shuffle (dcpl); H5Pset_deflate (dcpl, 6); - } + } - /* allocate buffers */ + /* allocate buffers */ buf_comp = (test_comp_t *)calloc(dim0, sizeof(test_comp_t)); buf_comp_large = (test_comp_t *)calloc(nrows, sizeof(test_comp_t)); buf_int = (int *)calloc(dim0, sizeof(int)); buf_float_a = malloc(dim0*sizeof(*buf_float_a)); - buf_vlen_i = (hvl_t *)calloc(dim0, sizeof (hvl_t)); + buf_vlen_i = (hvl_t *)calloc(dim0, sizeof (hvl_t)); buf_vlen_s = (char **)calloc(dim0, sizeof(char *)); - buf_str = malloc(dim0*sizeof (*buf_str)); + buf_str = malloc(dim0*sizeof (*buf_str)); - /* allocate array of doulbe pointers */ - buf_double2d = (double **)calloc(dims2d[0],sizeof(double *)); - /* allocate a contigous chunk of memory for the data */ - buf_double2d[0] = (double *)calloc( dims2d[0]*dims2d[1],sizeof(double) ); - /* assign memory city to pointer array */ - for (i=1; i <dims2d[0]; i++) buf_double2d[i] = buf_double2d[0]+i*dims2d[1]; + /* allocate array of doulbe pointers */ + buf_double2d = (double **)calloc(dims2d[0],sizeof(double *)); + /* allocate a contigous chunk of memory for the data */ + buf_double2d[0] = (double *)calloc( dims2d[0]*dims2d[1],sizeof(double) ); + /* assign memory city to pointer array */ + for (i=1; i <dims2d[0]; i++) buf_double2d[i] = buf_double2d[0]+i*dims2d[1]; - /* fill buffer values */ - len = 1; + /* fill buffer values */ + len = 1; for (i=0; i<dims[0]; i++) { buf_comp[i].i = buf_int[i] = i-2147483648; buf_comp[i].l = 0xffffffffffffffff-i; buf_comp[i].f = 1.0/(i+1.0); buf_comp[i].d = 987654321.0*i+1.0/(i+1.0); buf_comp[i].e = (phase_t) (i % (int) (PLASMA + 1)); - - for (j=0; j<FIXED_LEN; j++) { - buf_comp[i].f_array[j] = buf_float_a[i][j] = i*100+j; - buf_str[i][j] = 'a' + (i%26); - } - buf_str[i][FIXED_LEN-1] = 0; + + for (j=0; j<FIXED_LEN; j++) { + buf_comp[i].f_array[j] = buf_float_a[i][j] = i*100+j; + buf_str[i][j] = 'a' + (i%26); + } + buf_str[i][FIXED_LEN-1] = 0; strcpy(buf_comp[i].s, buf_str[i]); - - len = (1-cos(i/8.0))/2*vlen+1; - if (!i) len = vlen; - buf_vlen_i[i].len = len; - buf_vlen_i[i].p = (int *)calloc(len, sizeof(int)); - for (j=0; j<len; j++) ((int*)(buf_vlen_i[i].p))[j] = i*100+j; - buf_comp[i].i_vlen = buf_vlen_i[i]; - - buf_vlen_s[i] = (char *)calloc(len, sizeof(char)); - for (j=0; j<len-1; j++) - buf_vlen_s[i][j] = j%26+'A'; - buf_comp[i].s_vlen = buf_vlen_s[i]; - - for (j=0; j<dims2d[1]; j++) - buf_double2d[i][j] = i+j/10000.0; + + len = (1-cos(i/8.0))/2*vlen+1; + if (!i) len = vlen; + buf_vlen_i[i].len = len; + buf_vlen_i[i].p = (int *)calloc(len, sizeof(int)); + for (j=0; j<len; j++) ((int*)(buf_vlen_i[i].p))[j] = i*100+j; + buf_comp[i].i_vlen = buf_vlen_i[i]; + + buf_vlen_s[i] = (char *)calloc(len, sizeof(char)); + for (j=0; j<len-1; j++) + buf_vlen_s[i][j] = j%26+'A'; + buf_comp[i].s_vlen = buf_vlen_s[i]; + + for (j=0; j<dims2d[1]; j++) + buf_double2d[i][j] = i+j/10000.0; } for (i=0; i<nrows; i++) { @@ -289,147 +289,147 @@ herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, buf_comp_large[i].f_array[j] = i*100+j; buf_comp_large[i].s[j] = 'a' + (i%26); } - len = i%vlen+1; + len = i%vlen+1; buf_comp_large[i].i_vlen.len = len; buf_comp_large[i].i_vlen.p = (int *)calloc(len, sizeof(int)); for (j=0; j<len; j++) ((int*)(buf_comp_large[i].i_vlen.p))[j] = i*100+j; buf_comp_large[i].s_vlen = (char *)calloc(i+2, sizeof(char)); for (j=0; j<i+1; j++) (buf_comp_large[i].s_vlen)[j] = j%26+'A'; } - - /* create file */ + + /* create file */ if (latest) fid = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); else fid = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - add_attrs(fid, 0); + add_attrs(fid, 0); - sprintf(name, "a cmp ds of %d rows", nrows); - did = H5Dcreate (fid, name, cmp_tid, sid_large, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, cmp_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_comp_large); - add_attrs(did, 0); - H5Dclose(did); + HDsprintf(name, "a cmp ds of %d rows", nrows); + did = H5Dcreate (fid, name, cmp_tid, sid_large, H5P_DEFAULT, dcpl, H5P_DEFAULT); + H5Dwrite (did, cmp_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_comp_large); + add_attrs(did, 0); + H5Dclose(did); - // /* add attributes*/ + // /* add attributes*/ gid1 = H5Gcreate (fid, "attributes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (nattrs<1) nattrs = 1; - i=0; - while (i<nattrs) i += add_attrs(gid1, i); - H5Gclose(gid1); - - /* add many sub groups to a group*/ + if (nattrs<1) nattrs = 1; + i=0; + while (i<nattrs) i += add_attrs(gid1, i); + H5Gclose(gid1); + + /* add many sub groups to a group*/ gid1 = H5Gcreate (fid, "groups", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - add_attrs(gid1, 0); + add_attrs(gid1, 0); for (i=0; i<ngrps; i++) { - /* create sub groups */ - sprintf(name, "g%02d", i); + /* create sub groups */ + HDsprintf(name, "g%02d", i); gid2 = H5Gcreate (gid1, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (i<10) add_attrs(gid2, 0); - H5Gclose(gid2); - } - H5Gclose(gid1); - - /* add many datasets to a group */ - gid1 = H5Gcreate (fid, "datasets", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - add_attrs(gid1, 0); + if (i<10) add_attrs(gid2, 0); + H5Gclose(gid2); + } + H5Gclose(gid1); + + /* add many datasets to a group */ + gid1 = H5Gcreate (fid, "datasets", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + add_attrs(gid1, 0); for (j=0; j<ndsets; j+=12) { - /* 1 add a null dataset */ - sprintf(name, "%05d null dataset", j); + /* 1 add a null dataset */ + HDsprintf(name, "%05d null dataset", j); did = H5Dcreate (gid1, name, H5T_STD_I32LE, sid_null, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (!j) add_attrs(did, j); - H5Dclose(did); + if (!j) add_attrs(did, j); + H5Dclose(did); - /* 2 add scalar int point */ - sprintf(name, "%05d scalar int point", j); + /* 2 add scalar int point */ + HDsprintf(name, "%05d scalar int point", j); did = H5Dcreate (gid1, name, H5T_NATIVE_INT, sid_scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite (did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &j); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 3 scalar vlen string */ - sprintf(name, "%05d scalar vlen string", j); + H5Dwrite (did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &j); + if (!j) add_attrs(did, j); + H5Dclose(did); + + /* 3 scalar vlen string */ + HDsprintf(name, "%05d scalar vlen string", j); did = H5Dcreate (gid1, name, tid_vlen_s, sid_scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite (did, tid_vlen_s, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buf_vlen_s[0]); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 4 add fixed-length float array */ - sprintf(name, "%05d fixed-length float array", j); - did = H5Dcreate (gid1, name, tid_array_f, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, tid_array_f, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_float_a); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 5 add fixed-length strings */ - sprintf(name, "%05d fixed-length strings", j); - did = H5Dcreate (gid1, name, tid_str, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, tid_str, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_str); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 6 add compound data */ - sprintf(name, "%05d compund data", j); - did = H5Dcreate (gid1, name, cmp_tid, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, cmp_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_comp); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 7 add 2D double */ - sprintf(name, "%05d 2D double", j); - strcpy (tmp_name1, name); - did = H5Dcreate (gid1, name, H5T_NATIVE_DOUBLE, sid_2d, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite (did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_double2d[0]); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 8 add 1D int array */ - sprintf(name, "%05d 1D int array", j); + H5Dwrite (did, tid_vlen_s, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buf_vlen_s[0]); + if (!j) add_attrs(did, j); + H5Dclose(did); + + /* 4 add fixed-length float array */ + HDsprintf(name, "%05d fixed-length float array", j); + did = H5Dcreate (gid1, name, tid_array_f, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); + H5Dwrite (did, tid_array_f, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_float_a); + if (!j) add_attrs(did, j); + H5Dclose(did); + + /* 5 add fixed-length strings */ + HDsprintf(name, "%05d fixed-length strings", j); + did = H5Dcreate (gid1, name, tid_str, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); + H5Dwrite (did, tid_str, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_str); + if (!j) add_attrs(did, j); + H5Dclose(did); + + /* 6 add compound data */ + HDsprintf(name, "%05d compund data", j); + did = H5Dcreate (gid1, name, cmp_tid, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); + H5Dwrite (did, cmp_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_comp); + if (!j) add_attrs(did, j); + H5Dclose(did); + + /* 7 add 2D double */ + HDsprintf(name, "%05d 2D double", j); + strcpy (tmp_name1, name); + did = H5Dcreate (gid1, name, H5T_NATIVE_DOUBLE, sid_2d, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite (did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_double2d[0]); + if (!j) add_attrs(did, j); + H5Dclose(did); + + /* 8 add 1D int array */ + HDsprintf(name, "%05d 1D int array", j); did = H5Dcreate (gid1, name, H5T_NATIVE_INT, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_int); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 9 add vlen int array */ - sprintf(name, "%05d vlen int array", j); - strcpy (tmp_name2, name); + H5Dwrite (did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_int); + if (!j) add_attrs(did, j); + H5Dclose(did); + + /* 9 add vlen int array */ + HDsprintf(name, "%05d vlen int array", j); + strcpy (tmp_name2, name); did = H5Dcreate (gid1, name, tid_vlen_i, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, tid_vlen_i, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_vlen_i); - if (!j) add_attrs(did, j); - H5Dclose(did); + H5Dwrite (did, tid_vlen_i, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_vlen_i); + if (!j) add_attrs(did, j); + H5Dclose(did); - /* 10 add vlen strings */ - sprintf(name, "%05d vlen strings", j); - strcpy (tmp_name3, name); + /* 10 add vlen strings */ + HDsprintf(name, "%05d vlen strings", j); + strcpy (tmp_name3, name); did = H5Dcreate (gid1, name, tid_vlen_s, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, tid_vlen_s, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_vlen_s); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 11 add object refs */ - H5Rcreate(&buf_ref[0],gid1, ".", H5R_OBJECT, (hid_t)-1); - H5Rcreate(&buf_ref[1],gid1, tmp_name3, H5R_OBJECT, (hid_t)-1); - sprintf(name, "%05d obj refs", j); + H5Dwrite (did, tid_vlen_s, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_vlen_s); + if (!j) add_attrs(did, j); + H5Dclose(did); + + /* 11 add object refs */ + H5Rcreate(&buf_ref[0],gid1, ".", H5R_OBJECT, (hid_t)-1); + H5Rcreate(&buf_ref[1],gid1, tmp_name3, H5R_OBJECT, (hid_t)-1); + HDsprintf(name, "%05d obj refs", j); did = H5Dcreate (gid1, name, H5T_STD_REF_OBJ, sid_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite (did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_ref); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 12 add region refs */ - H5Sselect_elements (sid_2d, H5S_SELECT_SET, 4, coords[0]); - H5Rcreate(&buf_reg_ref[0],gid1, tmp_name1, H5R_DATASET_REGION, sid_2d); - H5Sselect_none(sid_2d); - count = dims[0]/2+1; - H5Sselect_hyperslab (sid_1d, H5S_SELECT_SET, &start, &stride, &count,NULL); - H5Rcreate(&buf_reg_ref[1],gid1, tmp_name2, H5R_DATASET_REGION, sid_1d); - H5Sselect_none(sid_1d); - sprintf(name, "%05d region refs", j); + H5Dwrite (did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_ref); + if (!j) add_attrs(did, j); + H5Dclose(did); + + /* 12 add region refs */ + H5Sselect_elements (sid_2d, H5S_SELECT_SET, 4, coords[0]); + H5Rcreate(&buf_reg_ref[0],gid1, tmp_name1, H5R_DATASET_REGION, sid_2d); + H5Sselect_none(sid_2d); + count = dims[0]/2+1; + H5Sselect_hyperslab (sid_1d, H5S_SELECT_SET, &start, &stride, &count,NULL); + H5Rcreate(&buf_reg_ref[1],gid1, tmp_name2, H5R_DATASET_REGION, sid_1d); + H5Sselect_none(sid_1d); + HDsprintf(name, "%05d region refs", j); did = H5Dcreate (gid1, name, H5T_STD_REF_DSETREG, sid_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite (did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_reg_ref); - if (!j) add_attrs(did, j); - H5Dclose(did); - } - H5Gclose(gid1); - + H5Dwrite (did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_reg_ref); + if (!j) add_attrs(did, j); + H5Dclose(did); + } + H5Gclose(gid1); + H5Tclose (tid_array_f); H5Tclose (tid_vlen_i); H5Tclose (tid_vlen_s); @@ -447,22 +447,22 @@ herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, H5Fclose (fid); for (i=0; i<dims[0]; i++) { - if (buf_vlen_i[i].p) free(buf_vlen_i[i].p); - if (buf_vlen_s[i]) free(buf_vlen_s[i]); - } + if (buf_vlen_i[i].p) free(buf_vlen_i[i].p); + if (buf_vlen_s[i]) free(buf_vlen_s[i]); + } for (i=0; i<nrows; i++) { - if (buf_comp_large[i].i_vlen.p) free(buf_comp_large[i].i_vlen.p); - if (buf_comp_large[i].s_vlen) free(buf_comp_large[i].s_vlen); - } - + if (buf_comp_large[i].i_vlen.p) free(buf_comp_large[i].i_vlen.p); + if (buf_comp_large[i].s_vlen) free(buf_comp_large[i].s_vlen); + } + free (buf_comp); free (buf_comp_large); free (buf_int); free (buf_float_a); free (buf_double2d[0]); free (buf_double2d); - free (buf_str); + free (buf_str); free(buf_vlen_i); free(buf_vlen_s); @@ -470,34 +470,34 @@ herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, } /* add a single attribute */ -int add_attr(hid_t oid, const char *name, hid_t tid, hid_t sid, void *buf) +int add_attr(hid_t oid, const char *name, hid_t tid, hid_t sid, void *buf) { hid_t aid; aid = H5Acreate (oid, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT); - if (aid <0) - return 0; - - H5Awrite(aid, tid, buf); + if (aid <0) + return 0; + + H5Awrite(aid, tid, buf); H5Aclose(aid); - - return 1; + + return 1; } -/* +/* adds different types of attributes to an object. - - returns the number of attributes added to the objects. + + returns the number of attributes added to the objects. */ -int add_attrs(hid_t oid, int idx) +int add_attrs(hid_t oid, int idx) { char name[32]; int i0, i1, i2, j, nattrs=0; - hid_t aid, tid, tid1, sid; + hid_t aid, tid, tid1, sid; hvl_t i_vlen[4]; - hobj_ref_t ref; - zipcode_t cmp_data[4]; + hobj_ref_t ref; + zipcode_t cmp_data[4]; unsigned int i = 0xffffffff; long long l = -2147483647; float f = 123456789.987654321; @@ -505,22 +505,22 @@ int add_attrs(hid_t oid, int idx) char *s[7] = {"Parting", "is such", "sweeter", "sorrow."}; float f_array[4] = {1.0, 2.22, 3.333, 4.444}; char *s_vlen[4] = {"Parting", "is such", "sweet", "sorrow."}; - hsize_t dims1[1]={1}, dims2[1]={4}, dims3[2]={3,5}; - int int3d[4][3][5]; - size_t offset = 0; - - for (i0=0; i0<4; i0++) { - i_vlen[i0].len = (i0+1); - i_vlen[i0].p = (int *)calloc(i_vlen[i0].len, sizeof(int)); - for (j=0; j<i_vlen[i0].len; j++) - ((int *)i_vlen[i0].p)[j] = i0*100+j; - for (i1=0; i1<3; i1++) { - for (i2=0; i2<5; i2++) - int3d[i0][i1][i2] = i0*i1-i1*i2+i0*i2; - } + hsize_t dims1[1]={1}, dims2[1]={4}, dims3[2]={3,5}; + int int3d[4][3][5]; + size_t offset = 0; + + for (i0=0; i0<4; i0++) { + i_vlen[i0].len = (i0+1); + i_vlen[i0].p = (int *)calloc(i_vlen[i0].len, sizeof(int)); + for (j=0; j<i_vlen[i0].len; j++) + ((int *)i_vlen[i0].p)[j] = i0*100+j; + for (i1=0; i1<3; i1++) { + for (i2=0; i2<5; i2++) + int3d[i0][i1][i2] = i0*i1-i1*i2+i0*i2; + } } - cmp_data[0].zipcode = 01001; + cmp_data[0].zipcode = 01001; cmp_data[0].city = "Agawam, Massachusetts"; cmp_data[1].zipcode = 99950; cmp_data[1].city = "Ketchikan, Alaska"; @@ -528,82 +528,82 @@ int add_attrs(hid_t oid, int idx) cmp_data[2].city = "Holtsville, New York"; cmp_data[3].zipcode = 61820; cmp_data[3].city = "Champaign, Illinois"; - - /* 1 scalar point */ - sid = H5Screate (H5S_SCALAR); - sprintf(name, "%05d scalar int", idx); - nattrs += add_attr(oid, name, H5T_NATIVE_UINT, sid, &i); - sprintf(name, "%05d scalar ulong", idx); - nattrs += add_attr(oid, name, H5T_NATIVE_INT64, sid, &l); - sprintf(name, "%05d scalar str", idx); - tid = H5Tcopy (H5T_C_S1); + + /* 1 scalar point */ + sid = H5Screate (H5S_SCALAR); + HDsprintf(name, "%05d scalar int", idx); + nattrs += add_attr(oid, name, H5T_NATIVE_UINT, sid, &i); + HDsprintf(name, "%05d scalar ulong", idx); + nattrs += add_attr(oid, name, H5T_NATIVE_INT64, sid, &l); + HDsprintf(name, "%05d scalar str", idx); + tid = H5Tcopy (H5T_C_S1); H5Tset_size (tid, H5T_VARIABLE); - nattrs += add_attr(oid, name, tid, sid, &s[2]); - H5Tclose(tid); - H5Sclose(sid); + nattrs += add_attr(oid, name, tid, sid, &s[2]); + H5Tclose(tid); + H5Sclose(sid); - /* 4 single point */ - sid = H5Screate_simple (1, dims1, NULL); + /* 4 single point */ + sid = H5Screate_simple (1, dims1, NULL); H5Rcreate(&ref, oid, ".", H5R_OBJECT, (hid_t)-1); - sprintf(name, "%05d single float", idx); - nattrs += add_attr(oid, name, H5T_NATIVE_FLOAT, sid, &f); - sprintf(name, "%05d single double", idx); - nattrs += add_attr(oid, name, H5T_NATIVE_DOUBLE, sid, &d); - sprintf(name, "%05d single obj_ref", idx); - nattrs += add_attr(oid, name, H5T_STD_REF_OBJ, sid, &ref); - H5Sclose(sid); - - /* 7 fixed length 1D array */ - sid = H5Screate_simple (1, dims1, NULL); - tid = H5Tarray_create (H5T_NATIVE_FLOAT, 1, dims2); - sprintf(name, "%05d array float", idx); + HDsprintf(name, "%05d single float", idx); + nattrs += add_attr(oid, name, H5T_NATIVE_FLOAT, sid, &f); + HDsprintf(name, "%05d single double", idx); + nattrs += add_attr(oid, name, H5T_NATIVE_DOUBLE, sid, &d); + HDsprintf(name, "%05d single obj_ref", idx); + nattrs += add_attr(oid, name, H5T_STD_REF_OBJ, sid, &ref); + H5Sclose(sid); + + /* 7 fixed length 1D array */ + sid = H5Screate_simple (1, dims1, NULL); + tid = H5Tarray_create (H5T_NATIVE_FLOAT, 1, dims2); + HDsprintf(name, "%05d array float", idx); nattrs += add_attr(oid, name, tid, sid, &f_array[0]); - H5Tclose(tid); - tid = H5Tcopy (H5T_C_S1); - H5Tset_size (tid, strlen(s[0])+1); - tid1 = H5Tarray_create (tid, 1, dims2); - sprintf(name, "%05d array str", idx); - nattrs += add_attr(oid, name, tid1, sid, s); - H5Tclose(tid1); - H5Tclose(tid); - H5Sclose(sid); - - /* 9 fixed length 2D int arrays */ - sid = H5Screate_simple (1, dims2, NULL); - tid = H5Tarray_create (H5T_NATIVE_INT, 2, dims3); - sprintf(name, "%05d array int 2D", idx); + H5Tclose(tid); + tid = H5Tcopy (H5T_C_S1); + H5Tset_size (tid, strlen(s[0])+1); + tid1 = H5Tarray_create (tid, 1, dims2); + HDsprintf(name, "%05d array str", idx); + nattrs += add_attr(oid, name, tid1, sid, s); + H5Tclose(tid1); + H5Tclose(tid); + H5Sclose(sid); + + /* 9 fixed length 2D int arrays */ + sid = H5Screate_simple (1, dims2, NULL); + tid = H5Tarray_create (H5T_NATIVE_INT, 2, dims3); + HDsprintf(name, "%05d array int 2D", idx); nattrs += add_attr(oid, name, tid, sid, int3d[0][0]); - H5Tclose(tid); - H5Sclose(sid); - - /* 10 variable length arrays */ - sid = H5Screate_simple (1, dims2, NULL); - tid = H5Tcopy (H5T_C_S1); - H5Tset_size (tid, H5T_VARIABLE); - sprintf(name, "%05d vlen strings", idx); + H5Tclose(tid); + H5Sclose(sid); + + /* 10 variable length arrays */ + sid = H5Screate_simple (1, dims2, NULL); + tid = H5Tcopy (H5T_C_S1); + H5Tset_size (tid, H5T_VARIABLE); + HDsprintf(name, "%05d vlen strings", idx); nattrs += add_attr(oid, name, tid, sid, s_vlen); - H5Tclose(tid); - tid = H5Tvlen_create (H5T_NATIVE_INT);; - sprintf(name, "%05d vlen int array", idx); + H5Tclose(tid); + tid = H5Tvlen_create (H5T_NATIVE_INT);; + HDsprintf(name, "%05d vlen int array", idx); nattrs += add_attr(oid, name, tid, sid, i_vlen); - H5Tclose(tid); - H5Sclose(sid); - - /* 12 compound data */ - sid = H5Screate_simple (1, dims2, NULL); - tid = H5Tcreate (H5T_COMPOUND, sizeof (zipcode_t)); - tid1 = H5Tcopy (H5T_C_S1); - H5Tset_size (tid1, H5T_VARIABLE); + H5Tclose(tid); + H5Sclose(sid); + + /* 12 compound data */ + sid = H5Screate_simple (1, dims2, NULL); + tid = H5Tcreate (H5T_COMPOUND, sizeof (zipcode_t)); + tid1 = H5Tcopy (H5T_C_S1); + H5Tset_size (tid1, H5T_VARIABLE); H5Tinsert (tid, "zip code", 0, H5T_NATIVE_INT); offset += sizeof(H5T_NATIVE_INT); H5Tinsert (tid, "City", offset, tid1); offset += sizeof(char *); - sprintf(name, "%05d compound data", idx); + HDsprintf(name, "%05d compound data", idx); nattrs += add_attr(oid, name, tid, sid, cmp_data); - H5Tclose(tid1); - H5Tclose(tid); - H5Sclose(sid); - - for (i0=0; i0<4; i0++) - free(i_vlen[i0].p); - - return nattrs; + H5Tclose(tid1); + H5Tclose(tid); + H5Sclose(sid); + + for (i0=0; i0<4; i0++) + free(i_vlen[i0].p); + + return nattrs; } diff --git a/tools/test/misc/talign.c b/tools/test/misc/talign.c index 08ebfc7..944674d 100644 --- a/tools/test/misc/talign.c +++ b/tools/test/misc/talign.c @@ -51,7 +51,7 @@ int main(void) int result = 0; herr_t error = 1; - printf("%-70s", "Testing alignment in compound datatypes"); + HDprintf("%-70s", "Testing alignment in compound datatypes"); strcpy(string5, "Hi!"); HDunlink(fname); @@ -145,7 +145,7 @@ out: result = 1; mname = H5Tget_member_name(fix, 0); - printf("%14s (%2d) %6s = %s\n", + HDprintf("%14s (%2d) %6s = %s\n", mname ? mname : "(null)", (int)H5Tget_member_offset(fix,0), string5, (char *)(data + H5Tget_member_offset(fix, 0))); if(mname) @@ -153,7 +153,7 @@ out: fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); mname = H5Tget_member_name(fix, 1); - printf("Data comparison:\n" + HDprintf("Data comparison:\n" "%14s (%2d) %6f = %f\n" " %6f = %f\n", mname ? mname : "(null)", (int)H5Tget_member_offset(fix,1), @@ -164,7 +164,7 @@ out: fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 2))); mname = H5Tget_member_name(fix, 2); - printf("%14s (%2d) %6f = %f\n" + HDprintf("%14s (%2d) %6f = %f\n" " %6f = %6f\n", mname ? mname : "(null)", (int)H5Tget_member_offset(fix,2), (double)fnok[0], (double)fptr[0], @@ -173,7 +173,7 @@ out: H5free_memory(mname); fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); - printf("\n" + HDprintf("\n" "Short circuit\n" " %6f = %f\n" " %6f = %f\n" diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c index 1d52471..34b8a2d 100644 --- a/tools/test/perform/perf.c +++ b/tools/test/perform/perf.c @@ -64,13 +64,13 @@ #define H5FATAL 1 #define VRFY(val, mesg, fatal) do { \ if (!val) { \ - printf("Proc %d: ", mynod); \ + printf("Proc %d: ", mynod); \ printf("*** Assertion failed (%s) at line %4d in %s\n", \ - mesg, (int)__LINE__, __FILE__); \ - if (fatal){ \ - fflush(stdout); \ - goto die_jar_jar_die; \ - } \ + mesg, (int)__LINE__, __FILE__); \ + if (fatal){ \ + fflush(stdout); \ + goto die_jar_jar_die; \ + } \ } \ } while(0) #define RANK 1 diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c index ed15fa5..aefd2b3 100644 --- a/tools/test/perform/sio_engine.c +++ b/tools/test/perform/sio_engine.c @@ -264,7 +264,7 @@ done: case HDF5: if (fd.h5fd != -1) hrc = do_fclose(iot, &fd); - break; + break; default: /* unknown request */ HDassert(0 && "Unknown IO type"); @@ -685,7 +685,7 @@ dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer) VRFY((hrc >= 0), "H5Dwrite"); break; - + default: /* unknown request */ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type); @@ -863,7 +863,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) GOTOERROR(FAIL); } break; - + default: /* unknown request */ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type); @@ -987,7 +987,7 @@ dset_read(int local_dim, file_descr *fd, parameters *parms, void *buffer, h5dset_space_id, h5dxpl, buffer); VRFY((hrc >= 0), "H5Dread"); break; - + default: /* unknown request */ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type); @@ -1114,7 +1114,7 @@ do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags) GOTOERROR(FAIL); } break; - + default: /* unknown request */ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)param->io_type); @@ -1242,7 +1242,7 @@ do_fclose(iotype iot, file_descr *fd /*out*/) fd->h5fd = -1; break; - + default: /* unknown request */ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot); |