diff options
-rw-r--r-- | release_docs/RELEASE.txt | 2 | ||||
-rw-r--r-- | src/H5Smpio.c | 79 | ||||
-rw-r--r-- | test/tselect.c | 84 | ||||
-rw-r--r-- | testpar/t_dset.c | 180 |
4 files changed, 285 insertions, 60 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index ce20d25..f7c945d 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -35,6 +35,8 @@ Bug Fixes since HDF5-1.4.0 Library ------- + * Fixed error condition where "none" selections were not being handled + correctly in parallel. QAK - 2002/10/29 * New functions H5Gget_comment(modification), H5Aget_storage_size, H5Arename. SLU - 2002/10/29 * Fixed an assertion of H5S_select_iterate that did not account for scalar diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 125c946..e72a953 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -48,6 +48,14 @@ H5S_mpio_all_type( const H5S_t *space, size_t elmt_size, hbool_t prefer_derived_ hbool_t *use_view, hbool_t *is_derived_type ); static herr_t +H5S_mpio_none_type( const H5S_t *space, size_t elmt_size, hbool_t prefer_derived_types, + /* out: */ + MPI_Datatype *new_type, + size_t *count, + hsize_t *extra_offset, + hbool_t *use_view, + hbool_t *is_derived_type ); +static herr_t H5S_mpio_hyper_type( const H5S_t *space, size_t elmt_size, hbool_t prefer_derived_types, /* out: */ MPI_Datatype *new_type, @@ -76,6 +84,7 @@ H5S_mpio_spaces_xfer(H5F_t *f, const H5O_layout_t *layout, size_t elmt_size, const H5S_t *file_space, const H5S_t *mem_space, hid_t dxpl_id, void *buf/*out*/, hbool_t do_write); + /*------------------------------------------------------------------------- * Function: H5S_mpio_all_type * @@ -154,7 +163,70 @@ done: HDfprintf(stdout, "Leave %s total_bytes=%Hu\n", FUNC, total_bytes ); #endif FUNC_LEAVE (ret_value); -} +} /* H5S_mpio_all_type() */ + + +/*------------------------------------------------------------------------- + * Function: H5S_mpio_none_type + * + * Purpose: Translate an HDF5 "none" selection into an MPI type. + * + * Return: non-negative on success, negative on failure. + * + * Outputs: *new_type the MPI type corresponding to the selection + * *count how many objects of the new_type in selection + * (useful if this is the buffer type for xfer) + * *extra_offset Number of bytes of offset within dataset + * *use_view 0 if view not needed, 1 if needed + * *is_derived_type 0 if MPI primitive type, 1 if derived + * + * Programmer: Quincey Koziol, October 29, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5S_mpio_none_type( const H5S_t *space, size_t UNUSED elmt_size, hbool_t prefer_derived_types, + /* out: */ + MPI_Datatype *new_type, + size_t *count, + hsize_t *extra_offset, + hbool_t *use_view, + hbool_t *is_derived_type ) +{ + int mpi_code; /* MPI return code */ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOINIT(H5S_mpio_none_type); + + /* Check args */ + assert(space); + + /* Check if we should prefer creating a derived type */ + if(prefer_derived_types) { + /* fill in the return values */ + if (MPI_SUCCESS != (mpi_code=MPI_Type_contiguous(0, MPI_BYTE, new_type ))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code); + if(MPI_SUCCESS != (mpi_code=MPI_Type_commit(new_type))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code); + *count = 1; + *extra_offset = 0; + *use_view = 1; + *is_derived_type = 1; + } /* end if */ + else { + /* fill in the return values */ + *new_type = MPI_BYTE; + *count = 0; + *extra_offset = 0; + *use_view = 0; + *is_derived_type = 0; + } /* end else */ + +done: + FUNC_LEAVE (ret_value); +} /* H5S_mpio_none_type() */ /*------------------------------------------------------------------------- @@ -656,6 +728,11 @@ H5S_mpio_space_type( const H5S_t *space, size_t elmt_size, hbool_t prefer_derive case H5S_SIMPLE: switch(space->select.type) { case H5S_SEL_NONE: + if ( H5S_mpio_none_type( space, elmt_size, prefer_derived_types, + /* out: */ new_type, count, extra_offset, use_view, is_derived_type ) <0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert \"all\" selection to MPI type"); + break; + case H5S_SEL_ALL: if ( H5S_mpio_all_type( space, elmt_size, prefer_derived_types, /* out: */ new_type, count, extra_offset, use_view, is_derived_type ) <0) diff --git a/test/tselect.c b/test/tselect.c index 1b5ab49..2cbfa6a 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -4969,6 +4969,87 @@ test_select_fill_hyper_irregular(hssize_t *offset) /**************************************************************** ** +** test_zero_none(): Test basic H5S (dataspace) selection code. +** Tests I/O on 0-sized point selections +** +****************************************************************/ +static void +test_zero_none(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2}; + hsize_t dims2[] = {SPACE7_DIM1, SPACE7_DIM2}; + uint8_t *wbuf, /* buffer to write to disk */ + *tbuf; /* temporary buffer pointer */ + int i,j; /* Counters */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing I/O on 0-sized Selections\n")); + + /* Allocate write & read buffers */ + wbuf=malloc(sizeof(uint8_t)*SPACE7_DIM1*SPACE7_DIM2); + + /* Initialize write buffer */ + for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++) + for(j=0; j<SPACE7_DIM2; j++) + *tbuf++=(uint8_t)((i*SPACE7_DIM2)+j); + + /* Create file */ + fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid1, FAIL, "H5Fcreate"); + + /* Create dataspace for dataset */ + sid1 = H5Screate_simple(SPACE7_RANK, dims1, NULL); + CHECK(sid1, FAIL, "H5Screate_simple"); + + /* Create dataspace for writing buffer */ + sid2 = H5Screate_simple(SPACE7_RANK, dims2, NULL); + CHECK(sid2, FAIL, "H5Screate_simple"); + + /* Create a dataset */ + dataset=H5Dcreate(fid1,"Dataset1",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dcreate"); + + /* Make "none" selection in both disk and memory datasets */ + ret = H5Sselect_none(sid1); + CHECK(ret, FAIL, "H5Sselect_none"); + + ret = H5Sselect_none(sid2); + CHECK(ret, FAIL, "H5Sselect_none"); + + /* Write "nothing" to disk */ + ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf); + CHECK(ret, FAIL, "H5Dwrite"); + + /* Write "nothing" to disk (with a datatype conversion :-) */ + ret=H5Dwrite(dataset,H5T_NATIVE_INT,sid2,sid1,H5P_DEFAULT,wbuf); + CHECK(ret, FAIL, "H5Dwrite"); + + /* Close memory dataspace */ + ret = H5Sclose(sid2); + CHECK(ret, FAIL, "H5Sclose"); + + /* Close disk dataspace */ + ret = H5Sclose(sid1); + CHECK(ret, FAIL, "H5Sclose"); + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close file */ + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + + /* Free memory buffers */ + free(wbuf); +} /* test_zero_none() */ + +/**************************************************************** +** ** test_select(): Main H5S selection testing routine. ** ****************************************************************/ @@ -5089,6 +5170,9 @@ test_select(void) test_select_fill_hyper_irregular(NULL); test_select_fill_hyper_irregular(offset); + /* Test 0-sized selections */ + test_zero_none(); + } /* test_select() */ diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 056f64e..c65ee11 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -224,7 +224,7 @@ dataset_writeInd(char *filename) herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; - + MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; @@ -265,7 +265,7 @@ dataset_writeInd(char *filename) sid = H5Screate_simple (RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); - + /* create a dataset collectively */ dataset1 = H5Dcreate(fid, DATASETNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT); @@ -291,9 +291,9 @@ dataset_writeInd(char *filename) MESG("data_array initialized"); /* create a file dataspace independently */ - file_dataspace = H5Dget_space (dataset1); + file_dataspace = H5Dget_space (dataset1); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* create a memory dataspace independently */ @@ -301,12 +301,12 @@ dataset_writeInd(char *filename) VRFY((mem_dataspace >= 0), ""); /* write data independently */ - ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, + H5P_DEFAULT, data_array1); VRFY((ret >= 0), "H5Dwrite dataset1 succeeded"); /* write data independently */ - ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, + H5P_DEFAULT, data_array1); VRFY((ret >= 0), "H5Dwrite dataset2 succeeded"); /* setup dimensions again to write with zero rows for process 0 */ @@ -323,7 +323,7 @@ dataset_writeInd(char *filename) MESG("writeInd by some with zero row"); if ((mpi_rank/2)*2 != mpi_rank){ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), "H5Dwrite dataset1 by ZROW succeeded"); } #ifdef BARRIER_CHECKS @@ -333,7 +333,7 @@ MPI_Barrier(MPI_COMM_WORLD); /* release dataspace ID */ H5Sclose(file_dataspace); - /* close dataset collectively */ + /* close dataset collectively */ ret=H5Dclose(dataset1); VRFY((ret >= 0), "H5Dclose1 succeeded"); ret=H5Dclose(dataset2); @@ -342,8 +342,8 @@ MPI_Barrier(MPI_COMM_WORLD); /* release all IDs created */ H5Sclose(sid); - /* close the file collectively */ - H5Fclose(fid); + /* close the file collectively */ + H5Fclose(fid); /* release data buffers */ if (data_array1) free(data_array1); @@ -411,7 +411,7 @@ dataset_readInd(char *filename) /* create a file dataspace independently */ file_dataspace = H5Dget_space (dataset1); VRFY((file_dataspace >= 0), ""); - ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), ""); /* create a memory dataspace independently */ @@ -479,7 +479,7 @@ dataset_writeAll(char *filename) hid_t sid; /* Dataspace ID */ hid_t file_dataspace; /* File dataspace ID */ hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ + hid_t dataset1, dataset2, dataset3; /* Dataset ID */ hid_t datatype; /* Datatype ID */ hsize_t dims[RANK]; /* dataset dim sizes */ DATATYPE *data_array1 = NULL; /* data buffer */ @@ -490,7 +490,7 @@ dataset_writeAll(char *filename) herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; - + MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; @@ -506,7 +506,7 @@ dataset_writeAll(char *filename) VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); /* ------------------- - * START AN HDF5 FILE + * START AN HDF5 FILE * -------------------*/ /* setup file access template */ acc_tpl = create_faccess_plist(comm, info, facc_type); @@ -531,7 +531,7 @@ dataset_writeAll(char *filename) sid = H5Screate_simple (RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); - + /* create a dataset collectively */ dataset1 = H5Dcreate(fid, DATASETNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT); VRFY((dataset1 >= 0), "H5Dcreate succeeded"); @@ -544,6 +544,10 @@ dataset_writeAll(char *filename) dataset2 = H5Dcreate(fid, DATASETNAME2, datatype, sid, H5P_DEFAULT); VRFY((dataset2 >= 0), "H5Dcreate 2 succeeded"); + /* create a third dataset collectively */ + dataset3 = H5Dcreate(fid, DATASETNAME3, H5T_NATIVE_INT, sid, H5P_DEFAULT); + VRFY((dataset1 >= 0), "H5Dcreate succeeded"); + /* * Set up dimensions of the slab this process accesses. */ @@ -552,9 +556,9 @@ dataset_writeAll(char *filename) slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); /* create a file dataspace independently */ - file_dataspace = H5Dget_space (dataset1); + file_dataspace = H5Dget_space (dataset1); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* create a memory dataspace independently */ @@ -578,7 +582,7 @@ dataset_writeAll(char *filename) /* write data collectively */ MESG("writeAll by Row"); ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset1 succeeded"); /* setup dimensions again to writeAll with zero rows for process 0 */ @@ -594,7 +598,7 @@ dataset_writeAll(char *filename) } MESG("writeAll by some with zero row"); ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset1 by ZROW succeeded"); /* release all temporary handles. */ @@ -616,9 +620,9 @@ dataset_writeAll(char *filename) } /* create a file dataspace independently */ - file_dataspace = H5Dget_space (dataset1); + file_dataspace = H5Dget_space (dataset1); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* create a memory dataspace independently */ @@ -641,7 +645,7 @@ dataset_writeAll(char *filename) /* write data independently */ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset2 succeeded"); /* setup dimensions again to writeAll with zero columns for process 0 */ @@ -657,28 +661,86 @@ dataset_writeAll(char *filename) } MESG("writeAll by some with zero col"); ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset1 by ZCOL succeeded"); /* release all temporary handles. */ + /* Could have used them for dataset3 but it is cleaner */ + /* to create them again.*/ H5Sclose(file_dataspace); H5Sclose(mem_dataspace); H5Pclose(xfer_plist); + /* Dataset3: each process takes a block of rows, except process zero uses "none" selection. */ + slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); + + /* create a file dataspace independently */ + file_dataspace = H5Dget_space (dataset3); + VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); + if (MAINPROCESS) { + ret=H5Sselect_none(file_dataspace); + VRFY((ret >= 0), "H5Sselect_none file_dataspace succeeded"); + } /* end if */ + else { + ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sselect_hyperslab succeeded"); + } /* end else */ + + /* create a memory dataspace independently */ + mem_dataspace = H5Screate_simple (RANK, block, NULL); + VRFY((mem_dataspace >= 0), ""); + if (MAINPROCESS) { + ret=H5Sselect_none(mem_dataspace); + VRFY((ret >= 0), "H5Sselect_none mem_dataspace succeeded"); + } /* end if */ + + /* fill the local slab with some trivial data */ + dataset_fill(start, block, data_array1); + MESG("data_array initialized"); + if (verbose) { + MESG("data_array created"); + dataset_print(start, block, data_array1); + } /* end if */ + + /* set up the collective transfer properties list */ + xfer_plist = H5Pcreate (H5P_DATASET_XFER); + VRFY((xfer_plist >= 0), ""); + ret=H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); + VRFY((ret >= 0), "H5Pcreate xfer succeeded"); + + /* write data collectively */ + MESG("writeAll with none"); + ret = H5Dwrite(dataset3, H5T_NATIVE_INT, mem_dataspace, file_dataspace, + xfer_plist, data_array1); + VRFY((ret >= 0), "H5Dwrite dataset3 succeeded"); + + /* write data collectively (with datatype conversion) */ + MESG("writeAll with none"); + ret = H5Dwrite(dataset3, H5T_NATIVE_UCHAR, mem_dataspace, file_dataspace, + xfer_plist, data_array1); + VRFY((ret >= 0), "H5Dwrite dataset3 succeeded"); + + /* release all temporary handles. */ + H5Sclose(file_dataspace); + H5Sclose(mem_dataspace); + H5Pclose(xfer_plist); + /* * All writes completed. Close datasets collectively - */ + */ ret=H5Dclose(dataset1); VRFY((ret >= 0), "H5Dclose1 succeeded"); ret=H5Dclose(dataset2); VRFY((ret >= 0), "H5Dclose2 succeeded"); + ret=H5Dclose(dataset3); + VRFY((ret >= 0), "H5Dclose3 succeeded"); /* release all IDs created */ H5Sclose(sid); - /* close the file collectively */ - H5Fclose(fid); + /* close the file collectively */ + H5Fclose(fid); /* release data buffers */ if (data_array1) free(data_array1); @@ -729,7 +791,7 @@ dataset_readAll(char *filename) VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); /* ------------------- - * OPEN AN HDF5 FILE + * OPEN AN HDF5 FILE * -------------------*/ /* setup file access template */ acc_tpl = create_faccess_plist(comm, info, facc_type); @@ -763,9 +825,9 @@ dataset_readAll(char *filename) slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); /* create a file dataspace independently */ - file_dataspace = H5Dget_space (dataset1); + file_dataspace = H5Dget_space (dataset1); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* create a memory dataspace independently */ @@ -788,7 +850,7 @@ dataset_readAll(char *filename) /* read data collectively */ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dread dataset1 succeeded"); /* verify the read data with original expected data */ @@ -808,7 +870,7 @@ dataset_readAll(char *filename) } MESG("readAll by some with zero col"); ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dread dataset1 by ZCOL succeeded"); /* verify the read data with original expected data */ @@ -826,9 +888,9 @@ dataset_readAll(char *filename) slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); /* create a file dataspace independently */ - file_dataspace = H5Dget_space (dataset1); + file_dataspace = H5Dget_space (dataset1); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* create a memory dataspace independently */ @@ -851,7 +913,7 @@ dataset_readAll(char *filename) /* read data collectively */ ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dread dataset2 succeeded"); /* verify the read data with original expected data */ @@ -871,7 +933,7 @@ dataset_readAll(char *filename) } MESG("readAll by some with zero row"); ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dread dataset1 by ZROW succeeded"); /* verify the read data with original expected data */ @@ -886,14 +948,14 @@ dataset_readAll(char *filename) /* * All reads completed. Close datasets collectively - */ + */ ret=H5Dclose(dataset1); VRFY((ret >= 0), "H5Dclose1 succeeded"); ret=H5Dclose(dataset2); VRFY((ret >= 0), "H5Dclose2 succeeded"); - /* close the file collectively */ - H5Fclose(fid); + /* close the file collectively */ + H5Fclose(fid); /* release data buffers */ if (data_array1) free(data_array1); @@ -936,7 +998,7 @@ extend_writeInd(char *filename) herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; - + MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; @@ -956,7 +1018,7 @@ extend_writeInd(char *filename) VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); /* ------------------- - * START AN HDF5 FILE + * START AN HDF5 FILE * -------------------*/ /* setup file access template */ acc_tpl = create_faccess_plist(comm, info, facc_type); @@ -1028,14 +1090,14 @@ extend_writeInd(char *filename) VRFY((ret >= 0), "H5Dextend succeeded"); /* create a file dataspace independently */ - file_dataspace = H5Dget_space (dataset1); + file_dataspace = H5Dget_space (dataset1); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* write data independently */ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), "H5Dwrite succeeded"); /* release resource */ @@ -1067,14 +1129,14 @@ extend_writeInd(char *filename) H5Eset_auto(NULL, NULL); /* create a file dataspace independently */ - file_dataspace = H5Dget_space (dataset2); + file_dataspace = H5Dget_space (dataset2); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* write data independently. Should fail. */ - ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, + H5P_DEFAULT, data_array1); VRFY((ret < 0), "H5Dwrite failed as expected"); /* restore auto error reporting */ @@ -1088,14 +1150,14 @@ extend_writeInd(char *filename) VRFY((ret >= 0), "H5Dextend succeeded"); /* create a file dataspace independently */ - file_dataspace = H5Dget_space (dataset2); + file_dataspace = H5Dget_space (dataset2); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* write data independently */ - ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, + H5P_DEFAULT, data_array1); VRFY((ret >= 0), "H5Dwrite succeeded"); /* release resource */ @@ -1105,14 +1167,14 @@ extend_writeInd(char *filename) VRFY((ret >= 0), "H5Sclose succeeded"); - /* close dataset collectively */ + /* close dataset collectively */ ret=H5Dclose(dataset1); VRFY((ret >= 0), "H5Dclose1 succeeded"); ret=H5Dclose(dataset2); VRFY((ret >= 0), "H5Dclose2 succeeded"); - /* close the file collectively */ - H5Fclose(fid); + /* close the file collectively */ + H5Fclose(fid); /* release data buffers */ if (data_array1) free(data_array1); @@ -1158,7 +1220,7 @@ extend_readInd(char *filename) VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); /* ------------------- - * OPEN AN HDF5 FILE + * OPEN AN HDF5 FILE * -------------------*/ /* setup file access template */ acc_tpl = create_faccess_plist(comm, info, facc_type); @@ -1205,7 +1267,7 @@ extend_readInd(char *filename) /* create a file dataspace independently */ file_dataspace = H5Dget_space (dataset1); VRFY((file_dataspace >= 0), ""); - ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), ""); /* create a memory dataspace independently */ @@ -1240,7 +1302,7 @@ extend_readInd(char *filename) /* create a file dataspace independently */ file_dataspace = H5Dget_space (dataset2); VRFY((file_dataspace >= 0), ""); - ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), ""); /* create a memory dataspace independently */ |