summaryrefslogtreecommitdiffstats
path: root/examples/h5dsm_dset_wpartial.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2016-12-07 21:56:51 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2016-12-07 21:56:51 (GMT)
commit5eb7d11b53c783b104650420cfa2ba4ea1db6144 (patch)
tree3afe48c89e59ff3277535fa03e067366da81c70f /examples/h5dsm_dset_wpartial.c
parent340b4658a42567dfd5595721de349e7d5a55ed3a (diff)
downloadhdf5-5eb7d11b53c783b104650420cfa2ba4ea1db6144.zip
hdf5-5eb7d11b53c783b104650420cfa2ba4ea1db6144.tar.gz
hdf5-5eb7d11b53c783b104650420cfa2ba4ea1db6144.tar.bz2
Fix memory leak in H5VL_daosm_dataset_write, bug in
H5VL_daosm_file_open, bug in h5dsm_dset_wpartial, and add separate transactions in h5dsm_dset_wpartial.
Diffstat (limited to 'examples/h5dsm_dset_wpartial.c')
-rw-r--r--examples/h5dsm_dset_wpartial.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/examples/h5dsm_dset_wpartial.c b/examples/h5dsm_dset_wpartial.c
index 22b8178..9558fb3 100644
--- a/examples/h5dsm_dset_wpartial.c
+++ b/examples/h5dsm_dset_wpartial.c
@@ -11,7 +11,7 @@ int main(int argc, char *argv[]) {
uint64_t trans_num;
int buf[4][6];
int rank, mpi_size;
- char *file_sel_str[2] = {"XXX...", "...XXX");
+ char *file_sel_str[2] = {"XXX...", "...XXX"};
int i, j;
(void)MPI_Init(&argc, &argv);
@@ -58,7 +58,7 @@ int main(int argc, char *argv[]) {
if(rank == 1)
MPI_Barrier(MPI_COMM_WORLD);
- printf("Rank %d:\n");
+ printf("---------------Rank %d---------------\n", rank);
printf("Selecting elements denoted with X\n");
printf("Memory File\n");
printf("...... %s\n", file_sel_str[rank]);
@@ -96,14 +96,24 @@ int main(int argc, char *argv[]) {
if(H5Sselect_hyperslab(mem_space, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
ERROR;
+ if(rank == 1) {
+ MPI_Barrier(MPI_COMM_WORLD);
+ if(H5TRclose(trans) < 0)
+ ERROR;
+ if((trans = H5TRcreate(file, trans_num + 2)) < 0)
+ ERROR;
+ }
+
/* Write data */
if(H5Dwrite_ff(dset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf, trans) < 0)
ERROR;
- /* Commit transaction */
if(H5TRcommit(trans) < 0)
ERROR;
+ if(rank == 0)
+ MPI_Barrier(MPI_COMM_WORLD);
+
/* Close */
if(H5Dclose_ff(dset, -1) < 0)
ERROR;