diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-10-08 19:59:36 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-10-08 19:59:36 (GMT) |
commit | 16683943c6edb42f9129cc5d6c8f340c74014dad (patch) | |
tree | d1ed13b0b7677e56d4253b4fe5e0640f851e27ca /perform | |
parent | d3ee3988b68292524b3a893b9db55c074f4b9e87 (diff) | |
download | hdf5-16683943c6edb42f9129cc5d6c8f340c74014dad.zip hdf5-16683943c6edb42f9129cc5d6c8f340c74014dad.tar.gz hdf5-16683943c6edb42f9129cc5d6c8f340c74014dad.tar.bz2 |
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
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')
-rw-r--r-- | perform/chunk.c | 12 | ||||
-rw-r--r-- | perform/perf.c | 148 | ||||
-rw-r--r-- | perform/perf_meta.c | 8 | ||||
-rw-r--r-- | perform/pio_engine.c | 9 |
4 files changed, 87 insertions, 90 deletions
diff --git a/perform/chunk.c b/perform/chunk.c index 0c3209d..a3aabe0 100644 --- a/perform/chunk.c +++ b/perform/chunk.c @@ -210,9 +210,9 @@ test_rowmaj (int op, size_t cache_size, size_t io_size) #endif H5Pset_cache (fapl_g, mdc_nelmts, rdcc_nelmts, cache_size*SQUARE (CH_SIZE), w0); - file = H5Fopen (FILE_NAME, H5F_ACC_RDWR, fapl_g); - dset = H5Dopen (file, "dset"); - file_space = H5Dget_space (dset); + file = H5Fopen(FILE_NAME, H5F_ACC_RDWR, fapl_g); + dset = H5Dopen2(file, "dset", H5P_DEFAULT); + file_space = H5Dget_space(dset); nio_g = 0; for (i=0; i<CH_SIZE*DS_SIZE; i+=io_size) { @@ -287,9 +287,9 @@ test_diag (int op, size_t cache_size, size_t io_size, size_t offset) #endif H5Pset_cache (fapl_g, mdc_nelmts, rdcc_nelmts, cache_size*SQUARE (CH_SIZE), w0); - file = H5Fopen (FILE_NAME, H5F_ACC_RDWR, fapl_g); - dset = H5Dopen (file, "dset"); - file_space = H5Dget_space (dset); + file = H5Fopen(FILE_NAME, H5F_ACC_RDWR, fapl_g); + dset = H5Dopen2(file, "dset", H5P_DEFAULT); + file_space = H5Dget_space(dset); nio_g = 0; for (i=0, hs_size[0]=io_size; hs_size[0]==io_size; i+=offset) { diff --git a/perform/perf.c b/perform/perf.c index 30f2ccf..cd7473d 100644 --- a/perform/perf.c +++ b/perform/perf.c @@ -209,37 +209,37 @@ int main(int argc, char **argv) file_dataspace = H5Dget_space (dataset); VRFY((file_dataspace >= 0), "H5Dget_space succeeded", H5FATAL); - /* now each process writes a block of opt_block chars in round robbin - * fashion until the whole dataset is covered. - */ - for (j=0; j < opt_iter; j++) { - /* setup a file dataspace selection */ - start[0] = (j*iter_jump)+(mynod*opt_block); - stride[0] = block[0] = opt_block; - count[0]= 1; - ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL); - - if (opt_correct) /* fill in buffer for iteration */ { - for (i=mynod+j, check=buf; i<opt_block; i++,check++) *check=(char)i; - } + /* now each process writes a block of opt_block chars in round robbin + * fashion until the whole dataset is covered. + */ + for(j=0; j < opt_iter; j++) { + /* setup a file dataspace selection */ + start[0] = (j*iter_jump)+(mynod*opt_block); + stride[0] = block[0] = opt_block; + count[0]= 1; + ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL); - /* discover the starting time of the operation */ - MPI_Barrier(MPI_COMM_WORLD); - stim = MPI_Wtime(); + if (opt_correct) /* fill in buffer for iteration */ { + for (i=mynod+j, check=buf; i<opt_block; i++,check++) *check=(char)i; + } - /* write data */ - ret = H5Dwrite(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, - H5P_DEFAULT, buf); - VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL); + /* discover the starting time of the operation */ + MPI_Barrier(MPI_COMM_WORLD); + stim = MPI_Wtime(); - /* discover the ending time of the operation */ - etim = MPI_Wtime(); + /* write data */ + ret = H5Dwrite(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, + H5P_DEFAULT, buf); + VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL); - write_tim += (etim - stim); + /* discover the ending time of the operation */ + etim = MPI_Wtime(); - /* we are done with this "write" iteration */ - } + write_tim += (etim - stim); + + /* we are done with this "write" iteration */ + } /* close dataset and file */ ret=H5Dclose(dataset); @@ -249,67 +249,65 @@ int main(int argc, char **argv) - /* wait for everyone to synchronize at this point */ - MPI_Barrier(MPI_COMM_WORLD); + /* wait for everyone to synchronize at this point */ + MPI_Barrier(MPI_COMM_WORLD); /* reopen the file for reading */ fid=H5Fopen(opt_file,H5F_ACC_RDONLY,acc_tpl); VRFY((fid >= 0), "", H5FATAL); /* open the dataset */ - dataset = H5Dopen(fid, "Dataset1"); + dataset = H5Dopen2(fid, "Dataset1", H5P_DEFAULT); VRFY((dataset >= 0), "H5Dopen succeeded", H5FATAL); /* we can re-use the same mem_dataspace and file_dataspace * the H5Dwrite used since the dimension size is the same. */ - /* we are going to repeat the read the same pattern the write used */ - for (j=0; j < opt_iter; j++) { - /* setup a file dataspace selection */ - start[0] = (j*iter_jump)+(mynod*opt_block); - stride[0] = block[0] = opt_block; - count[0]= 1; - ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL); - /* seek to the appropriate spot give the current iteration and - * rank within the MPI processes */ - - /* discover the start time */ - MPI_Barrier(MPI_COMM_WORLD); - stim = MPI_Wtime(); - - /* read data */ - /* read in the file data */ - if (!opt_correct){ - ret = H5Dread(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, - H5P_DEFAULT, buf); - } - else{ - ret = H5Dread(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, - H5P_DEFAULT, buf2); - } - myerrno = errno; - /* discover the end time */ - etim = MPI_Wtime(); - read_tim += (etim - stim); - VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL); - - - if (ret < 0) fprintf(stderr, "node %d, read error, loc = %Ld: %s\n", - mynod, mynod*opt_block, strerror(myerrno)); - - /* if the user wanted to check correctness, compare the write - * buffer to the read buffer */ - if (opt_correct && memcmp(buf, buf2, opt_block)) { - fprintf(stderr, "node %d, correctness test failed\n", mynod); - my_correct = 0; - MPI_Allreduce(&my_correct, &correct, 1, MPI_INT, MPI_MIN, - MPI_COMM_WORLD); - } - - /* we are done with this read iteration */ - } + /* we are going to repeat the read the same pattern the write used */ + for (j=0; j < opt_iter; j++) { + /* setup a file dataspace selection */ + start[0] = (j*iter_jump)+(mynod*opt_block); + stride[0] = block[0] = opt_block; + count[0]= 1; + ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL); + /* seek to the appropriate spot give the current iteration and + * rank within the MPI processes */ + + /* discover the start time */ + MPI_Barrier(MPI_COMM_WORLD); + stim = MPI_Wtime(); + + /* read in the file data */ + if (!opt_correct){ + ret = H5Dread(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, H5P_DEFAULT, buf); + } + else{ + ret = H5Dread(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, H5P_DEFAULT, buf2); + } + myerrno = errno; + + /* discover the end time */ + etim = MPI_Wtime(); + read_tim += (etim - stim); + VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL); + + + if (ret < 0) fprintf(stderr, "node %d, read error, loc = %Ld: %s\n", + mynod, mynod*opt_block, strerror(myerrno)); + + /* if the user wanted to check correctness, compare the write + * buffer to the read buffer */ + if (opt_correct && memcmp(buf, buf2, opt_block)) { + fprintf(stderr, "node %d, correctness test failed\n", mynod); + my_correct = 0; + MPI_Allreduce(&my_correct, &correct, 1, MPI_INT, MPI_MIN, + MPI_COMM_WORLD); + } + + /* we are done with this read iteration */ + } /* close dataset and file */ ret=H5Dclose(dataset); diff --git a/perform/perf_meta.c b/perform/perf_meta.c index 7093717..dd73140 100644 --- a/perform/perf_meta.c +++ b/perform/perf_meta.c @@ -366,7 +366,7 @@ create_attrs_1(void) char attr_name[128]; int i, j; p_time attr_t = {0, 0, 0, 1000000, 0, ""}; - p_time open_t = {0, 0, 0, 1000000, 0, "H5Dopen"}; + p_time open_t = {0, 0, 0, 1000000, 0, "H5Dopen2"}; p_time close_t = {0, 0, 0, 1000000, 0, ""}; #ifdef H5_HAVE_PARALLEL @@ -391,7 +391,7 @@ create_attrs_1(void) 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 = H5Dopen2(file, dset_name, H5P_DEFAULT)) < 0) goto error; perf(&open_t, open_t.start, retrieve_time()); @@ -578,7 +578,7 @@ create_attrs_3(void) int loop_num; int i, j, k; p_time attr_t = {0, 0, 0, 1000000, 0, ""}; - p_time open_t = {0, 0, 0, 1000000, 0, "H5Dopen"}; + p_time open_t = {0, 0, 0, 1000000, 0, "H5Dopen2"}; p_time close_t = {0, 0, 0, 1000000, 0, ""}; #ifdef H5_HAVE_PARALLEL @@ -607,7 +607,7 @@ create_attrs_3(void) 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) + if((dataset = H5Dopen2(file, dset_name, H5P_DEFAULT)) < 0) goto error; perf(&open_t, open_t.start, retrieve_time()); diff --git a/perform/pio_engine.c b/perform/pio_engine.c index be94cc7..23c3edd 100644 --- a/perform/pio_engine.c +++ b/perform/pio_engine.c @@ -1667,12 +1667,12 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, break; } /* end switch */ - for (ndset = 1; ndset <= ndsets; ++ndset) { + for(ndset = 1; ndset <= ndsets; ++ndset) { /* Calculate dataset offset within a file */ /* create dataset */ - switch (parms->io_type) { + switch(parms->io_type) { case POSIXIO: case MPIO: /* both posix and mpi io just need dataset offset in file*/ @@ -1681,12 +1681,11 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, case PHDF5: sprintf(dname, "Dataset_%ld", ndset); - h5ds_id = H5Dopen(fd->h5fd, dname); - if (h5ds_id < 0) { + h5ds_id = H5Dopen2(fd->h5fd, dname, H5P_DEFAULT); + if(h5ds_id < 0) { fprintf(stderr, "HDF5 Dataset open failed\n"); GOTOERROR(FAIL); } - break; } |