diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-10-04 22:19:07 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-10-04 22:19:07 (GMT) |
commit | 1de51c7bc148b9cb5104936dfd23096a222d0cb8 (patch) | |
tree | b23ea23404fd02a41f4539ebbc8311a1c43fecbe /perform/perf_meta.c | |
parent | 041de441c5d7468812be8af1346b30db6ea94e3a (diff) | |
download | hdf5-1de51c7bc148b9cb5104936dfd23096a222d0cb8.zip hdf5-1de51c7bc148b9cb5104936dfd23096a222d0cb8.tar.gz hdf5-1de51c7bc148b9cb5104936dfd23096a222d0cb8.tar.bz2 |
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Diffstat (limited to 'perform/perf_meta.c')
-rw-r--r-- | perform/perf_meta.c | 153 |
1 files changed, 82 insertions, 71 deletions
diff --git a/perform/perf_meta.c b/perform/perf_meta.c index 7676974..7093717 100644 --- a/perform/perf_meta.c +++ b/perform/perf_meta.c @@ -379,38 +379,42 @@ create_attrs_1(void) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, - fapl))<0) + fapl)) < 0) goto error; - if(create_dsets(file)<0) + if(create_dsets(file) < 0) goto error; /* * Create all(user specifies the number) attributes for each dataset */ - for(i=0; i<NUM_DSETS; i++) { + for(i = 0; i < NUM_DSETS; i++) { sprintf(dset_name, "dataset %d", i); open_t.start = retrieve_time(); - if((dataset=H5Dopen(file, dset_name))<0) + if((dataset = H5Dopen(file, dset_name)) < 0) goto error; perf(&open_t, open_t.start, retrieve_time()); - for(j=0; j<NUM_ATTRS; j++) { - sprintf(attr_name, "all attrs for each dset %d", j); - attr_t.start = retrieve_time(); - if((attr = H5Acreate(dataset, attr_name, H5T_NATIVE_DOUBLE, - small_space, H5P_DEFAULT)) < 0) - goto error; - if (H5Aclose(attr) < 0) goto error; - perf(&attr_t, attr_t.start, retrieve_time()); - if(flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL)<0) goto error; - } + for(j = 0; j < NUM_ATTRS; j++) { + sprintf(attr_name, "all attrs for each dset %d", j); + attr_t.start = retrieve_time(); + if((attr = H5Acreate2(dataset, ".", attr_name, H5T_NATIVE_DOUBLE, + small_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if(H5Aclose(attr) < 0) + goto error; + perf(&attr_t, attr_t.start, retrieve_time()); + if(flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL) < 0) + goto error; + } /* end for */ close_t.start = retrieve_time(); - if(H5Dclose(dataset)<0) goto error; + if(H5Dclose(dataset) < 0) + goto error; perf(&close_t, close_t.start, retrieve_time()); - if(flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error; - } + if(flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0) + goto error; + } /* end for */ if(facc_type == FACC_MPIO || facc_type == FACC_MPIPOSIX) { #ifdef H5_HAVE_PARALLEL @@ -434,7 +438,7 @@ create_attrs_1(void) print_perf(open_t, close_t, attr_t); } - if (H5Fclose(file)<0) goto error; + if (H5Fclose(file) < 0) goto error; return 0; @@ -480,36 +484,40 @@ create_attrs_2(void) h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) + if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; /* * Create all(user specifies the number) attributes for each new dataset */ - for(i=0; i<NUM_DSETS; i++) { + for(i = 0; i < NUM_DSETS; i++) { sprintf(dset_name, "dataset %d", i); create_t.start = retrieve_time(); if((dataset = H5Dcreate(file, dset_name, H5T_NATIVE_DOUBLE, - space, H5P_DEFAULT)) < 0) - goto error; + space, H5P_DEFAULT)) < 0) + goto error; perf(&create_t, create_t.start, retrieve_time()); - for(j=0; j<NUM_ATTRS; j++) { - sprintf(attr_name, "all attrs for each dset %d", j); - attr_t.start = retrieve_time(); - if((attr = H5Acreate(dataset, attr_name, H5T_NATIVE_DOUBLE, - small_space, H5P_DEFAULT)) < 0) - goto error; - if (H5Aclose(attr) < 0) goto error; - perf(&attr_t, attr_t.start, retrieve_time()); - if(flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error; - } + for(j = 0; j < NUM_ATTRS; j++) { + sprintf(attr_name, "all attrs for each dset %d", j); + attr_t.start = retrieve_time(); + if((attr = H5Acreate2(dataset, ".", attr_name, H5T_NATIVE_DOUBLE, + small_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if(H5Aclose(attr) < 0) + goto error; + perf(&attr_t, attr_t.start, retrieve_time()); + if(flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL) < 0) + goto error; + } /* end for */ close_t.start = retrieve_time(); - if(H5Dclose(dataset)<0) goto error; + if(H5Dclose(dataset) < 0) + goto error; perf(&close_t, close_t.start, retrieve_time()); - if(flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error; - } + if(flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0) + goto error; + } /* end for */ if(facc_type == FACC_MPIO || facc_type == FACC_MPIPOSIX) { #ifdef H5_HAVE_PARALLEL @@ -534,7 +542,7 @@ create_attrs_2(void) print_perf(create_t, close_t, attr_t); } - if (H5Fclose(file)<0) goto error; + if (H5Fclose(file) < 0) goto error; return 0; @@ -583,10 +591,10 @@ create_attrs_3(void) h5_fixname(FILENAME[2], fapl, filename, sizeof filename); if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, - fapl))<0) + fapl)) < 0) goto error; - if(create_dsets(file)<0) + if(create_dsets(file) < 0) goto error; /* @@ -595,32 +603,35 @@ create_attrs_3(void) */ loop_num = NUM_ATTRS/BATCH_ATTRS; - for(i=0; i<loop_num; i++) { - for(j=0; j<NUM_DSETS; j++) { - sprintf(dset_name, "dataset %d", j); - open_t.start = retrieve_time(); - if((dataset = H5Dopen(file, dset_name)) < 0) - goto error; - perf(&open_t, open_t.start, retrieve_time()); - - for(k=0; k<BATCH_ATTRS; k++) { - sprintf(attr_name, "some attrs for each dset %d %d", - i, k); - attr_t.start = retrieve_time(); - if((attr = H5Acreate(dataset, attr_name, - H5T_NATIVE_DOUBLE, small_space, H5P_DEFAULT)) - < 0) goto error; - if (H5Aclose(attr) < 0) goto error; - perf(&attr_t, attr_t.start, retrieve_time()); - if(flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error; - } - - close_t.start = retrieve_time(); - if(H5Dclose(dataset)<0) goto error; - perf(&close_t, close_t.start, retrieve_time()); - if(flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error; - } - } + for(i = 0; i < loop_num; i++) { + for(j = 0; j < NUM_DSETS; j++) { + sprintf(dset_name, "dataset %d", j); + open_t.start = retrieve_time(); + if((dataset = H5Dopen(file, dset_name)) < 0) + goto error; + perf(&open_t, open_t.start, retrieve_time()); + + for(k = 0; k < BATCH_ATTRS; k++) { + sprintf(attr_name, "some attrs for each dset %d %d", i, k); + attr_t.start = retrieve_time(); + if((attr = H5Acreate2(dataset, ".", attr_name, H5T_NATIVE_DOUBLE, + small_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if(H5Aclose(attr) < 0) + goto error; + perf(&attr_t, attr_t.start, retrieve_time()); + if(flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL) < 0) + goto error; + } /* end for */ + + close_t.start = retrieve_time(); + if(H5Dclose(dataset) < 0) + goto error; + perf(&close_t, close_t.start, retrieve_time()); + if(flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0) + goto error; + } /* end for */ + } /* end for */ if(facc_type == FACC_MPIO || facc_type == FACC_MPIPOSIX) { #ifdef H5_HAVE_PARALLEL @@ -644,7 +655,7 @@ create_attrs_3(void) print_perf(open_t, close_t, attr_t); } - if (H5Fclose(file)<0) goto error; + if (H5Fclose(file) < 0) goto error; return 0; @@ -812,17 +823,17 @@ main(int argc, char **argv) #endif /*H5_HAVE_PARALLEL*/ } - nerrors += create_dspace()<0 ?1:0; + nerrors += create_dspace() < 0 ?1:0; if((RUN_TEST & TEST_1) || !RUN_TEST) - nerrors += create_attrs_1()<0 ?1:0; + nerrors += create_attrs_1() < 0 ?1:0; if((RUN_TEST & TEST_2) || !RUN_TEST) - nerrors += create_attrs_2()<0 ?1:0; + nerrors += create_attrs_2() < 0 ?1:0; if(((RUN_TEST & TEST_3) || !RUN_TEST) && BATCH_ATTRS && NUM_ATTRS) - nerrors += create_attrs_3()<0 ?1:0; + nerrors += create_attrs_3() < 0 ?1:0; - if (H5Sclose(space)<0) goto error; - if (H5Sclose(small_space)<0) goto error; + if (H5Sclose(space) < 0) goto error; + if (H5Sclose(small_space) < 0) goto error; h5_cleanup(FILENAME, fapl); |