From 20146575aaeead9e05af73977dee863de63bf50f Mon Sep 17 00:00:00 2001 From: cvs2svn Date: Wed, 29 Dec 2004 09:32:06 -0500 Subject: [svn-r9728] This commit was manufactured by cvs2svn to create branch 'hdf5_1_6'. --- src/H5Fdbg.c | 145 ++++++ src/hdf5.lnt | 103 ++++ testpar/t_span_tree.c | 762 ++++++++++++++++++++++++++++++ tools/h5repack/testh5repack_detect_szip.c | 51 ++ 4 files changed, 1061 insertions(+) create mode 100644 src/H5Fdbg.c create mode 100755 src/hdf5.lnt create mode 100644 testpar/t_span_tree.c create mode 100644 tools/h5repack/testh5repack_detect_szip.c diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c new file mode 100644 index 0000000..b14d580 --- /dev/null +++ b/src/H5Fdbg.c @@ -0,0 +1,145 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Quincey Koziol + * Wednesday, July 9, 2003 + * + * Purpose: File object debugging functions. + */ + +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + +/* Pablo information */ +/* (Put before include files to avoid problems with inline functions) */ +#define PABLO_MASK H5Fdbg_mask + +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5Iprivate.h" /* ID Functions */ +#include "H5Pprivate.h" /* Property lists */ + + +/*------------------------------------------------------------------------- + * Function: H5F_debug + * + * Purpose: Prints a file header to the specified stream. Each line + * is indented and the field name occupies the specified width + * number of characters. + * + * Errors: + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * matzke@llnl.gov + * Aug 1 1997 + * + * Modifications: + * Robb Matzke, 1999-07-28 + * The ADDR argument is passed by value. + * + * Raymond Lu, 2001-10-14 + * Changed to the new generic property list. + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_debug(H5F_t *f, hid_t dxpl_id, FILE * stream, int indent, int fwidth) +{ + hsize_t userblock_size; + int super_vers, freespace_vers, obj_dir_vers, share_head_vers; + H5P_genplist_t *plist; /* Property list */ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5F_debug, FAIL) + + /* check args */ + assert(f); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + + /* Get property list */ + if(NULL == (plist = H5I_object(f->shared->fcpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + if(H5P_get(plist, H5F_CRT_USER_BLOCK_NAME, &userblock_size)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get user block size") + if(H5P_get(plist, H5F_CRT_SUPER_VERS_NAME, &super_vers)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get super block version") + if(H5P_get(plist, H5F_CRT_FREESPACE_VERS_NAME, &freespace_vers)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get super block version") + if(H5P_get(plist, H5F_CRT_OBJ_DIR_VERS_NAME, &obj_dir_vers)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object directory version") + if(H5P_get(plist, H5F_CRT_SHARE_HEAD_VERS_NAME, &share_head_vers)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get shared-header format version") + + /* debug */ + HDfprintf(stream, "%*sFile Super Block...\n", indent, ""); + + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "File name:", + f->name); + HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, + "File access flags", + (unsigned) (f->shared->flags)); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "File open reference count:", + (unsigned) (f->shared->nrefs)); + HDfprintf(stream, "%*s%-*s %a (abs)\n", indent, "", fwidth, + "Address of super block:", f->shared->super_addr); + HDfprintf(stream, "%*s%-*s %lu bytes\n", indent, "", fwidth, + "Size of user block:", (unsigned long) userblock_size); + + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Super block version number:", (unsigned) super_vers); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Free list version number:", (unsigned) freespace_vers); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Root group symbol table entry version number:", (unsigned) obj_dir_vers); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Shared header version number:", (unsigned) share_head_vers); + HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, + "Size of file offsets (haddr_t type):", (unsigned) f->shared->sizeof_addr); + HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, + "Size of file lengths (hsize_t type):", (unsigned) f->shared->sizeof_size); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Symbol table leaf node 1/2 rank:", f->shared->sym_leaf_k); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Symbol table internal node 1/2 rank:", + f->shared->btree_k[H5B_SNODE_ID]); + HDfprintf(stream, "%*s%-*s 0x%08lx\n", indent, "", fwidth, + "File consistency flags:", + (unsigned long) (f->shared->consist_flags)); + HDfprintf(stream, "%*s%-*s %a (abs)\n", indent, "", fwidth, + "Base address:", f->shared->base_addr); + HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth, + "Free list address:", f->shared->freespace_addr); + + HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth, + "Address of driver information block:", f->shared->driver_addr); + + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Root group symbol table entry:", + f->shared->root_grp ? "" : "(none)"); + if (f->shared->root_grp) { + H5G_ent_debug(f, dxpl_id, H5G_entof(f->shared->root_grp), stream, + indent+3, MAX(0, fwidth-3), HADDR_UNDEF); + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} + diff --git a/src/hdf5.lnt b/src/hdf5.lnt new file mode 100755 index 0000000..aa8f241 --- /dev/null +++ b/src/hdf5.lnt @@ -0,0 +1,103 @@ +// Lint options shared by both PC-Lint for Windows and Flexelint for Linux + +// Turn off warnings about not using the inlined H5V* functions: +-esym(528, H5V_vector_reduce_product, H5V_vector_inc) +-esym(528, H5V_vector_cmp, H5V_vector_cmp_s, H5V_vector_cmp_u) +-esym(528, H5V_vector_zerop_s, H5V_vector_zerop_u) + +// Suppress message about using 'goto' in a few functions +-efunc(801,H5_term_library,H5_trace) + +// Suppress message about "boolean test of a paranthesized assignment" +-efunc(820,H5_term_library) + +// Suppress message about "Constant value boolean" in FUNC_ENTER* macros +-emacro(506,FUNC_ENTER_API,FUNC_ENTER_API_NOCLEAR, FUNC_ENTER_NOAPI) + +// Suppress message about "Constant value boolean" in TRUE macros +-emacro(506,TRUE) + +// Suppress message about "Constant value boolean" in IS_H5FD_MPI* macros +-emacro(506,IS_H5FD_MPI) + +// Suppress message about "Boolean within 'if' always evaluates false" in IS_H5FD_MPI* macros +-emacro((774),IS_H5FD_MPI) + +// Suppress message about our use of 'goto' in our error macros +-emacro(801,HGOTO_DONE, H5Epush_goto) + +// Turn off warnings about not using the return value from these functions: +-esym(534, HDfprintf, HDsnprintf, HDvsnprintf) +-esym(534, H5E_clear_stack, H5E_push_stack) +-esym(534, H5FL_arr_free, H5FL_blk_free, H5FL_reg_free, H5FL_seq_free) +-esym(534, H5FS_push, H5FS_pop) +-esym(534, H5I_clear_type, H5I_dec_type_ref) +-esym(534, H5MM_xfree) +-esym(534, H5RC_decr) +-esym(534, H5TB_dfree) +-esym(534, H5V_array_fill) + +// Turn off warnings about not using PABLO_MASK macro +-esym(750, PABLO_MASK) + +// Turn off warnings about "Expression-like macro not parenthesized" for +// enumerated type increment & decrement macros: +-esym(773, H5_INC_ENUM, H5_DEC_ENUM) + +/* So far, the following files have been linted with these options: + H5.c + H5A.c + H5AC.c + H5B.c + + H5D.c + H5Dcompact.c + H5Dcontig.c + H5Defl.c + H5Dio.c + H5Distore.c + H5E.c + H5F.c + H5FD.c + H5FDcore.c + H5FDfamily.c + H5FDlog.c + H5FDmulti.c + H5FDsec2.c + H5FDstdio.c + H5FL.c + H5FO.c + + H5Tcommit.c + H5Tcompound.c + + H5Tcset.c + H5Tenum.c + H5Tfields.c + H5Tfixed.c + H5Tfloat.c + H5Tnative.c + H5Toffset.c + H5Topaque.c + H5Torder.c + H5Tpad.c + H5Tprecis.c + H5Tstrpad.c + H5Tvlen.c + H5V.c + H5Z.c + H5Zdeflate.c + H5Zfletcher32.c + H5Zshuffle.c + H5Zszip.c + + The following files have had their FUNC_ENTER, FUNC_LEAVE & HGOTO* + macros cleaned up and the PABLO_MASK adjusted, but have not been linted + due to their dependencies on features that we don't support on Windows: + H5FDfphdf5.c + H5FDgass.c + H5FDmpio.c + H5FDmpiposix.c + H5FDsrb.c + H5FDstream.c +*/ diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c new file mode 100644 index 0000000..26f25bf --- /dev/null +++ b/testpar/t_span_tree.c @@ -0,0 +1,762 @@ + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + This program will test irregular hyperslab selections with collective write and read. + The way to test whether collective write and read works is to use independent IO + output to verify the collective output. + + 1) We will write two datasets with the same hyperslab selection settings; + one in independent mode, + one in collective mode, + 2) We will read two datasets with the same hyperslab selection settings, + 1. independent read to read independent output, + independent read to read collecive output, + Compare the result, + If the result is the same, then collective write succeeds. + 2. collective read to read independent output, + independent read to read independent output, + Compare the result, + If the result is the same, then collective read succeeds. + + */ + +#include "hdf5.h" +#include "H5private.h" +#include "testphdf5.h" + + +static void coll_write_test(int chunk_factor); +static void coll_read_test(int chunk_factor); + + +/*------------------------------------------------------------------------- + * Function: coll_irregular_cont_write + * + * Purpose: Test the collectively irregular hyperslab write in contiguous + storage + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Unknown + * Dec 2nd, 2004 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +coll_irregular_cont_write(void) +{ + + coll_write_test(0); + +} + + + +/*------------------------------------------------------------------------- + * Function: coll_irregular_cont_read + * + * Purpose: Test the collectively irregular hyperslab read in contiguous + storage + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Unknown + * Dec 2nd, 2004 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +coll_irregular_cont_read(void) +{ + + coll_read_test(0); + +} + + +/*------------------------------------------------------------------------- + * Function: coll_irregular_simple_chunk_write + * + * Purpose: Test the collectively irregular hyperslab write in chunk + storage(1 chunk) + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Unknown + * Dec 2nd, 2004 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +coll_irregular_simple_chunk_write(void) +{ + + coll_write_test(1); + +} + + + +/*------------------------------------------------------------------------- + * Function: coll_irregular_simple_chunk_read + * + * Purpose: Test the collectively irregular hyperslab read in chunk + storage(1 chunk) + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Unknown + * Dec 2nd, 2004 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +coll_irregular_simple_chunk_read(void) +{ + + coll_read_test(1); + +} + +/*------------------------------------------------------------------------- + * Function: coll_irregular_complex_chunk_write + * + * Purpose: Test the collectively irregular hyperslab write in chunk + storage(4 chunks) + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Unknown + * Dec 2nd, 2004 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +coll_irregular_complex_chunk_write(void) +{ + + coll_write_test(4); + +} + + + +/*------------------------------------------------------------------------- + * Function: coll_irregular_complex_chunk_read + * + * Purpose: Test the collectively irregular hyperslab read in chunk + storage(1 chunk) + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Unknown + * Dec 2nd, 2004 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +coll_irregular_complex_chunk_read(void) +{ + + coll_read_test(4); + +} + + +void coll_write_test(int chunk_factor) +{ + + const char *filename; + hid_t acc_plist,xfer_plist; + hid_t file, datasetc,dataseti; /* File and dataset identifiers */ + hid_t mspaceid1, mspaceid, fspaceid,fspaceid1; /* Dataspace identifiers */ + hid_t plist; /* Dataset property list identifier */ + + hsize_t mdim1[] = {MSPACE1_DIM}; /* Dimension size of the first dataset + (in memory) */ + + hsize_t fsdim[] = {FSPACE_DIM1, FSPACE_DIM2}; + /* Dimension sizes of the dataset (on disk) */ + hsize_t mdim[] = {MSPACE_DIM1, MSPACE_DIM2}; /* Dimension sizes of the + dataset in memory when we + read selection from the + dataset on the disk */ + + hsize_t start[2]; /* Start of hyperslab */ + hsize_t stride[2]; /* Stride of hyperslab */ + hsize_t count[2]; /* Block count */ + hsize_t block[2]; /* Block sizes */ + hsize_t chunk_dims[RANK]; + + herr_t ret; + unsigned i,j; + int fillvalue = 0; /* Fill value for the dataset */ + + int matrix_out[MSPACE_DIM1][MSPACE_DIM2]; + int matrix_out1[MSPACE_DIM1][MSPACE_DIM2]; /* Buffer to read from the + dataset */ + int vector[MSPACE1_DIM]; + + int mpi_size,mpi_rank; + + MPI_Comm comm = MPI_COMM_WORLD; + MPI_Info info = MPI_INFO_NULL; + + /*set up MPI parameters */ + MPI_Comm_size(comm,&mpi_size); + MPI_Comm_rank(comm,&mpi_rank); + + + /* Obtain file name */ + filename = GetTestParameters(); + + /* + * Buffers' initialization. + */ + vector[0] = vector[MSPACE1_DIM - 1] = -1; + for (i = 1; i < MSPACE1_DIM - 1; i++) vector[i] = i; + + acc_plist = H5Pcreate(H5P_FILE_ACCESS); + VRFY((acc_plist >= 0),""); + + ret = H5Pset_fapl_mpio(acc_plist,comm,info); + VRFY((ret >= 0),"MPIO creation property list succeeded"); + + /* + * Create a file. + */ + file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_plist); + VRFY((file >= 0),"H5Fcreate succeeded"); + + /* + * Create property list for a dataset and set up fill values. + */ + plist = H5Pcreate(H5P_DATASET_CREATE); + VRFY((acc_plist >= 0),""); + + ret = H5Pset_fill_value(plist, H5T_NATIVE_INT, &fillvalue); + VRFY((ret >= 0),"Fill value creation property list succeeded"); + + if(chunk_factor != 0) { + + chunk_dims[0] = FSPACE_DIM1/chunk_factor; + chunk_dims[1] = FSPACE_DIM2/chunk_factor; + ret = H5Pset_chunk(plist, 2, chunk_dims); + VRFY((ret >= 0),"chunk creation property list succeeded"); + } + /* + * Create dataspace for the dataset in the file. + */ + fspaceid = H5Screate_simple(FSPACE_RANK, fsdim, NULL); + VRFY((fspaceid >= 0),"file dataspace created succeeded"); + + /* + * Create dataset in the file. Notice that creation + * property list plist is used. + */ + datasetc = H5Dcreate(file, "collect_write", H5T_NATIVE_INT, fspaceid, plist); + VRFY((datasetc >= 0),"dataset created succeeded"); + + dataseti = H5Dcreate(file, "independ_write", H5T_NATIVE_INT, fspaceid, plist); + VRFY((dataseti >= 0),"dataset created succeeded"); + /* + * Select hyperslab for the dataset in the file, using 3x2 blocks, + * (4,3) stride and (1,4) count starting at the position (0,1) + for the first selection + */ + + start[0] = FHSTART0; + start[1] = FHSTART1+mpi_rank*FHSTRIDE1*FHCOUNT1/mpi_size; + stride[0] = FHSTRIDE0; + stride[1] = FHSTRIDE1; + count[0] = FHCOUNT0; + count[1] = FHCOUNT1/mpi_size; + block[0] = FHBLOCK0; + block[1] = FHBLOCK1; + + ret = H5Sselect_hyperslab(fspaceid, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0),"hyperslab selection succeeded"); + + /* + * Select hyperslab for the dataset in the file, using 3x2*4 blocks, + * stride 1 and (1,1) count starting at the position (4,0). + */ + + start[0] = SHSTART0; + start[1] = SHSTART1+SHCOUNT1*SHBLOCK1*mpi_rank/mpi_size; + stride[0] = SHSTRIDE0; + stride[1] = SHSTRIDE1; + count[0] = SHCOUNT0; + count[1] = SHCOUNT1; + block[0] = SHBLOCK0; + block[1] = SHBLOCK1/mpi_size; + + ret = H5Sselect_hyperslab(fspaceid, H5S_SELECT_OR, start, stride, count, block); + VRFY((ret >= 0),"hyperslab selection succeeded"); + + /* + * Create dataspace for the first dataset. + */ + mspaceid1 = H5Screate_simple(MSPACE1_RANK, mdim1, NULL); + VRFY((mspaceid1 >= 0),"memory dataspace created succeeded"); + + /* + * Select hyperslab. + * We will use 48 elements of the vector buffer starting at the second element. + * Selected elements are 1 2 3 . . . 48 + */ + start[0] = MHSTART0; + stride[0] = MHSTRIDE0; + count[0] = MHCOUNT0/mpi_size; + block[0] = MHBLOCK0; + + ret = H5Sselect_hyperslab(mspaceid1, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0),"hyperslab selection succeeded"); + + + ret = H5Dwrite(dataseti, H5T_NATIVE_INT, mspaceid1, fspaceid, H5P_DEFAULT, vector); + VRFY((ret >= 0),"dataset independent write succeed"); + xfer_plist = H5Pcreate(H5P_DATASET_XFER); + VRFY((xfer_plist >= 0),""); + + ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); + VRFY((ret >= 0),"MPIO data transfer property list succeed"); + + + ret = H5Dwrite(datasetc, H5T_NATIVE_INT, mspaceid1, fspaceid, xfer_plist, vector); + /*ret = H5Dwrite(datasetc, H5T_NATIVE_INT, mspaceid1, fspaceid, H5P_DEFAULT, vector);*/ + VRFY((ret >= 0),"dataset collective write succeed"); + + ret = H5Sclose(mspaceid1); + VRFY((ret >= 0),""); + + ret = H5Sclose(fspaceid); + VRFY((ret >= 0),""); + + /* + * Close dataset. + */ + ret = H5Dclose(datasetc); + VRFY((ret >= 0),""); + ret = H5Dclose(dataseti); + VRFY((ret >= 0),""); + + /* + * Close the file. + */ + ret = H5Fclose(file); + VRFY((ret >= 0),""); + /* + * Close property list + */ + + ret = H5Pclose(acc_plist); + VRFY((ret >= 0),""); + ret = H5Pclose(xfer_plist); + VRFY((ret >= 0),""); + ret = H5Pclose(plist); + VRFY((ret >= 0),""); + + /* + * Open the file. + */ + + /*** For testing collective hyperslab selection write ***/ + + acc_plist = H5Pcreate(H5P_FILE_ACCESS); + VRFY((acc_plist >= 0),""); + + ret = H5Pset_fapl_mpio(acc_plist,comm,info); + VRFY((ret >= 0),"MPIO creation property list succeeded"); + + file = H5Fopen(filename, H5F_ACC_RDONLY, acc_plist); + VRFY((file >= 0),"H5Fopen succeeded"); + + /* + * Open the dataset. + */ + datasetc = H5Dopen(file,"collect_write"); + VRFY((datasetc >= 0),"H5Dopen succeeded"); + dataseti = H5Dopen(file,"independ_write"); + VRFY((dataseti >= 0),"H5Dopen succeeded"); + + /* + * Get dataspace of the open dataset. + */ + fspaceid = H5Dget_space(datasetc); + VRFY((fspaceid >= 0),"file dataspace obtained succeeded"); + + fspaceid1 = H5Dget_space(dataseti); + VRFY((fspaceid1 >= 0),"file dataspace obtained succeeded"); + + + + start[0] = RFFHSTART0; + start[1] = RFFHSTART1+mpi_rank*RFFHCOUNT1/mpi_size; + block[0] = RFFHBLOCK0; + block[1] = RFFHBLOCK1; + stride[0] = RFFHSTRIDE0; + stride[1] = RFFHSTRIDE1; + count[0] = RFFHCOUNT0; + count[1] = RFFHCOUNT1/mpi_size; + + + ret = H5Sselect_hyperslab(fspaceid, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0),"hyperslab selection succeeded"); + ret = H5Sselect_hyperslab(fspaceid1, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0),"hyperslab selection succeeded"); + + /*start[0] = RFSHSTART0+mpi_rank*RFSHCOUNT1/mpi_size; */ + start[0] = RFSHSTART0; + start[1] = RFSHSTART1+RFSHCOUNT1*mpi_rank/mpi_size; + block[0] = RFSHBLOCK0; + block[1] = RFSHBLOCK1; + stride[0] = RFSHSTRIDE0; + stride[1] = RFSHSTRIDE0; + count[0] = RFSHCOUNT0; + count[1] = RFSHCOUNT1/mpi_size; + ret = H5Sselect_hyperslab(fspaceid, H5S_SELECT_OR, start, stride, count, block); + VRFY((ret >= 0),"hyperslab selection succeeded"); + ret = H5Sselect_hyperslab(fspaceid1, H5S_SELECT_OR, start, stride, count, block); + VRFY((ret >= 0),"hyperslab selection succeeded"); + + + /* + * Create memory dataspace. + */ + mspaceid = H5Screate_simple(MSPACE_RANK, mdim, NULL); + + /* + * Select two hyperslabs in memory. Hyperslabs has the same + * size and shape as the selected hyperslabs for the file dataspace. + */ + + + start[0] = RMFHSTART0; + start[1] = RMFHSTART1+mpi_rank*RMFHCOUNT1/mpi_size; + block[0] = RMFHBLOCK0; + block[1] = RMFHBLOCK1; + stride[0] = RMFHSTRIDE0; + stride[1] = RMFHSTRIDE1; + count[0] = RMFHCOUNT0; + count[1] = RMFHCOUNT1/mpi_size; + ret = H5Sselect_hyperslab(mspaceid, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0),"hyperslab selection succeeded"); + + start[0] = RMSHSTART0; + start[1] = RMSHSTART1+mpi_rank*RMSHCOUNT1/mpi_size; + block[0] = RMSHBLOCK0; + block[1] = RMSHBLOCK1; + stride[0] = RMSHSTRIDE0; + stride[1] = RMSHSTRIDE1; + count[0] = RMSHCOUNT0; + count[1] = RMSHCOUNT1/mpi_size; + + + ret = H5Sselect_hyperslab(mspaceid, H5S_SELECT_OR, start, stride, count, block); + VRFY((ret >= 0),"hyperslab selection succeeded"); + + /* + * Initialize data buffer. + */ + for (i = 0; i < MSPACE_DIM1; i++) { + for (j = 0; j < MSPACE_DIM2; j++) + matrix_out[i][j] = 0; + } + + /* + * Read data back to the buffer matrix_out. + */ + + ret = H5Dread(datasetc, H5T_NATIVE_INT, mspaceid, fspaceid, + H5P_DEFAULT, matrix_out); + VRFY((ret >= 0),"H5D independent read succeed"); + + + for (i = 0; i < MSPACE_DIM1; i++) { + for (j = 0; j < MSPACE_DIM2; j++) + matrix_out1[i][j] = 0; + } + ret = H5Dread(dataseti, H5T_NATIVE_INT, mspaceid, fspaceid, + H5P_DEFAULT, matrix_out1); + VRFY((ret >= 0),"H5D independent read succeed"); + + ret = 0; + for (i = 0; i < MSPACE_DIM1; i++){ + for (j = 0; j < MSPACE_DIM2; j++){ + if(matrix_out[i][j]!=matrix_out1[i][j]) ret = -1; + if(ret < 0) break; + } + } + VRFY((ret >= 0),"H5D contiguous irregular collective write succeed"); + + /* + * Close memory file and memory dataspaces. + */ + ret = H5Sclose(mspaceid); + VRFY((ret >= 0),""); + ret = H5Sclose(fspaceid); + VRFY((ret >= 0),""); + + /* + * Close dataset. + */ + ret = H5Dclose(dataseti); + VRFY((ret >= 0),""); + + ret = H5Dclose(datasetc); + VRFY((ret >= 0),""); + /* + * Close property list + */ + + ret = H5Pclose(acc_plist); + VRFY((ret >= 0),""); + + + /* + * Close the file. + */ + ret = H5Fclose(file); + VRFY((ret >= 0),""); + + return ; +} + + +void coll_read_test(int chunk_factor) +{ + + const char *filename; + hid_t acc_plist,xfer_plist; + hid_t file, dataseti; /* File and dataset identifiers */ + hid_t mspaceid, fspaceid1; /* Dataspace identifiers */ + + /* Dimension sizes of the dataset (on disk) */ + hsize_t mdim[] = {MSPACE_DIM1, MSPACE_DIM2}; /* Dimension sizes of the + dataset in memory when we + read selection from the + dataset on the disk */ + + hsize_t start[2]; /* Start of hyperslab */ + hsize_t stride[2]; /* Stride of hyperslab */ + hsize_t count[2]; /* Block count */ + hsize_t block[2]; /* Block sizes */ + + herr_t ret; + unsigned i,j; + + int matrix_out[MSPACE_DIM1][MSPACE_DIM2]; + int matrix_out1[MSPACE_DIM1][MSPACE_DIM2]; /* Buffer to read from the + dataset */ + + int mpi_size,mpi_rank; + + MPI_Comm comm = MPI_COMM_WORLD; + MPI_Info info = MPI_INFO_NULL; + + /*set up MPI parameters */ + MPI_Comm_size(comm,&mpi_size); + MPI_Comm_rank(comm,&mpi_rank); + + + /* Obtain file name */ + filename = GetTestParameters(); + + /* + * Buffers' initialization. + */ + + /* + * Open the file. + */ + + /*** For testing collective hyperslab selection read ***/ + + acc_plist = H5Pcreate(H5P_FILE_ACCESS); + VRFY((acc_plist >= 0),""); + + ret = H5Pset_fapl_mpio(acc_plist,comm,info); + VRFY((ret >= 0),"MPIO creation property list succeeded"); + + file = H5Fopen(filename, H5F_ACC_RDONLY, acc_plist); + VRFY((file >= 0),"H5Fopen succeeded"); + + /* + * Open the dataset. + */ + dataseti = H5Dopen(file,"independ_write"); + VRFY((dataseti >= 0),"H5Dopen succeeded"); + + /* + * Get dataspace of the open dataset. + */ + + fspaceid1 = H5Dget_space(dataseti); + VRFY((fspaceid1 >= 0),"file dataspace obtained succeeded"); + + start[0] = RFFHSTART0; + start[1] = RFFHSTART1+mpi_rank*RFFHCOUNT1/mpi_size; + block[0] = RFFHBLOCK0; + block[1] = RFFHBLOCK1; + stride[0] = RFFHSTRIDE0; + stride[1] = RFFHSTRIDE1; + count[0] = RFFHCOUNT0; + count[1] = RFFHCOUNT1/mpi_size; + + ret = H5Sselect_hyperslab(fspaceid1, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0),"hyperslab selection succeeded"); + + + start[0] = RFSHSTART0; + start[1] = RFSHSTART1+RFSHCOUNT1*mpi_rank/mpi_size; + block[0] = RFSHBLOCK0; + block[1] = RFSHBLOCK1; + stride[0] = RFSHSTRIDE0; + stride[1] = RFSHSTRIDE0; + count[0] = RFSHCOUNT0; + count[1] = RFSHCOUNT1/mpi_size; + + ret = H5Sselect_hyperslab(fspaceid1, H5S_SELECT_OR, start, stride, count, block); + VRFY((ret >= 0),"hyperslab selection succeeded"); + + + /* + * Create memory dataspace. + */ + mspaceid = H5Screate_simple(MSPACE_RANK, mdim, NULL); + + /* + * Select two hyperslabs in memory. Hyperslabs has the same + * size and shape as the selected hyperslabs for the file dataspace. + */ + + start[0] = RMFHSTART0; + start[1] = RMFHSTART1+mpi_rank*RMFHCOUNT1/mpi_size; + block[0] = RMFHBLOCK0; + block[1] = RMFHBLOCK1; + stride[0] = RMFHSTRIDE0; + stride[1] = RMFHSTRIDE1; + count[0] = RMFHCOUNT0; + count[1] = RMFHCOUNT1/mpi_size; + ret = H5Sselect_hyperslab(mspaceid, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0),"hyperslab selection succeeded"); + + start[0] = RMSHSTART0; + start[1] = RMSHSTART1+mpi_rank*RMSHCOUNT1/mpi_size; + block[0] = RMSHBLOCK0; + block[1] = RMSHBLOCK1; + stride[0] = RMSHSTRIDE0; + stride[1] = RMSHSTRIDE1; + count[0] = RMSHCOUNT0; + count[1] = RMSHCOUNT1/mpi_size; + ret = H5Sselect_hyperslab(mspaceid, H5S_SELECT_OR, start, stride, count, block); + VRFY((ret >= 0),"hyperslab selection succeeded"); + + /* + * Initialize data buffer. + */ + for (i = 0; i < MSPACE_DIM1; i++) { + for (j = 0; j < MSPACE_DIM2; j++) + matrix_out[i][j] = 0; + } + + /* + * Read data back to the buffer matrix_out. + */ + + xfer_plist = H5Pcreate(H5P_DATASET_XFER); + VRFY((xfer_plist >= 0),""); + + ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); + VRFY((ret >= 0),"MPIO data transfer property list succeed"); + + ret = H5Dread(dataseti, H5T_NATIVE_INT, mspaceid, fspaceid1, + xfer_plist, matrix_out); + VRFY((ret >= 0),"H5D collecive read succeed"); + + ret = H5Pclose(xfer_plist); + VRFY((ret >= 0),""); + + for (i = 0; i < MSPACE_DIM1; i++) { + for (j = 0; j < MSPACE_DIM2; j++) + matrix_out1[i][j] = 0; + } + ret = H5Dread(dataseti, H5T_NATIVE_INT, mspaceid, fspaceid1, + H5P_DEFAULT, matrix_out1); + + VRFY((ret >= 0),"H5D independent read succeed"); + ret = 0; + for (i = 0; i < MSPACE_DIM1; i++){ + for (j = 0; j < MSPACE_DIM2; j++){ + if(matrix_out[i][j]!=matrix_out1[i][j])ret = -1; + if(ret < 0) break; + } + } + VRFY((ret >= 0),"H5D contiguous irregular collective read succeed"); + + /* + * Close memory file and memory dataspaces. + */ + ret = H5Sclose(mspaceid); + VRFY((ret >= 0),""); + ret = H5Sclose(fspaceid1); + VRFY((ret >= 0),""); + + /* + * Close dataset. + */ + ret = H5Dclose(dataseti); + VRFY((ret >= 0),""); + /* + * Close property list + */ + ret = H5Pclose(acc_plist); + VRFY((ret >= 0),""); + + + /* + * Close the file. + */ + ret = H5Fclose(file); + VRFY((ret >= 0),""); + + return ; +} diff --git a/tools/h5repack/testh5repack_detect_szip.c b/tools/h5repack/testh5repack_detect_szip.c new file mode 100644 index 0000000..4f12c40 --- /dev/null +++ b/tools/h5repack/testh5repack_detect_szip.c @@ -0,0 +1,51 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +#include "hdf5.h" +#include "h5test.h" +#include "h5repack.h" + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: detects szip encoder, prints "yes" or "no" to stdout. + * Intended to be used in test scripts. + * + * Return: + * + * Programmer: + * + * Date: + * + * Comments: + * + * Modifications: + * + *------------------------------------------------------------------------- + */ + + +int main(void) +{ +#ifdef H5_HAVE_FILTER_SZIP + if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { + printf("yes\n"); + return(1); + } +#endif /* H5_HAVE_FILTER_SZIP */ + printf("no\n"); + return(0); +} -- cgit v0.12