diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-10-04 20:29:31 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-10-04 20:29:31 (GMT) |
commit | 74a448d084ac1e09be38fdf80c7b7298e3957ea4 (patch) | |
tree | 0f47590955318bf799c5c6d7cefeecc66fc9bebe | |
parent | e2f3ab0ab01044d515eb74b64d24a569d06e3d86 (diff) | |
download | hdf5-74a448d084ac1e09be38fdf80c7b7298e3957ea4.zip hdf5-74a448d084ac1e09be38fdf80c7b7298e3957ea4.tar.gz hdf5-74a448d084ac1e09be38fdf80c7b7298e3957ea4.tar.bz2 |
[svn-r9358] Purpose:
Bug fix
Description:
Relax restrictions on parallel I/O to allow compressed, chunked datasets
to be read in parallel (collective access will be degraded to independent
access, but will retrieve the information still).
Platforms tested:
FreeBSD 4.10 (sleipnir) w/parallel
Solaris 2.7 (arabica)
IRIX64 6.5 (modi4)
h5committest
-rw-r--r-- | release_docs/RELEASE.txt | 24 | ||||
-rw-r--r-- | src/H5D.c | 4 | ||||
-rw-r--r-- | src/H5Dio.c | 2 | ||||
-rw-r--r-- | src/H5Distore.c | 28 | ||||
-rw-r--r-- | src/H5Dmpio.c | 15 | ||||
-rw-r--r-- | src/H5Dpkg.h | 4 | ||||
-rw-r--r-- | testpar/t_coll_chunk.c | 11 | ||||
-rw-r--r-- | testpar/t_dset.c | 194 | ||||
-rw-r--r-- | testpar/t_file.c | 2 | ||||
-rw-r--r-- | testpar/t_mdset.c | 2 | ||||
-rw-r--r-- | testpar/t_ph5basic.c | 1 | ||||
-rw-r--r-- | testpar/testphdf5.c | 9 | ||||
-rw-r--r-- | testpar/testphdf5.h | 5 |
13 files changed, 228 insertions, 73 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 675b2da..9476690 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -124,11 +124,13 @@ New Features Parallel Library: ----------------- + - Allow compressed, chunked datasets to be read in parallel. + QAK - 2004/10/04 - Add options of using atomicity and file-sync to test_mpio_1wMr. - AKC - 2003/11/13 + AKC - 2003/11/13 - Added parallel test, test_mpio_1wMr, which tests if the - underlaying parallel I/O system is conforming to the POSIX - write/read requirement. AKC - 2003/11/12 + underlaying parallel I/O system is conforming to the POSIX + write/read requirement. AKC - 2003/11/12 Fortran Library: ---------------- @@ -136,18 +138,18 @@ New Features - added new functions h5fget_name_f and h5fget_filesize_f EIP 2004/07/08 - h5dwrite/read_f and h5awrite/read_f functions only accept dims parameter - of the type INTEGER(HSIZE_T). + of the type INTEGER(HSIZE_T). Tools: ------ - h5repack.sh did not report errors encountered during tests. It does - now. AKC - 2004/04/02 + now. AKC - 2004/04/02 - Added the MPI-I/O and MPI-POSIX drivers to the list of VFL drivers available for h5dump and h5ls - Added option --vfd= to h5ls to allow a VFL driver to be selected by a user. - Added option -showconfig to compiler tools (h5cc,h5fc,h5c++). - AKC - 2004/01/08 + AKC - 2004/01/08 - Install the "h5cc" and "h5fc" tools as "h5pcc" and "h5pfc" respectively if library is built in parallel mode. WCW - 2003/11/04 @@ -167,12 +169,12 @@ Support for new platforms, languages and compilers. - Absoft compiler f95 v9.0 supported on Linux 2.4 EIP - 2004/07/29 - HDF5 Fortran APIs are supported on Mac OSX with IBM XL Fortran - compiler version 8.1. This is a default compiler. + compiler version 8.1. This is a default compiler. - HDF5 Fortran APIs are supported on MAC OSX with Absoft F95 compiler - version 8.2; set F9X environment varibale to f95, for example - setenv F9X f95 - Use --disable-shared --enable-static configure flags when Absoft - compiler is used. + version 8.2; set F9X environment varibale to f95, for example + setenv F9X f95 + Use --disable-shared --enable-static configure flags when Absoft + compiler is used. EIP - 2004/07/27 - HDF5 Fortran APIs are supported on MAC OSX with IBM XL Fortran Compiler version 8.1 Use "--disable-shared --enable-static" @@ -2642,10 +2642,6 @@ H5D_open_oid(const H5G_entry_t *ent, hid_t dxpl_id) if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set pipeline") - /* If MPI VFD is used, no filter support yet. */ - if(IS_H5FD_MPI(dataset->ent.file) && pline.nused > 0) - HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL, "Parallel IO does not support filters yet") - /* * Get the raw data layout info. It's actually stored in two locations: * the storage message of the dataset (dataset->storage) and certain diff --git a/src/H5Dio.c b/src/H5Dio.c index fbbf4dc..5ad5b53 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -3294,7 +3294,7 @@ H5D_ioinfo_init(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, /* * Check if we can set direct MPI-IO read/write functions */ - opt=H5D_mpio_opt_possible(dset->ent.file,mem_space,file_space,flags,&dset->shared->layout); + opt=H5D_mpio_opt_possible(dset,mem_space,file_space,flags); if(opt==FAIL) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, NULL, "invalid check for direct IO dataspace "); diff --git a/src/H5Distore.c b/src/H5Distore.c index e84488f..9fc906d 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -1918,17 +1918,11 @@ HDfprintf(stderr,"%s: buf=%p\n",FUNC,buf); * writing to other elements in the same chunk. Do a direct * read-through of only the elements requested. */ - if ((dset->shared->layout.u.chunk.size>dset->shared->cache.chunk.nbytes && dset->shared->dcpl_cache.pline.nused==0 && chunk_addr!=HADDR_UNDEF) - || (IS_H5FD_MPI(dset->ent.file) && (H5F_ACC_RDWR & H5F_get_intent(dset->ent.file)))) { + if (dset->shared->dcpl_cache.pline.nused==0 && ((dset->shared->layout.u.chunk.size>dset->shared->cache.chunk.nbytes && chunk_addr!=HADDR_UNDEF) + || (IS_H5FD_MPI(dset->ent.file) && (H5F_ACC_RDWR & H5F_get_intent(dset->ent.file))))) { H5D_io_info_t chk_io_info; /* Temporary I/O info object */ H5D_storage_t chk_store; /* Chunk storage information */ -#ifdef H5_HAVE_PARALLEL - /* Additional sanity check when operating in parallel */ - if (chunk_addr==HADDR_UNDEF || dset->shared->dcpl_cache.pline.nused>0) - HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to locate raw data chunk"); -#endif /* H5_HAVE_PARALLEL */ - /* Set up the storage information for the chunk */ chk_store.contig.dset_addr=chunk_addr; chk_store.contig.dset_size=(hsize_t)dset->shared->layout.u.chunk.size; @@ -2121,17 +2115,21 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a * writing to other elements in the same chunk. Do a direct * write-through of only the elements requested. */ - if ((dset->shared->layout.u.chunk.size>dset->shared->cache.chunk.nbytes && dset->shared->dcpl_cache.pline.nused==0 && chunk_addr!=HADDR_UNDEF) - || (IS_H5FD_MPI(dset->ent.file) && (H5F_ACC_RDWR & H5F_get_intent(dset->ent.file)))) { - H5D_io_info_t chk_io_info; /* Temporary I/O info object */ - H5D_storage_t chk_store; /* Chunk storage information */ - #ifdef H5_HAVE_PARALLEL - /* Additional sanity check when operating in parallel */ - if (chunk_addr==HADDR_UNDEF || dset->shared->dcpl_cache.pline.nused>0) + /* Additional sanity checks when operating in parallel */ + if(IS_H5FD_MPI(dset->ent.file)) { + if (chunk_addr==HADDR_UNDEF) HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to locate raw data chunk"); + if (dset->shared->dcpl_cache.pline.nused>0) + HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "cannot write to chunked storage with filters in parallel"); + } /* end if */ #endif /* H5_HAVE_PARALLEL */ + if (dset->shared->dcpl_cache.pline.nused==0 && ((dset->shared->layout.u.chunk.size>dset->shared->cache.chunk.nbytes && chunk_addr!=HADDR_UNDEF) + || (IS_H5FD_MPI(dset->ent.file) && (H5F_ACC_RDWR & H5F_get_intent(dset->ent.file))))) { + H5D_io_info_t chk_io_info; /* Temporary I/O info object */ + H5D_storage_t chk_store; /* Chunk storage information */ + /* Set up the storage information for the chunk */ chk_store.contig.dset_addr=chunk_addr; chk_store.contig.dset_size=(hsize_t)dset->shared->layout.u.chunk.size; diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 032dea9..08c6a48 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -63,7 +63,7 @@ H5D_mpio_spaces_xfer(H5D_io_info_t *io_info, size_t elmt_size, *------------------------------------------------------------------------- */ htri_t -H5D_mpio_opt_possible( const H5F_t *file, const H5S_t *mem_space, const H5S_t *file_space, const unsigned flags,const H5O_layout_t *layout) +H5D_mpio_opt_possible( const H5D_t *dset, const H5S_t *mem_space, const H5S_t *file_space, const unsigned flags) { htri_t c1,c2; /* Flags whether a selection is optimizable */ htri_t ret_value=TRUE; @@ -71,6 +71,7 @@ H5D_mpio_opt_possible( const H5F_t *file, const H5S_t *mem_space, const H5S_t *f FUNC_ENTER_NOAPI(H5D_mpio_opt_possible, FAIL); /* Check args */ + assert(dset); assert(mem_space); assert(file_space); @@ -116,10 +117,14 @@ H5D_mpio_opt_possible( const H5F_t *file, const H5S_t *mem_space, const H5S_t *f int mpi_code; /* MPI return code */ unsigned u; /* Local index variable */ + /* Disallow collective I/O if there are any I/O filters on chunks */ + if(dset->shared->dcpl_cache.pline.nused>0) + HGOTO_DONE(FALSE) + /* Getting MPI communicator and rank */ - if((comm = H5F_mpi_get_comm(file))==MPI_COMM_NULL) + if((comm = H5F_mpi_get_comm(dset->ent.file))==MPI_COMM_NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't retrieve MPI communicator") - if((mpi_rank = H5F_mpi_get_rank(file))<0) + if((mpi_rank = H5F_mpi_get_rank(dset->ent.file))<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't retrieve MPI rank") /* Currently collective chunking storage @@ -150,8 +155,8 @@ H5D_mpio_opt_possible( const H5F_t *file, const H5S_t *mem_space, const H5S_t *f if(H5S_SELECT_BOUNDS(file_space,startf,endf)==FAIL) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE,FAIL, "invalid check for single selection blocks"); - for(u=0; u < layout->u.chunk.ndims; u++) - chunk_dim[u] = layout->u.chunk.dim[u]; + for(u=0; u < dset->shared->layout.u.chunk.ndims; u++) + chunk_dim[u] = dset->shared->layout.u.chunk.dim[u]; /* Case 1: check whether all hyperslab in this process is inside one chunk. Note: we don't handle when starting point is less than zero since that may cover diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index a5bbeaf..499ceb0 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -290,8 +290,8 @@ H5_DLL herr_t H5D_mpio_spaces_write(H5D_io_info_t *io_info, /* MPI-IO function to check if a direct I/O transfer is possible between * memory and the file */ -H5_DLL htri_t H5D_mpio_opt_possible(const H5F_t *file, const H5S_t *mem_space, - const H5S_t *file_space, const unsigned flags, const H5O_layout_t *layout); +H5_DLL htri_t H5D_mpio_opt_possible(const H5D_t *file, const H5S_t *mem_space, + const H5S_t *file_space, const unsigned flags); #endif /* H5_HAVE_PARALLEL */ /* Testing functions */ diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c index 494ae9b..1dc3c71 100644 --- a/testpar/t_coll_chunk.c +++ b/testpar/t_coll_chunk.c @@ -80,7 +80,7 @@ coll_chunk3(void) char *filename; int mpi_size; MPI_Comm comm = MPI_COMM_WORLD; - MPI_Comm_size(comm,&mpi_size); + MPI_Comm_size(comm,&mpi_size); filename = (char *) GetTestParameters(); coll_chunktest(filename,mpi_size,BYROW_CONT); @@ -92,7 +92,6 @@ coll_chunk4(void) char *filename; int mpi_size; - MPI_Comm comm = MPI_COMM_WORLD; MPI_Comm_size(comm,&mpi_size); filename = (char *) GetTestParameters(); @@ -352,16 +351,10 @@ ccslab_set(int mpi_rank, int mpi_size, hssize_t start[], hsize_t count[], /* Each process takes several disjoint blocks. */ block[0] = 1; block[1] = 1; - /* - stride[0] = 3; - stride[1] = 6; - count[0] = 2; - count[1] = 3; - */ stride[0] = 3; stride[1] = 3; count[0] = (SPACE_DIM1/mpi_size)/(stride[0]*block[0]); - count[1] =(SPACE_DIM2)/(stride[1]*block[1]); + count[1] = (SPACE_DIM2)/(stride[1]*block[1]); start[0] = SPACE_DIM1/mpi_size*mpi_rank; start[1] = 0; if (VERBOSE_MED) printf("slab_set BYROW_DISCONT\n"); diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 5ff0a6e..77cfdc4 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -232,7 +232,7 @@ dataset_writeInd(void) hbool_t use_gpfs = FALSE; /* Use GPFS hints */ hsize_t dims[RANK]; /* dataset dim sizes */ DATATYPE *data_array1 = NULL; /* data buffer */ - char *filename; + const char *filename; hssize_t start[RANK]; /* for hyperslab setting */ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ @@ -244,7 +244,7 @@ dataset_writeInd(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = (char *) GetTestParameters(); + filename = GetTestParameters(); if (VERBOSE_MED) printf("Independent write test on file %s\n", filename); @@ -378,7 +378,7 @@ dataset_readInd(void) hbool_t use_gpfs = FALSE; /* Use GPFS hints */ DATATYPE *data_array1 = NULL; /* data buffer */ DATATYPE *data_origin1 = NULL; /* expected data buffer */ - char *filename; + const char *filename; hssize_t start[RANK]; /* for hyperslab setting */ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ @@ -390,7 +390,7 @@ dataset_readInd(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = (char *) GetTestParameters(); + filename = GetTestParameters(); if (VERBOSE_MED) printf("Independent read test on file %s\n", filename); @@ -504,7 +504,7 @@ dataset_writeAll(void) hbool_t use_gpfs = FALSE; /* Use GPFS hints */ hsize_t dims[RANK]; /* dataset dim sizes */ DATATYPE *data_array1 = NULL; /* data buffer */ - char *filename; + const char *filename; hssize_t start[RANK]; /* for hyperslab setting */ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ @@ -516,7 +516,7 @@ dataset_writeAll(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = (char *) GetTestParameters(); + filename = GetTestParameters(); if (VERBOSE_MED) printf("Collective write test on file %s\n", filename); @@ -863,7 +863,7 @@ dataset_readAll(void) hbool_t use_gpfs = FALSE; /* Use GPFS hints */ DATATYPE *data_array1 = NULL; /* data buffer */ DATATYPE *data_origin1 = NULL; /* expected data buffer */ - char *filename; + const char *filename; hssize_t start[RANK]; /* for hyperslab setting */ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ @@ -875,7 +875,7 @@ dataset_readAll(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = (char *) GetTestParameters(); + filename = GetTestParameters(); if (VERBOSE_MED) printf("Collective read test on file %s\n", filename); @@ -1084,7 +1084,7 @@ extend_writeInd(void) hid_t mem_dataspace; /* memory dataspace ID */ hid_t dataset1, dataset2; /* Dataset ID */ hbool_t use_gpfs = FALSE; /* Use GPFS hints */ - char *filename; + const char *filename; hsize_t dims[RANK]; /* dataset dim sizes */ hsize_t max_dims[RANK] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */ @@ -1103,7 +1103,7 @@ extend_writeInd(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = (char *) GetTestParameters(); + filename = GetTestParameters(); if (VERBOSE_MED) printf("Extend independent write test on file %s\n", filename); @@ -1308,7 +1308,7 @@ extend_writeInd(void) void extend_writeInd2(void) { - char *filename; + const char *filename; hid_t fid; /* HDF5 file ID */ hid_t fapl; /* File access templates */ hid_t fs; /* File dataspace ID */ @@ -1327,7 +1327,7 @@ extend_writeInd2(void) int i; /* Local index variable */ herr_t ret; /* Generic return value */ - filename = (char *) GetTestParameters(); + filename = GetTestParameters(); if (VERBOSE_MED) printf("Extend independent write test #2 on file %s\n", filename); @@ -1481,7 +1481,7 @@ extend_readInd(void) DATATYPE *data_array1 = NULL; /* data buffer */ DATATYPE *data_array2 = NULL; /* data buffer */ DATATYPE *data_origin1 = NULL; /* expected data buffer */ - char *filename; + const char *filename; hssize_t start[RANK]; /* for hyperslab setting */ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ @@ -1493,7 +1493,7 @@ extend_readInd(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = (char *) GetTestParameters(); + filename = GetTestParameters(); if (VERBOSE_MED) printf("Extend independent read test on file %s\n", filename); @@ -1658,7 +1658,7 @@ extend_writeAll(void) hid_t mem_dataspace; /* memory dataspace ID */ hid_t dataset1, dataset2; /* Dataset ID */ hbool_t use_gpfs = FALSE; /* Use GPFS hints */ - char *filename; + const char *filename; hsize_t dims[RANK]; /* dataset dim sizes */ hsize_t max_dims[RANK] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */ @@ -1677,7 +1677,7 @@ extend_writeAll(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = (char *) GetTestParameters(); + filename = GetTestParameters(); if (VERBOSE_MED) printf("Extend independent write test on file %s\n", filename); @@ -1899,7 +1899,7 @@ extend_readAll(void) hid_t mem_dataspace; /* memory dataspace ID */ hid_t dataset1, dataset2; /* Dataset ID */ hbool_t use_gpfs = FALSE; /* Use GPFS hints */ - char *filename; + const char *filename; hsize_t dims[RANK]; /* dataset dim sizes */ DATATYPE *data_array1 = NULL; /* data buffer */ DATATYPE *data_array2 = NULL; /* data buffer */ @@ -1915,7 +1915,7 @@ extend_readAll(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = (char *) GetTestParameters(); + filename = GetTestParameters(); if (VERBOSE_MED) printf("Extend independent read test on file %s\n", filename); @@ -2070,3 +2070,161 @@ extend_readAll(void) if (data_array2) free(data_array2); if (data_origin1) free(data_origin1); } + +/* + * Example of using the parallel HDF5 library to read a compressed + * dataset in an HDF5 file with collective parallel access support. + */ + +#ifdef H5_HAVE_FILTER_DEFLATE +void +compress_readAll(void) +{ + hid_t fid; /* HDF5 file ID */ + hid_t acc_tpl; /* File access templates */ + hid_t dcpl; /* Dataset creation property list */ + hid_t xfer_plist; /* Dataset transfer properties list */ + hid_t dataspace; /* Dataspace ID */ + hid_t dataset; /* Dataset ID */ + int rank=1; /* Dataspace rank */ + hsize_t dim=dim0; /* Dataspace dimensions */ + unsigned u; /* Local index variable */ + hbool_t use_gpfs = FALSE; /* Use GPFS hints */ + DATATYPE *data_read = NULL; /* data buffer */ + DATATYPE *data_orig = NULL; /* expected data buffer */ + const char *filename; + MPI_Comm comm = MPI_COMM_WORLD; + MPI_Info info = MPI_INFO_NULL; + int mpi_size, mpi_rank; + herr_t ret; /* Generic return value */ + + filename = GetTestParameters(); + if (VERBOSE_MED) + printf("Collective chunked dataset read test on file %s\n", filename); + + /* Retrieve MPI parameters */ + MPI_Comm_size(comm,&mpi_size); + MPI_Comm_rank(comm,&mpi_rank); + + /* Allocate data buffer */ + data_orig = (DATATYPE *)HDmalloc((size_t)dim*sizeof(DATATYPE)); + VRFY((data_orig != NULL), "data_origin1 malloc succeeded"); + data_read = (DATATYPE *)HDmalloc((size_t)dim*sizeof(DATATYPE)); + VRFY((data_read != NULL), "data_array1 malloc succeeded"); + + /* Initialize data buffers */ + for(u=0; u<dim;u++) + data_orig[u]=u; + + /* Process zero creates the file with a compressed, chunked dataset */ + if(mpi_rank==0) { + hsize_t chunk_dim; /* Chunk dimensions */ + + /* Create the file */ + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + VRFY((fid > 0), "H5Fcreate succeeded"); + + /* Create property list for chunking and compression */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); + VRFY((dcpl > 0), "H5Pcreate succeeded"); + + ret=H5Pset_layout(dcpl, H5D_CHUNKED); + VRFY((ret >= 0), "H5Pset_layout succeeded"); + + /* Use eight chunks */ + chunk_dim=dim/8; + ret=H5Pset_chunk(dcpl, rank, &chunk_dim); + VRFY((ret >= 0), "H5Pset_chunk succeeded"); + + ret=H5Pset_deflate(dcpl, 9); + VRFY((ret >= 0), "H5Pset_deflate succeeded"); + + /* Create dataspace */ + dataspace = H5Screate_simple(rank, &dim, NULL); + VRFY((dataspace > 0), "H5Screate_simple succeeded"); + + /* Create dataset */ + dataset = H5Dcreate(fid, "compressed_data", H5T_NATIVE_INT, dataspace, dcpl); + VRFY((dataset > 0), "H5Screate_simple succeeded"); + + /* Write compressed data */ + ret=H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_orig); + VRFY((ret >= 0), "H5Dwrite succeeded"); + + /* Close objects */ + ret=H5Pclose(dcpl); + VRFY((ret >= 0), "H5Pclose succeeded"); + ret=H5Sclose(dataspace); + VRFY((ret >= 0), "H5Sclose succeeded"); + ret=H5Dclose(dataset); + VRFY((ret >= 0), "H5Dclose succeeded"); + ret=H5Fclose(fid); + VRFY((ret >= 0), "H5Fclose succeeded"); + } + + /* Wait for file to be created */ + MPI_Barrier(comm); + + /* ------------------- + * OPEN AN HDF5 FILE + * -------------------*/ + + /* setup file access template */ + acc_tpl = create_faccess_plist(comm, info, facc_type, use_gpfs); + VRFY((acc_tpl >= 0), ""); + + /* open the file collectively */ + fid=H5Fopen(filename,H5F_ACC_RDWR,acc_tpl); + VRFY((fid > 0), "H5Fopen succeeded"); + + /* Release file-access template */ + ret=H5Pclose(acc_tpl); + VRFY((ret >= 0), "H5Pclose succeeded"); + + + /* Open dataset with compressed chunks */ + dataset = H5Dopen(fid, "compressed_data"); + VRFY((dataset > 0), "H5Dopen succeeded"); + + /* Try reading & writing data */ + if(dataset>0) { + /* Create dataset transfer property list */ + xfer_plist = H5Pcreate(H5P_DATASET_XFER); + VRFY((xfer_plist > 0), "H5Pcreate succeeded"); + + ret=H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); + VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); + + /* Try reading the data */ + ret=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer_plist, data_read); + VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); + + /* Verify data read */ + for(u=0; u<dim; u++) + if(data_orig[u]!=data_read[u]) { + printf("Line #%d: written!=retrieved: data_orig[%u]=%d, data_read[%u]=%d\n",__LINE__, + (unsigned)u,data_orig[u],(unsigned)u,data_read[u]); + nerrors++; + } + + /* Writing to the compressed, chunked dataset in parallel should fail */ + H5E_BEGIN_TRY { + ret=H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer_plist, data_read); + } H5E_END_TRY; + VRFY((ret < 0), "H5Dwrite failed"); + + ret=H5Pclose(xfer_plist); + VRFY((ret >= 0), "H5Pclose succeeded"); + ret=H5Dclose(dataset); + VRFY((ret >= 0), "H5Dclose succeeded"); + } /* end if */ + + ret=H5Fclose(fid); + VRFY((ret >= 0), "H5Fclose succeeded"); + + /* release data buffers */ + if (data_read) HDfree(data_read); + if (data_orig) HDfree(data_orig); +} +#endif /* H5_HAVE_FILTER_DEFLATE */ + diff --git a/testpar/t_file.c b/testpar/t_file.c index c83a1af..6fcde32 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -12,8 +12,6 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* $Id$ */ - /* * Parallel tests for file operations */ diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index 6d8bd60..b23a26e 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -12,8 +12,6 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* $Id$ */ - #include "testphdf5.h" #define DIM 2 diff --git a/testpar/t_ph5basic.c b/testpar/t_ph5basic.c index c373017..1649c13 100644 --- a/testpar/t_ph5basic.c +++ b/testpar/t_ph5basic.c @@ -11,7 +11,6 @@ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* $Id$ */ /* * Test parallel HDF5 basic components diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index dbe3ecc..0f6624e 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -33,7 +33,7 @@ int ngroups = 512; /* number of groups to create in root * group. */ int facc_type = FACC_MPIO; /*Test file access type */ -H5E_auto_stack_t old_func; /* previous error handler */ +H5E_auto_t old_func; /* previous error handler */ void *old_client_data; /* previous error handler arg.*/ /* other option flags */ @@ -381,6 +381,11 @@ int main(int argc, char **argv) AddTest("eidsetw2", extend_writeInd2, NULL, "extendible dataset independent write #2", PARATESTFILE); +#ifdef H5_HAVE_FILTER_DEFLATE + AddTest("cmpdsetr", compress_readAll, NULL, + "compressed dataset collective read", PARATESTFILE); +#endif /* H5_HAVE_FILTER_DEFLATE */ + ndsets_params.name = PARATESTFILE; ndsets_params.count = ndatasets; AddTest("ndsetw", multiple_dset_write, NULL, @@ -428,6 +433,7 @@ int main(int argc, char **argv) AddTest("cchunk4", coll_chunk4,NULL, "collective to independent chunk io",PARATESTFILE); } + AddTest("null", null_dataset, NULL, "null dataset test", PARATESTFILE); @@ -438,7 +444,6 @@ int main(int argc, char **argv) "I/O mode confusion test -- hangs quickly on failure", &io_mode_confusion_params); - /* Display testing information */ TestInfo(argv[0]); diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 877e88c..b66d196 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -133,7 +133,7 @@ typedef int DATATYPE; extern int dim0, dim1; /*Dataset dimensions */ extern int chunkdim0, chunkdim1; /*Chunk dimensions */ extern int nerrors; /*errors count */ -extern H5E_auto_stack_t old_func; /* previous error handler */ +extern H5E_auto_t old_func; /* previous error handler */ extern void *old_client_data; /*previous error handler arg.*/ extern int facc_type; /*Test file access type */ @@ -164,6 +164,9 @@ void coll_chunk2(void); void coll_chunk3(void); void coll_chunk4(void); void io_mode_confusion(void); +#ifdef H5_HAVE_FILTER_DEFLATE +void compress_readAll(void); +#endif /* H5_HAVE_FILTER_DEFLATE */ /* commonly used prototypes */ hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type, hbool_t use_gpfs); |