From 5f6808947a9eb66539d76f8c23874eaf0f63e66c Mon Sep 17 00:00:00 2001 From: Marc Howison Date: Tue, 20 Jul 2010 18:23:48 +0000 Subject: [PATCH] added h5hutcc wrapper updated documentation finished merging the Fortran interface and refactoring H5Block started an H5Block regression test --- .gitattributes | 1 + COPYING | 2 +- configure.ac | 83 ++++----- doc/Doxyfile | 27 ++- doc/H5.dox | 129 +++++++++++--- src/C++/Makefile.am | 10 +- src/C/H5.c | 44 ++--- src/C/H5Block.c | 154 +++++++++++++---- src/C/H5Part.c | 72 ++------ src/C/H5_attribs.c | 48 +++--- src/C/Makefile.am | 6 +- src/C/generate-h5b-readwrite.py | 12 +- src/Fortran/H5.f90 | 46 ++--- src/Fortran/H5Block.f90 | 176 ++++--------------- src/Fortran/H5Block_F.c | 21 +-- src/Fortran/H5Block_readwrite.f90 | 48 +++--- src/Fortran/H5Part.f90 | 38 ++-- src/Fortran/H5_attribs.f90 | 48 +++--- src/Fortran/Makefile.am | 6 +- src/h5core/Makefile.am | 6 +- src/h5core/h5_mpi.c | 35 +++- src/h5core/h5_mpi_private.h | 20 +++ src/h5core/h5_types_private.h | 6 +- src/h5core/h5b_attribs.c | 9 - src/h5core/h5b_model.c | 232 +++++++++++++++++++------ src/h5core/h5b_readwrite.c | 2 +- src/h5core/h5b_types_private.h | 6 + src/include/H5.h | 2 - src/include/H5Block.h | 71 +++++--- src/include/H5hut.h | 2 + src/include/h5core/h5b_model.h | 122 +++++++++---- test/Makefile.am | 7 +- test/h5b_read.c | 86 ++++++++++ test/h5b_test.c | 22 ++- test/h5b_write.c | 87 ++++++++++ tools/Makefile.am | 7 +- tools/h5hutcc.in | 276 ++++++++++++++++++++++++++++++ 37 files changed, 1322 insertions(+), 647 deletions(-) create mode 100755 tools/h5hutcc.in diff --git a/.gitattributes b/.gitattributes index dab20d7..7159fb1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -554,6 +554,7 @@ tools/H5PartMerge/src/optparse.cpp -text tools/H5PartMerge/src/optparse.hh -text tools/Makefile.am -text tools/README -text +tools/h5hutcc.in -text tools/h5pAttrib.cc -text tools/h5pToGNUplot.cc -text tools/homdynToH5p.cc -text diff --git a/COPYING b/COPYING index f78c0f0..59c0886 100644 --- a/COPYING +++ b/COPYING @@ -1,6 +1,6 @@ *** Copyright Notice *** -H5Part Copyright (c) 2006-2009, The Regents of the University of California, +H5hut Copyright (c) 2006-2010, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy) and the Paul Scherrer Institut (Switzerland). All rights reserved. diff --git a/configure.ac b/configure.ac index c23465a..94a973b 100644 --- a/configure.ac +++ b/configure.ac @@ -77,13 +77,13 @@ SAVE_FC=$FC SAVE_MPICC=$MPICC SAVE_MPICXX=$MPICXX SAVE_MPIFC=$MPIFC -SAVE_MPILIB=$MPILIB -SAVE_MPIINC=$MPIINC SAVE_CFLAGS=$CFLAGS SAVE_FFLAGS=$FFLAGS +SAVE_INCLUDES=$INCLUDES +SAVE_LDFLAGS=$LDFLAGS +SAVE_LIBS=$LIBS SAVE_MPIROOT=$MPIROOT SAVE_HDF5ROOT=$HDF5ROOT -SAVE_LDFLAGS=$LDFLAGS ############################################################################### ############### PATH SERACH FUNCTION - to be used later... #################### @@ -241,7 +241,7 @@ AC_MSG_CHECKING([if parallel interface enabled]) if test "X$USE_PARALLEL" = "Xyes"; then AC_MSG_RESULT([yes]) - CFLAGS="${CFLAGS} -DPARALLEL_IO -DH5_HAVE_PARALLEL -DMPICH_IGNORE_CXX_SEEK" + CFLAGS="${CFLAGS} -DPARALLEL_IO -DMPICH_IGNORE_CXX_SEEK" AC_MSG_CHECKING([if we can compile MPI code without setting flags]) AC_TRY_LINK([#include "mpi.h"], [ @@ -288,8 +288,7 @@ if test "X$USE_PARALLEL" = "Xyes"; then fi if test -z "$MPICC" -o -z "$MPICXX"; then - MPIINC="${MPIINC} -I${MPIROOT}/include" - FFLAGS="${FFLAGS} -I${MPIROOT}/include" + INCLUDES="${INCLUDES} -I${MPIROOT}/include" AC_MSG_CHECKING([for name of MPI lib ]) if test -e ${MPIROOT}/lib/libmpi.a; then MPILIB="-L${MPIROOT}/lib -lmpi" @@ -391,24 +390,21 @@ if test -z "$HDF5ROOT"; then exit 1 fi +INCLUDES="$INCLUDES -I$HDF5ROOT/include" +LDFLAGS="$LDFLAGS -L$HDF5ROOT/lib" +LIBS="$LIBS -lhdf5" + AC_MSG_CHECKING([if we need to link to libsz ]) if test -n "$HDF5ROOT"; then if test -f $HDF5ROOT/lib/libsz.a; then AC_MSG_RESULT([yes]) - SZLIB="-L$HDF5ROOT/lib/ -lsz" + LDFLAGS="$LDFLAGS -L$HDF5ROOT/lib" + LIBS="$LIBS -lsz" else AC_MSG_RESULT([no]) - SZLIB="" fi fi -AC_MSG_CHECKING([for static zlib root ]) -AC_MSG_RESULT([ ]) -PATH_Search ZLIBROOT '/apps/zlib' lib/libz.a -if test -n "$ZLIBROOT"; then - LDFLAGS="$LDFLAGS -L$ZLIBROOT/lib" -fi - AC_MSG_CHECKING([for lustre API ]) AC_MSG_RESULT([]) if test -n "${LUSTREPATH}"; then @@ -427,8 +423,13 @@ if test -z "$LUSTREROOT"; then AC_MSG_WARN([Couldn't locate the lustre API... building without support for lustre striping!]) else CFLAGS="$CFLAGS -DH5_USE_LUSTRE" + INCLUDES="$INCLUDES -I$LUSTREROOT/include" + LDFLAGS="LDFLAGS -L$LUSTREROOT/lib" + LIBS="$LIBS -llustreapi" fi +LIBS="$LIBS -lz -lm" + ############################################################################### ################# A SIMPLE WORK AROUND TO USE ENV. VARS ####################### @@ -459,14 +460,6 @@ if test -n "$SAVE_MPIFC"; then MPIFC=$SAVE_MPIFC fi -if test -n "$SAVE_MPILIB"; then - MPILIB=$SAVE_MPILIB -fi - -if test -n "$SAVE_MPIINC"; then - MPIINC=$SAVE_MPIINC -fi - if test -n "$SAVE_CFLAGS"; then CFLAGS=$SAVE_CFLAGS $CFLAGS fi @@ -475,6 +468,18 @@ if test -n "$SAVE_FFLAGS"; then FFLAGS=$SAVE_FFLAGS fi +if test -n "$SAVE_INCLUDES"; then + INCLUDES=$SAVE_INCLUDES +fi + +if test -n "$SAVE_LDFLAGS"; then + LDFLAGS=$SAVE_LDFLAGS +fi + +if test -n "$SAVE_LIBS"; then + LIBS=$SAVE_LIBS +fi + if test -n "$SAVE_MPIROOT"; then MPIROOT=$SAVE_MPIROOT fi @@ -483,39 +488,34 @@ if test -n "$SAVE_HDF5ROOT"; then HDF5ROOT=$SAVE_HDF5ROOT fi -if test -n "$SAVE_LDFLAGS"; then - LDFLAGS=$SAVE_LDFLAGS -fi - ############################################################################### ############## EXPORTING VARIABLES & CREATING OUTPUT FILES #################### ############################################################################### # AC_SUBST (variable, [value]) -# Create an output variable from a shell variable. -# Make AC_OUTPUT substitute the variable variable into output files (typically one or more `Makefile's). -# This means that AC_OUTPUT will replace instances of `@variable@' in input files with the value that -# the shell variable variable has when AC_OUTPUT is called. -# This value of variable should not contain literal newlines. -# If value is given, in addition assign it to variable. +# Create an output variable from a shell variable. Make AC_OUTPUT substitute +# the variable variable into output files (typically one or more `Makefile's). +# This means that AC_OUTPUT will replace instances of `@variable@' in input +# files with the value that the shell variable variable has when AC_OUTPUT is +# called. This value of variable should not contain literal newlines. If +# value is given, in addition assign it to variable. AC_SUBST(MPIROOT) AC_SUBST(HDF5ROOT) AC_SUBST(LUSTREROOT) -AC_SUBST(MPIINC) -AC_SUBST(MPILIB) AC_SUBST(MPICC) AC_SUBST(MPICXX) AC_SUBST(MPIFC) AC_SUBST(TPTARGET) AC_SUBST(TBTARGET) AC_SUBST(TFTARGET) -AC_SUBST(SZLIB) AC_SUBST(CFLAGS) AC_SUBST(FFLAGS) +AC_SUBST(INCLUDES) +AC_SUBST(LDFLAGS) +AC_SUBST(LIBS) AC_SUBST(STDCXX) AC_SUBST(UNDERSCORE_H) AC_SUBST(BUILD_TOOLS) AC_SUBST(FORTRAN_LIB) -AC_SUBST(LDFLAGS) # Make AC_OUTPUT create each `file' by copying an input file (by default `file.in'), # substituting the output variable values. @@ -531,6 +531,7 @@ AC_CONFIG_FILES([ test/H5Block/Makefile test/H5Fed/Makefile tools/Makefile + tools/h5hutcc ]) AC_OUTPUT @@ -544,7 +545,7 @@ AC_MSG_RESULT([ ]) AC_MSG_RESULT([Host OS: $host_os]) AC_MSG_RESULT([Host CPU: $host_cpu]) AC_MSG_RESULT([Host vendor: $host_vendor]) -AC_MSG_RESULT([Build libraries: libH5Core.a libH5hutC.a $FORTRAN_LIB]) +AC_MSG_RESULT([Build libraries: libH5hut.a libH5hutC.a $FORTRAN_LIB]) AC_MSG_RESULT([Build test programs: $TTARGET]) AC_MSG_RESULT([Build tools: $BUILD_TOOLS]) AC_MSG_RESULT([CC = $CC]) @@ -555,10 +556,10 @@ AC_MSG_RESULT([MPICXX = $MPICXX]) AC_MSG_RESULT([MPIFC = $MPIFC]) AC_MSG_RESULT([CFLAGS = $CFLAGS]) AC_MSG_RESULT([FFLAGS = $FFLAGS]) -AC_MSG_RESULT([MPILIB = $MPILIB]) -AC_MSG_RESULT([MPIINC = $MPIINC]) +AC_MSG_RESULT([INCLUDES = $INCLUDES]) +AC_MSG_RESULT([LDFLAGS = $LDFLAGS]) +AC_MSG_RESULT([LIBS = $LIBS]) AC_MSG_RESULT([MPIROOT = $MPIROOT]) AC_MSG_RESULT([HDF5ROOT = $HDF5ROOT]) AC_MSG_RESULT([LUSTREROOT = $LUSTREROOT]) -AC_MSG_RESULT([LDFLAGS = $LDFLAGS]) AC_MSG_RESULT([ ]) diff --git a/doc/Doxyfile b/doc/Doxyfile index 62f07a8..bee0813 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -3,8 +3,8 @@ #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = H5Part -PROJECT_NUMBER = 1.5.x +PROJECT_NAME = H5hut +PROJECT_NUMBER = 1.9.9 OUTPUT_DIRECTORY = ./ReferencePages CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English @@ -32,7 +32,7 @@ JAVADOC_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO DETAILS_AT_TOP = NO INHERIT_DOCS = YES -SEPARATE_MEMBER_PAGES = YES +SEPARATE_MEMBER_PAGES = NO TAB_SIZE = 8 ALIASES = OPTIMIZE_OUTPUT_FOR_C = YES @@ -83,12 +83,9 @@ WARN_LOGFILE = # configuration options related to the input files #--------------------------------------------------------------------------- INPUT += H5.dox -INPUT += ../src/h5_core/h5_attribs.c -INPUT += ../src/h5_core/h5_errorhandling.c -INPUT += ../src/H5.c -INPUT += ../src/H5Part.c -INPUT += ../src/H5Block.c -INPUT += ../src/H5Fed.c +INPUT += ../src/h5core/ +INPUT += ../src/C/ +INPUT += ../src/Fortran/ FILE_PATTERNS = RECURSIVE = YES EXCLUDE = @@ -123,8 +120,8 @@ IGNORE_PREFIX = GENERATE_HTML = YES HTML_OUTPUT = . HTML_FILE_EXTENSION = .html -HTML_HEADER = doxyheader -HTML_FOOTER = doxyfooter +HTML_HEADER = +HTML_FOOTER = HTML_STYLESHEET = HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO @@ -133,7 +130,7 @@ HHC_LOCATION = GENERATE_CHI = NO BINARY_TOC = NO TOC_EXPAND = NO -DISABLE_INDEX = YES +DISABLE_INDEX = NO ENUM_VALUES_PER_LINE = 4 GENERATE_TREEVIEW = NO TREEVIEW_WIDTH = 250 @@ -196,7 +193,7 @@ EXPAND_ONLY_PREDEF = NO SEARCH_INCLUDES = YES INCLUDE_PATH = INCLUDE_FILE_PATTERNS = -PREDEFINED = +PREDEFINED = PARALLEL_IO EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- @@ -212,7 +209,7 @@ PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- CLASS_DIAGRAMS = NO HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = YES +HAVE_DOT = NO CLASS_GRAPH = NO COLLABORATION_GRAPH = NO GROUP_GRAPHS = NO @@ -224,7 +221,7 @@ CALL_GRAPH = NO GRAPHICAL_HIERARCHY = NO DIRECTORY_GRAPH = NO DOT_IMAGE_FORMAT = png -DOT_PATH = /Applications/Graphviz.app/Contents/MacOS +DOT_PATH = DOTFILE_DIRS = MAX_DOT_GRAPH_WIDTH = 1024 MAX_DOT_GRAPH_HEIGHT = 1024 diff --git a/doc/H5.dox b/doc/H5.dox index eb2e8bb..156b6e9 100644 --- a/doc/H5.dox +++ b/doc/H5.dox @@ -1,50 +1,139 @@ -/*! \mainpage H5Part: A Portable High Performance Parallel Data Interface to HDF5 +/*! +\mainpage H5hut: A High-Performance I/O Library for Particle-based Simulations -Particle based simulations of accelerator beam-lines, especially in -six dimensional phase space, generate vast amounts of data. Even -though a subset of statistical information regarding phase space or -analysis needs to be preserved, reading and writing such enormous -restart files on massively parallel supercomputing systems remains -challenging. +Particle-based simulations running on large high-performance computing systems +over many time steps can generate an enormous amount of particle- and +field-based data for post-processing and analysis. Achieving high-performance +I/O for this data, effectively managing it on disk, and interfacing it with +analysis and visualization tools can be challenging, especially for domain +scientists who do not have I/O and data management expertise. We present the +H5hut library, an implementation of several data models for particle-based +simulations that encapsulates the complexity of HDF5 and is simple to use, yet +does not compromise performance. -H5Part consists of Particles and Block structured Fields. - -Developed by: +Developers: -
  • Wes Bethel (NERSC/LBNL)
  • +Previous developers: + + -For further information contact: h5part +For more information, please contact the h5part mailing list. -Last modified on April 19, 2007. - -*/ - - -/*! - \defgroup h5_core H5 core functions */ /*! - \defgroup h5_c_api H5 C API + \defgroup h5hut_c_api H5hut C API */ +/*! + \ingroup h5hut_c_api + \defgroup h5hut_file File Handling +*/ +/*! + \ingroup h5hut_c_api + \defgroup h5hut_error Error Handling +*/ +/*! + \ingroup h5hut_c_api + \defgroup h5hut_model Setting up the Data Model +*/ +/*! + \ingroup h5hut_c_api + \defgroup h5hut_attrib Reading and Writing Attributes +*/ + /*! \defgroup h5part_c_api H5Part C API */ +/*! + \ingroup h5part_c_api + \defgroup h5part_model Setting up the Data Model +*/ +/*! + \ingroup h5part_c_api + \defgroup h5part_data Reading and Writing Datasets +*/ + /*! \defgroup h5block_c_api H5Block C API */ +*/! + \ingroup h5block_c_api + \defgroup h5block_model Setting up the Data Model +*/ + \ingroup h5block_c_api + \defgroup h5block_data Reading and Writing Datasets +*/ + \ingroup h5block_c_api + \defgroup h5block_attrib Reading and Writing Attributes +*/ + + /*! \defgroup h5fed_c_api H5Fed C API */ + +/*! + \defgroup h5hut_f90_api H5hut F90 API +*/ + +/*! + \ingroup h5hut_f90_api + \defgroup h5hut_file_f File Handling +*/ + +/*! + \ingroup h5hut_f90_api + \defgroup h5hut_model_f Setting up the Data Model +*/ + +/*! + \ingroup h5hut_f90_api + \defgroup h5hut_attrib_f Reading and Writing Attributes +!< + + +/*! + \defgroup h5part_f90_api H5Part F90 API +*/ +/*! + \ingroup h5part_f90_api + \defgroup h5part_model_f Setting up the Data Model +*/ +/*! + \ingroup h5part_f90_api + \defgroup h5part_data_f Reading and Writing Datasets +*/ + + +/*! + \defgroup h5block_f90_api H5Block F90 API +*/ +/*! + \ingroup h5block_f90_api + \defgroup h5block_model_f Setting up the Data Model +*/ +/*! + \ingroup h5block_f90_api + \defgroup h5block_data_f Reading and Writing Datasets +*/ +/*! + \ingroup h5block_f90_api + \defgroup h5block_attrib_f Reading and Writing Attributes +*/ + diff --git a/src/C++/Makefile.am b/src/C++/Makefile.am index f759e7a..3f24f4b 100644 --- a/src/C++/Makefile.am +++ b/src/C++/Makefile.am @@ -1,16 +1,12 @@ -HDF5ROOT = @HDF5ROOT@ - # COMPILERS CC = @CC@ CXX = @CXX@ -HDF5INC = -I@HDF5ROOT@/include -MPIINC = -I@MPIROOT@/include -INCL = $(HDF5INC) ${MPIINC} -I../../ - -CFLAGS = @CFLAGS@ $(INCL) +LIBS = @LIBS@ +INCLUDES = -I../include @INCLUDES@ OBJEXT = o + lib_LIBRARIES = libH5XX.a include_HEADERS = H5Fed.hh libH5XX_a_SOURCES = H5Fed.cc diff --git a/src/C/H5.c b/src/C/H5.c index 837e7a6..ea37040 100644 --- a/src/C/H5.c +++ b/src/C/H5.c @@ -30,19 +30,13 @@ functions. */ - -/*! - \ingroup h5_c_api - \defgroup h5_c_api_general -*/ - #include "h5core/h5_core.h" #include "H5.h" /****** General routines *****************************************************/ /*! - \ingroup h5_c_api_general + \ingroup h5hut_file Open file with name \c filename. This function is available in the parallel and serial version. In the serial case \c comm may have any value. @@ -60,7 +54,7 @@ H5OpenFile ( } /*! - \ingroup h5_c_api_general + \ingroup h5hut_file Close file. @@ -75,7 +69,7 @@ H5CloseFile ( } /*! - \ingroup h5_c_api_general + \ingroup h5hut_file Close file. @@ -90,7 +84,7 @@ H5CheckFile ( } /*! - \ingroup h5_c_api_general + \ingroup h5hut_model Define format of the step names. @@ -111,7 +105,7 @@ H5SetStepNameFormat ( } /*! - \ingroup h5_c_api_general + \ingroup h5hut_model Get format of the step names. @@ -131,7 +125,7 @@ H5GetStepNameFormat ( } /*! - \ingroup h5_c_api_general + \ingroup h5hut_model Set the current step. @@ -148,7 +142,7 @@ H5SetStep ( } /*! - \ingroup h5_c_api_general + \ingroup h5hut_model Get current step. @@ -164,7 +158,7 @@ H5GetStep ( } /*! - \ingroup h5_inquiry + \ingroup h5hut_file Get the number of processors. @@ -182,7 +176,7 @@ H5GetNumProcs ( } /*! - \ingroup h5part_c_api_read + \ingroup h5hut_model Get the number of time-steps that are currently stored in the file \c f. @@ -226,7 +220,7 @@ H5HasStep ( } /*! - \ingroup h5_c_api_general + \ingroup h5hut_model Start traversing steps. @@ -243,7 +237,7 @@ H5StartTraverseSteps ( } /*! - \ingroup h5_c_api_general + \ingroup h5hut_model Traverse steps. @@ -260,7 +254,7 @@ H5TraverseSteps ( } /*! - \ingroup h5part_performance + \ingroup h5hut_file Set the `throttle` factor, which causes HDF5 write and read calls to be issued in that number of batches. @@ -289,12 +283,7 @@ H5SetThrottle ( #endif // PARALLEL_IO /*! - \ingroup h5part_c_api - \defgroup h5part_c_api_errhandling Error Handling -*/ - -/*! - \ingroup h5part_c_api_errhandling + \ingroup h5hut_error Set verbosity level to \c level. @@ -308,7 +297,7 @@ H5SetVerbosityLevel ( } /*! - \ingroup h5part_c_api_errhandling + \ingroup h5hut_error Set error handler to \c handler. @@ -322,7 +311,7 @@ H5SetErrorHandler ( } /*! - \ingroup h5part_c_api_errhandling + \ingroup h5hut_error Get current error handler. @@ -354,7 +343,7 @@ H5AbortErrorhandler ( } /*! - \ingroup h5part_c_api_errhandling + \ingroup h5hut_error Get last error code. @@ -366,6 +355,5 @@ H5GetErrno ( ) { return h5_get_errno (f); } -/*! @} */ diff --git a/src/C/H5Block.c b/src/C/H5Block.c index d48b2b4..0393f5e 100644 --- a/src/C/H5Block.c +++ b/src/C/H5Block.c @@ -59,6 +59,23 @@ /********************** defining the layout **********************************/ +/*! + \ingroup h5block_model + + Tests whether a view has been set, either directly with + \ref H5Block3dSetView or indirectly with \ref H5Block3dSetGrid. + + \return 0 on false, 1 on true +*/ +h5_int64_t +H5Block3dHasView ( + h5_file_t *const f /*!< IN: File handle */ + ) { + + SET_FNAME( f, __func__ ); + + return h5b_3d_has_view(f); +} /*! \ingroup h5block_model @@ -92,15 +109,13 @@ H5Block3dSetView ( /*! \ingroup h5block_model - Return partition of processor \c proc as specified with - \ref H5Block3dSetView. + Return the view of this processor. \return \c H5_SUCCESS on success */ h5_err_t H5Block3dGetView ( h5_file_t *const f, /*!< IN: File handle */ - const int proc, /*!< IN: Processor to get partition from */ h5_size_t *i_start, /*!< OUT: start index of \c i */ h5_size_t *i_end, /*!< OUT: end index of \c i */ h5_size_t *j_start, /*!< OUT: start index of \c j */ @@ -111,7 +126,30 @@ H5Block3dGetView ( SET_FNAME( f, __func__ ); - return h5b_3d_get_view(f, proc, i_start, i_end, j_start, j_end, k_start, k_end); + return h5b_3d_get_view(f, i_start, i_end, j_start, j_end, k_start, k_end); +} + +/*! + \ingroup h5block_model + + Return the reduced (ghost-zone free) view of this processor. + + \return \c H5_SUCCESS on success +*/ +h5_err_t +H5Block3dGetReducedView ( + h5_file_t *const f, /*!< IN: File handle */ + h5_size_t *i_start, /*!< OUT: start index of \c i */ + h5_size_t *i_end, /*!< OUT: end index of \c i */ + h5_size_t *j_start, /*!< OUT: start index of \c j */ + h5_size_t *j_end, /*!< OUT: end index of \c j */ + h5_size_t *k_start, /*!< OUT: start index of \c j */ + h5_size_t *k_end /*!< OUT: end index of \c j */ + ) { + + SET_FNAME( f, __func__ ); + + return h5b_3d_get_reduced_view(f, i_start, i_end, j_start, j_end, k_start, k_end); } /*! @@ -154,52 +192,102 @@ H5Block3dGetChunk ( return h5b_3d_get_chunk(f, field_name, dims); } - /*! \ingroup h5block_model - Return reduced (ghost-zone free) partition of processor \c proc - as specified with \ref H5Block3dSetView. + Define an underlying 3D Cartesian grid on the processors with dimensions + (\c i,\c j,\c k). You can look up a processor's index into the grid + using \ref H5Block3dGetGridCoords. + + This function can be used in conjunction with \ref H5Block3dSetDims + to setup the view for a regular grid. + + The product of the dimensions must equal the size of the MPI communicator. \return \c H5_SUCCESS on success */ h5_err_t -H5Block3dGetReducedView ( - h5_file_t *const f, /*!< IN: File handle */ - const int proc, /*!< IN: Processor to get partition from */ - h5_size_t *i_start, /*!< OUT: start index of \c i */ - h5_size_t *i_end, /*!< OUT: end index of \c i */ - h5_size_t *j_start, /*!< OUT: start index of \c j */ - h5_size_t *j_end, /*!< OUT: end index of \c j */ - h5_size_t *k_start, /*!< OUT: start index of \c j */ - h5_size_t *k_end /*!< OUT: end index of \c j */ +H5Block3dSetGrid ( + h5_file_t *const f, /*!< IN: File handle */ + const h5_size_t i, /*!< IN: dimension in \c i */ + const h5_size_t j, /*!< IN: dimension in \c j */ + const h5_size_t k /*!< IN: dimension in \c k */ ) { SET_FNAME( f, __func__ ); - return h5b_3d_get_reduced_view(f, proc, i_start, i_end, j_start, j_end, k_start, k_end); + return h5b_3d_set_grid(f, i, j, k); } /*! \ingroup h5block_model - Returns the processor computing the reduced (ghostzone-free) - partition given by the coordinates \c i, \c j and \c k. + Look up the index (\c i, \c j, \c k) in the grid belonging to MPI processor + \c proc. - \return \c H5_SUCCESS or error code + \return \c H5_SUCCESS on success */ -int -H5Block3dGetProc ( +h5_err_t +H5Block3dGetGridCoords ( h5_file_t *const f, /*!< IN: File handle */ - const h5_int64_t i, /*!< IN: \c i coordinate */ - const h5_int64_t j, /*!< IN: \c j coordinate */ - const h5_int64_t k /*!< IN: \c k coordinate */ + const int proc, /*!< IN: MPI processor */ + h5_int64_t *i, /*!< OUT: index in \c i */ + h5_int64_t *j, /*!< OUT: index in \c j */ + h5_int64_t *k /*!< OUT: index in \c k */ ) { SET_FNAME( f, __func__ ); - //CHECK_LAYOUT ( f ); - return h5b_3d_get_proc(f, i, j, k); + return h5b_3d_get_grid_coords(f, proc, i, j, k); +} + +/*! + \ingroup h5block_model + + Set the dimensions of each processor's block when the field is a regular + grid. + + A grid must be already set with \ref H5Block3dSetGrid, and all processors + must specify the same dimensions. + + \return \c H5_SUCCESS on success +*/ +h5_err_t +H5Block3dSetDims ( + h5_file_t *const f, /*!< IN: File handle */ + const h5_size_t i, /*!< IN: dimension in \c i */ + const h5_size_t j, /*!< IN: dimension in \c j */ + const h5_size_t k /*!< IN: dimension in \c k */ + ) { + + SET_FNAME( f, __func__ ); + + return h5b_3d_set_dims(f, i, j, k); +} + +/*! + \ingroup h5block_model + + Sets the additional cells (\c i, \c j, \c k) in each direction to use as + the `halo` region (or `ghost zone`) that overlaps between neighboring + processors on the grid. + + A grid with dimensions must already be set with \ref H5Block3dSetGrid and + \ref H5Block3dSetDims, and all processors must specify the same halo radii. + + \return \c H5_SUCCESS on success +*/ +h5_err_t +H5Block3dSetHalo ( + h5_file_t *const f, /*!< IN: File handle */ + const h5_size_t i, /*!< IN: radius in \c i */ + const h5_size_t j, /*!< IN: radius in \c j */ + const h5_size_t k /*!< IN: radius in \c k */ + ) { + + SET_FNAME( f, __func__ ); + + return h5b_3d_set_halo(f, i, j, k); } /*! @@ -366,15 +454,15 @@ H5BlockGetNumFieldAttribs ( */ h5_int64_t H5BlockGetFieldAttribInfo ( - h5_file_t *const f, /*!< [in] Handle to open file */ + h5_file_t *const f, /* -
  • Andreas Adelmann (PSI)
  • -
  • Achim Gsell (PSI)
  • -
  • Benedikt Oswald (PSI)
  • - -
  • Wes Bethel (NERSC/LBNL)
  • -
  • John Shalf (NERSC/LBNL)
  • -
  • Cristina Siegerist (NERSC/LBNL)
  • -
  • Mark Howison (NERSC/LBNL)
  • - - - -Papers: - - - -For further information contact: h5part - -*/ - - -/*! - \defgroup h5part_c_api H5Part C API - -*/ -/*! - \ingroup h5part_c_api - \defgroup h5part_open File Opening and Closing -*/ -/*! - \ingroup h5part_c_api - \defgroup h5part_model Setting up the Data Model -*/ -/*! - \ingroup h5part_c_api - \defgroup h5part_data Reading and Writing Datasets -*/ - #include #include #include /* va_arg - System dependent ?! */ @@ -536,6 +474,10 @@ H5PartGetNumParticles ( /*! \ingroup h5part_model + + Reset the view. + + \return \c H5_SUCCESS */ h5_err_t H5PartResetView ( @@ -549,6 +491,12 @@ H5PartResetView ( /*! \ingroup h5part_model + + Check whether a view has been set, either automatically with + \ref H5PartSetNumParticles or manually with \ref H5PartSetView + or \ref H5PartSetViewIndices. + + \return 0 for false or 1 for true */ h5_err_t H5PartHasView ( diff --git a/src/C/H5_attribs.c b/src/C/H5_attribs.c index 5e7621d..c12edf2 100644 --- a/src/C/H5_attribs.c +++ b/src/C/H5_attribs.c @@ -7,7 +7,7 @@ /*** WRITE ***/ /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Write an attribute \c name with the string \c value to the file root ("/"). @@ -33,7 +33,7 @@ H5WriteFileAttribString ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Write an attribute \c name with the string \c value to the current timestep. @@ -59,7 +59,7 @@ H5WriteStepAttribString ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Write an attribute \c name with float32 \c values to the file root ("/"). @@ -86,7 +86,7 @@ H5WriteFileAttribFloat32 ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Write an attribute \c name with float32 \c values to the current time step. @@ -113,7 +113,7 @@ H5WriteStepAttribFloat32 ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Write an attribute \c name with float64 \c values to the file root ("/"). @@ -140,7 +140,7 @@ H5WriteFileAttribFloat64 ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Write an attribute \c name with float64 \c values to the current time step. @@ -167,7 +167,7 @@ H5WriteStepAttribFloat64 ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Write an attribute \c name with int32 \c values to the file root ("/"). @@ -194,7 +194,7 @@ H5WriteFileAttribInt32 ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Write an attribute \c name with int32 \c values to the current time step. @@ -221,7 +221,7 @@ H5WriteStepAttribInt32 ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Write an attribute \c name with int64 \c values to the file root ("/"). @@ -248,7 +248,7 @@ H5WriteFileAttribInt64 ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Write an attribute \c name with int64 \c values to the current time step. @@ -277,7 +277,7 @@ H5WriteStepAttribInt64 ( /*** READ ***/ /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Read a string into a \c buffer from an attribute \c name in the file root ("/"). @@ -302,7 +302,7 @@ H5ReadFileAttribString ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Read a string into a \c buffer from an attribute \c name in the current timestep. @@ -327,7 +327,7 @@ H5ReadStepAttribString ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Read int32 values into a \c buffer from an attribute \c name in the file root ("/"). @@ -352,7 +352,7 @@ H5ReadFileAttribInt32 ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Read int32 values into a \c buffer from an attribute \c name in the current time step. @@ -377,7 +377,7 @@ H5ReadStepAttribInt32 ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Read int64 values into a \c buffer from an attribute \c name in the file root ("/"). @@ -402,7 +402,7 @@ H5ReadFileAttribInt64 ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Read int64 values into a \c buffer from an attribute \c name in the current time step. @@ -427,7 +427,7 @@ H5ReadStepAttribInt64 ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Read float32 values into a \c buffer from an attribute \c name in the file root ("/"). @@ -452,7 +452,7 @@ H5ReadFileAttribFloat32 ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Read float32 values into a \c buffer from an attribute \c name in the current time step. @@ -477,7 +477,7 @@ H5ReadStepAttribFloat32 ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Read float64 values into a \c buffer from an attribute \c name in the file root ("/"). @@ -502,7 +502,7 @@ H5ReadFileAttribFloat64 ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Read float64 values into a \c buffer from an attribute \c name in the current time step. @@ -529,7 +529,7 @@ H5ReadStepAttribFloat64 ( /*** QUERY ***/ /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Gets the number of attributes in the file's root ("/"). @@ -545,7 +545,7 @@ H5GetNumFileAttribs ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Gets the number of attributes bound to the current step. @@ -562,7 +562,7 @@ H5GetNumStepAttribs ( /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Gets the name, type and number of elements of the file attribute specified by its index. @@ -603,7 +603,7 @@ H5GetFileAttribInfo ( } /*! - \ingroup h5_attrib + \ingroup h5hut_attrib Gets the name, type and number of elements of the step attribute specified by its index. diff --git a/src/C/Makefile.am b/src/C/Makefile.am index a6c2e0c..3f178a7 100644 --- a/src/C/Makefile.am +++ b/src/C/Makefile.am @@ -2,10 +2,8 @@ OBJEXT=o -HDFLIB = -L@HDF5ROOT@/lib -lhdf5 -lz @SZLIB@ -LIBS = $(HDFLIB) @MPILIB@ - -INCLUDES = -I../include -I@HDF5ROOT@/include @MPIINC@ +LIBS = @LIBS@ +INCLUDES = -I../include @INCLUDES@ # What to build... Will be determined by configure script. lib_LIBRARIES = libH5hutC.a diff --git a/src/C/generate-h5b-readwrite.py b/src/C/generate-h5b-readwrite.py index 812f27a..23e3067 100755 --- a/src/C/generate-h5b-readwrite.py +++ b/src/C/generate-h5b-readwrite.py @@ -98,7 +98,7 @@ H5Block#DIM#dReadScalarField#TYPE_ABV# ( """ write_scalar_fi = """ -!> \\ingroup h5blockf_data +!> \\ingroup h5block_data_f !! See \\ref H5Block#DIM#dWriteScalarField#TYPE_ABV# !! \\return 0 on success or error code !< @@ -110,7 +110,7 @@ END FUNCTION """ read_scalar_fi = """ -!> \\ingroup h5blockf_data +!> \\ingroup h5block_data_f !! See \\ref H5Block#DIM#dReadScalarField#TYPE_ABV# !! \\return 0 on success or error code !< @@ -258,7 +258,7 @@ H5Block#DIM#dReadVector3dField#TYPE_ABV# ( """ write_vector_fi = """ -!> \\ingroup h5blockf_data +!> \\ingroup h5block_data_f !! See \\ref H5Block#DIM#dWriteVector3dField#TYPE_ABV# !! \\return 0 on success or error code !< @@ -272,7 +272,7 @@ END FUNCTION """ read_vector_fi = """ -!> \\ingroup h5blockf_data +!> \\ingroup h5block_data_f !! See \\ref H5Block#DIM#dReadVector3dField#TYPE_ABV# !! \\return 0 on success or error code !< @@ -385,7 +385,7 @@ H5BlockWriteFieldAttrib#TYPE_ABV# ( """ write_attr_fi = """ -!> \\ingroup h5_attrib_f +!> \\ingroup h5block_attrib_f !! See \\ref H5BlockWriteFieldAttrib#TYPE_ABV# !! \\return 0 on success or error code !< @@ -469,7 +469,7 @@ H5BlockReadFieldAttrib#TYPE_ABV# ( """ read_attr_fi = """ -!> \\ingroup h5_attrib_f +!> \\ingroup h5block_attrib_f !! See \\ref H5BlockReadFieldAttrib#TYPE_ABV# !! \\return 0 on success or error code !< diff --git a/src/Fortran/H5.f90 b/src/Fortran/H5.f90 index fb0d656..e862160 100644 --- a/src/Fortran/H5.f90 +++ b/src/Fortran/H5.f90 @@ -1,27 +1,6 @@ -! Declaration of subroutines for Fortran Bindings - -!> \defgroup h5_f90_api H5hut F90 API - -!> \ingroup h5_f90_api -!! \defgroup h5_open_f File Handling -!< - -!> \ingroup h5_f90_api -!! \defgroup h5_model_f Setting up the Data Model -!< - -!> \ingroup h5_f90_api -!! \defgroup h5_data_f Reading and Writing Datasets -!< - -!> \ingroup h5_f90_api -!! \defgroup h5_attrib_f Reading and Writing Attributes -!< - - !!!!!!!! File Opening and Closing !!!!!!!! -!> \ingroup h5_open_f +!> \ingroup h5hut_file_f !! Opens a file for reading. See \ref H5OpenFile !! \return 0 on success or error code !< @@ -29,7 +8,7 @@ INTEGER*8 FUNCTION h5_openr ( filename ) CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for reading END FUNCTION -!> \ingroup h5_open_f +!> \ingroup h5hut_file_f !! Opens a file for writing in truncate mode. See \ref H5OpenFile !! \return 0 on success or error code !< @@ -37,7 +16,7 @@ INTEGER*8 FUNCTION h5_openw ( filename ) CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for writing END FUNCTION -!> \ingroup h5_open_f +!> \ingroup h5hut_file_f !! Opens a file for writing in append mode. See \ref H5OpenFile !! \return 0 on success or error code !< @@ -45,7 +24,7 @@ INTEGER*8 FUNCTION h5_opena ( filename ) CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for appending END FUNCTION -!> \ingroup h5_open_f +!> \ingroup h5hut_file_f !! Opens a parallel file for reading. !! See \ref H5OpenFile !! @@ -62,7 +41,7 @@ INTEGER*8 FUNCTION h5_openr_par_align ( filename, mpi_communicator, align ) CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags END FUNCTION -!> \ingroup h5_open_f +!> \ingroup h5hut_file_f !! Opens a parallel file for writing. !! See \ref H5OpenFile !! @@ -70,9 +49,7 @@ END FUNCTION !! !! - \c vfd_mpiposix - use the HDF5 MPI-POSIX virtual file driver !! - \c vfd_indendent - use MPI-IO in indepedent mode -!! - \c vfd_mpio_ind - use MPI-IO in indepedent mode !! -!! See \ref H5PartOpenFileParallelAlign !! \return 0 on success or error code !< INTEGER*8 FUNCTION h5_openw_par_align ( filename, mpi_communicator, align, flags ) @@ -81,7 +58,7 @@ INTEGER*8 FUNCTION h5_openw_par_align ( filename, mpi_communicator, align, flags CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags END FUNCTION -!> \ingroup h5_open_f +!> \ingroup h5hut_file_f !! Opens a parallel file for writing in append mode. !! See \ref H5OpenFile !! @@ -90,7 +67,6 @@ END FUNCTION !! - \c vfd_mpiposix - use the HDF5 MPI-POSIX virtual file driver !! - \c vfd_indendent - use MPI-IO in indepedent mode !! -!! See \ref H5PartOpenFileParallelAlign !! \return 0 on success or error code !< INTEGER*8 FUNCTION h5_opena_par_align ( filename, mpi_communicator, align, flags ) @@ -99,7 +75,7 @@ INTEGER*8 FUNCTION h5_opena_par_align ( filename, mpi_communicator, align, flags CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags END FUNCTION -!> \ingroup h5_open_f +!> \ingroup h5hut_file_f !! Closes a file. See \ref H5CloseFile !! \return 0 on success or error code !< @@ -107,7 +83,7 @@ INTEGER*8 FUNCTION h5_close ( filehandle ) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open END FUNCTION -!> \ingroup h5_open_f +!> \ingroup h5hut_file_f !! Checks that a file is valid. See \ref H5CheckFile !! \return 0 on success or error code !< @@ -115,7 +91,7 @@ INTEGER*8 FUNCTION h5_check ( filehandle ) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open END FUNCTION -!> \ingroup h5_open_f +!> \ingroup h5hut_file_f !! See \ref H5SetVerbosityLevel !! \return 0 on success or error code !< @@ -123,7 +99,7 @@ INTEGER*8 FUNCTION h5_set_verbosity_level ( level ) INTEGER*8, INTENT(IN) :: level !< the level from 0 (no output) to 5 (most detailed) END FUNCTION -!> \ingroup h5_model_f +!> \ingroup h5hut_model_f !! See \ref H5SetStep !! \return 0 on success or error code !< @@ -132,7 +108,7 @@ INTEGER*8 FUNCTION h5_setstep (filehandle,step) INTEGER*8, INTENT(IN) :: step !< a timestep value >= 1 END FUNCTION -!> \ingroup h5_model_f +!> \ingroup h5hut_model_f !! See \ref H5GetNumSteps !! \return the number of steps or error code !< diff --git a/src/Fortran/H5Block.f90 b/src/Fortran/H5Block.f90 index ffb0558..bed384f 100644 --- a/src/Fortran/H5Block.f90 +++ b/src/Fortran/H5Block.f90 @@ -1,27 +1,10 @@ -! Declaration of subroutines for Fortran Bindings - -!> \defgroup h5block_f90_api H5Block F90 API - -!> \ingroup h5block_f90_api -!! \defgroup h5blockf_model Setting up the Data Model -!< - -!> \ingroup h5block_f90_api -!! \defgroup h5blockf_data Reading and Writing Datasets -!< - -!> \ingroup h5block_f90_api -!! \defgroup h5blockf_attrib Reading and Writing Attributes -!< - - !!!!!!!! Setting up the Data Model !!!!!!!! -!> \ingroup h5blockf_model -!! See \ref H5BlockDefine3DFieldLayout +!> \ingroup h5block_model_f +!! See \ref H5Block3dSetView !! \return 0 on success or error code !< -INTEGER*8 FUNCTION h5bl_define3dlayout ( filehandle, i_start, i_end, j_start, j_end, k_start, k_end ) +INTEGER*8 FUNCTION h5bl_3d_setview ( filehandle, i_start, i_end, j_start, j_end, k_start, k_end ) INTEGER*8, INTENT(IN) :: filehandle INTEGER*8, INTENT(IN) :: i_start INTEGER*8, INTENT(IN) :: i_end @@ -30,40 +13,39 @@ INTEGER*8 FUNCTION h5bl_define3dlayout ( filehandle, i_start, i_end, j_start, j_ INTEGER*8, INTENT(IN) :: k_start INTEGER*8, INTENT(IN) :: k_end END FUNCTION - -!> \ingroup h5blockf_model -!! See \ref H5BlockDefine3DChunkDims + +!> \ingroup h5block_model_f +!! See \ref H5Block3dGetView !! \return 0 on success or error code !< -INTEGER*8 FUNCTION h5bl_define3dchunkdims ( filehandle, i, j, k ) +INTEGER*8 FUNCTION h5bl_3d_getview ( filehandle, i_start, i_end, j_start, j_end, k_start, k_end ) + INTEGER*8, INTENT(IN) :: filehandle + INTEGER*8, INTENT(OUT) :: i_start + INTEGER*8, INTENT(OUT) :: i_end + INTEGER*8, INTENT(OUT) :: j_start + INTEGER*8, INTENT(OUT) :: j_end + INTEGER*8, INTENT(OUT) :: k_start + INTEGER*8, INTENT(OUT) :: k_end +END FUNCTION + + +!> \ingroup h5block_model_f +!! See \ref H5Block3dSetChunk +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_3d_setchunk ( filehandle, i, j, k ) INTEGER*8, INTENT(IN) :: filehandle INTEGER*8, INTENT(IN) :: i INTEGER*8, INTENT(IN) :: j INTEGER*8, INTENT(IN) :: k END FUNCTION -!> \ingroup h5blockf_model -!! See \ref H5Block3dGetPartitionOfProc +!> \ingroup h5block_model_f +!! See \ref H5Block3dGetReducedView !! \return 0 on success or error code !< -INTEGER*8 FUNCTION h5bl_get_partition_of_proc ( filehandle, proc, i_start, i_end, j_start, j_end, k_start, k_end ) +INTEGER*8 FUNCTION h5bl_3d_getreducedview ( filehandle, i_start, i_end, j_start, j_end, k_start, k_end ) INTEGER*8, INTENT(IN) :: filehandle - INTEGER*8, INTENT(OUT) :: proc - INTEGER*8, INTENT(OUT) :: i_start - INTEGER*8, INTENT(OUT) :: i_end - INTEGER*8, INTENT(OUT) :: j_start - INTEGER*8, INTENT(OUT) :: j_end - INTEGER*8, INTENT(OUT) :: k_start - INTEGER*8, INTENT(OUT) :: k_end - END FUNCTION - -!> \ingroup h5blockf_model -!! See \ref H5Block3dGetReducedPartitionOfProc -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5bl_get_reduced_partition_of_proc ( filehandle, proc, i_start, i_end, j_start, j_end, k_start, k_end ) - INTEGER*8, INTENT(IN) :: filehandle - INTEGER*8, INTENT(OUT) :: proc INTEGER*8, INTENT(OUT) :: i_start INTEGER*8, INTENT(OUT) :: i_end INTEGER*8, INTENT(OUT) :: j_start @@ -72,18 +54,15 @@ INTEGER*8 FUNCTION h5bl_get_reduced_partition_of_proc ( filehandle, proc, i_star INTEGER*8, INTENT(OUT) :: k_end END FUNCTION -!> \ingroup h5blockf_model -!! See \ref H5Block3dGetProcOf +!> \ingroup h5block_model_f +!! See \ref H5Block3dHasView !! \return rank of processor error code !< -INTEGER*8 FUNCTION h5bl_get_proc_of ( filehandle, i, j, k ) +INTEGER*8 FUNCTION h5bl_3d_hasview ( filehandle ) INTEGER*8, INTENT(IN) :: filehandle - INTEGER*8, INTENT(IN) :: i - INTEGER*8, INTENT(IN) :: j - INTEGER*8, INTENT(IN) :: k END FUNCTION -!> \ingroup h5blockf_model +!> \ingroup h5block_model_f !! See \ref H5BlockGetNumFields !! \return number of fields or error code !< @@ -91,7 +70,7 @@ INTEGER*8 FUNCTION h5bl_getnumfields ( filehandle ) INTEGER*8, INTENT(IN) :: filehandle END FUNCTION -!> \ingroup h5blockf_model +!> \ingroup h5block_model_f !! See \ref H5BlockGetFieldInfo !! \return 0 on success or error code !< @@ -105,18 +84,9 @@ INTEGER*8 FUNCTION h5bl_getfieldinfo ( filehandle, idx, field_name, grid_rank, g INTEGER*8, INTENT(OUT) :: type END FUNCTION -!> \ingroup h5blockf_model -!! See \ref H5BlockHasFieldData -!! \return 0 if false, 1 if true, or error code -!< -INTEGER*8 FUNCTION h5bl_has_fielddata ( filehandle ) - INTEGER*8, INTENT(IN) :: filehandle -END FUNCTION - - !!!!!!!! Reading and Writing Attributes !!!!!!!! -!> \ingroup h5blockf_attrib +!> \ingroup h5block_attrib_f !! See \ref H5BlockWriteFieldAttribString !! \return 0 on success or error code !< @@ -127,7 +97,7 @@ INTEGER*8 FUNCTION h5bl_writefieldattrib_string ( filehandle, field_name, attrib CHARACTER(LEN=*), INTENT(IN) :: attrib_value ! The array of data to write into the attribute END FUNCTION -!> \ingroup h5blockf_attrib +!> \ingroup h5block_attrib_f !! See \ref H5BlockGetNumFieldAttribs !! \return number of attributes or error code !< @@ -136,7 +106,7 @@ INTEGER*8 FUNCTION h5bl_getnfieldattribs ( filehandle, field_name ) CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field END FUNCTION -!> \ingroup h5blockf_attrib +!> \ingroup h5block_attrib_f !! See \ref H5BlockGetFieldAttribInfo !! \return 0 on success or error code !< @@ -148,33 +118,8 @@ INTEGER*8 FUNCTION h5bl_getfieldattribinfo ( filehandle, field_name, idx, attrib INTEGER*8,INTENT(OUT):: attrib_nelem ! Number of elements in the attrib array END FUNCTION -!> \ingroup h5blockf_attrib -!! Read the attribute \c attrib_name from the field \c field_name at the -!! current timestep, and store the int64 value in \c attrib_value. -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5bl_readfieldattrib_i8 ( filehandle, field_name, attrib_name, attrib_value ) - INTEGER*8,INTENT(IN) :: filehandle - CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field - CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read - INTEGER*8,INTENT(OUT):: attrib_value(*)! the attribute data will be read into this array -END FUNCTION - -!> \ingroup h5blockf_attrib -!! Read the attribute \c attrib_name from the field \c field_name at the -!! current timestep, and store the float64 value in \c attrib_value. -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5bl_readfieldattrib_r8 ( filehandle, field_name, attrib_name, attrib_value ) - INTEGER*8,INTENT(IN) :: filehandle - CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field - CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read - REAL*8, INTENT(OUT):: attrib_value(*)! the attribute data will be read into this array -END FUNCTION - -!> \ingroup h5blockf_attrib -!! Read the attribute \c attrib_name from the field \c field_name at the -!! current timestep, and store the string value in \c attrib_value. +!> \ingroup h5block_attrib_f +!! See \ref H5BlockReadFieldAttribString !! \return 0 on success or error code !< INTEGER*8 FUNCTION h5bl_readfieldattrib_string ( filehandle, field_name, attrib_name, attrib_value ) @@ -183,53 +128,4 @@ INTEGER*8 FUNCTION h5bl_readfieldattrib_string ( filehandle, field_name, attrib_ CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read CHARACTER(LEN=*), INTENT(IN) :: attrib_value ! The array of data to write into the attribute END FUNCTION - -!> \ingroup h5blockf_attrib -!! See \ref H5Block3dGetFieldSpacing -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5bl_3d_get_field_spacing ( filehandle, name, x, y, z ) - INTEGER*8, INTENT(IN) :: filehandle - CHARACTER(LEN=*), INTENT(IN) :: name - REAL*8, INTENT(OUT) :: x - REAL*8, INTENT(OUT) :: y - REAL*8, INTENT(OUT) :: z -END FUNCTION - -!> \ingroup h5blockf_attrib -!! See \ref H5Block3dSetFieldSpacing -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5bl_3d_set_field_spacing ( filehandle, name, x, y, z ) - INTEGER*8, INTENT(IN) :: filehandle - CHARACTER(LEN=*), INTENT(IN) :: name - REAL*8, INTENT(IN) :: x - REAL*8, INTENT(IN) :: y - REAL*8, INTENT(IN) :: z -END FUNCTION - -!> \ingroup h5blockf_attrib -!! See \ref H5Block3dGetFieldOrigin -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5bl_3d_get_field_origin ( filehandle, name, x, y, z ) - INTEGER*8, INTENT(IN) :: filehandle - CHARACTER(LEN=*), INTENT(IN) :: name - REAL*8, INTENT(OUT) :: x - REAL*8, INTENT(OUT) :: y - REAL*8, INTENT(OUT) :: z -END FUNCTION - -!> \ingroup h5blockf_attrib -!! See \ref H5Block3dSetFieldOrigin -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5bl_3d_set_field_origin ( filehandle, name, x, y, z ) - INTEGER*8, INTENT(IN) :: filehandle - CHARACTER(LEN=*), INTENT(IN) :: name - REAL*8, INTENT(IN) :: x - REAL*8, INTENT(IN) :: y - REAL*8, INTENT(IN) :: z -END FUNCTION - - + diff --git a/src/Fortran/H5Block_F.c b/src/Fortran/H5Block_F.c index dde8256..4e283f6 100755 --- a/src/Fortran/H5Block_F.c +++ b/src/Fortran/H5Block_F.c @@ -26,9 +26,9 @@ #define h5bl_3d_getreducedview F77NAME ( \ h5bl_3d_getreducedview_,\ H5BL_3D_GETREDUCEDVIEW ) -#define h5bl_3d_getproc F77NAME ( \ - h5bl_getproc_, \ - H5BL_GETPROC ) +#define h5bl_3d_hasview F77NAME ( \ + h5bl_hasview_, \ + H5BL_HASVIEW ) #define h5bl_getnumfields F77NAME ( \ h5bl_getnumfields_, \ H5BL_GETNUMFIELDS ) @@ -85,7 +85,6 @@ h5bl_3d_setchunk ( h5_err_t h5bl_3d_getview ( h5_int64_t *f, /*!< file handle */ - const h5_int64_t *proc, h5_int64_t *i_start, /*!< start index of i */ h5_int64_t *i_end, /*!< end index of i */ h5_int64_t *j_start, /*!< start index of j */ @@ -98,7 +97,6 @@ h5bl_3d_getview ( h5_err_t herr = H5Block3dGetView ( filehandle, - *proc, i_start, i_end, j_start, j_end, k_start, k_end ); if ( herr < 0 ) return herr; @@ -115,7 +113,6 @@ h5bl_3d_getview ( h5_err_t h5bl_3d_getreducedview ( h5_int64_t *f, - const h5_int64_t *proc, h5_int64_t *i_start, h5_int64_t *i_end, h5_int64_t *j_start, @@ -128,7 +125,6 @@ h5bl_3d_getreducedview ( h5_err_t herr = H5Block3dGetReducedView ( filehandle, - *proc, i_start, i_end, j_start, j_end, k_start, k_end ); if ( herr < 0 ) return herr; @@ -142,17 +138,14 @@ h5bl_3d_getreducedview ( return H5_SUCCESS; } -h5_err_t -h5bl_3d_getproc ( - h5_int64_t *f, - const h5_int64_t *i, - const h5_int64_t *j, - const h5_int64_t *k +h5_int64_t +h5bl_3d_hasview ( + h5_int64_t *f ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - return H5Block3dGetProc ( filehandle, (*i)-1, (*j)-1, (*k)-1 ); + return H5Block3dHasView ( filehandle ); } h5_err_t diff --git a/src/Fortran/H5Block_readwrite.f90 b/src/Fortran/H5Block_readwrite.f90 index 5aa8ea5..706c25f 100644 --- a/src/Fortran/H5Block_readwrite.f90 +++ b/src/Fortran/H5Block_readwrite.f90 @@ -1,5 +1,5 @@ -!> \ingroup h5blockf_data +!> \ingroup h5block_data_f !! See \ref H5Block3dWriteScalarFieldFloat64 !! \return 0 on success or error code !< @@ -9,7 +9,7 @@ INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_r8 ( filehandle, name, data ) REAL*8, INTENT(IN) :: data(*) !< the array of data END FUNCTION -!> \ingroup h5blockf_data +!> \ingroup h5block_data_f !! See \ref H5Block3dReadScalarFieldFloat64 !! \return 0 on success or error code !< @@ -19,7 +19,7 @@ INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_r8 ( filehandle, name, data ) REAL*8, INTENT(OUT) :: data(*) !< buffer to read the data into END FUNCTION -!> \ingroup h5blockf_data +!> \ingroup h5block_data_f !! See \ref H5Block3dWriteVector3dFieldFloat64 !! \return 0 on success or error code !< @@ -31,7 +31,7 @@ INTEGER*8 FUNCTION h5bl_3d_write_vector3d_field_r8 ( filehandle, name, x, y, z ) REAL*8, INTENT(IN) :: z(*) !< the array of z data to write END FUNCTION -!> \ingroup h5blockf_data +!> \ingroup h5block_data_f !! See \ref H5Block3dReadVector3dFieldFloat64 !! \return 0 on success or error code !< @@ -43,7 +43,7 @@ INTEGER*8 FUNCTION h5bl_3d_read_vector3d_field_r8 ( filehandle, name, x, y, z ) REAL*8, INTENT(OUT) :: z(*) !< buffer to read the z data into END FUNCTION -!> \ingroup h5blockf_data +!> \ingroup h5block_data_f !! See \ref H5Block3dWriteScalarFieldFloat32 !! \return 0 on success or error code !< @@ -53,7 +53,7 @@ INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_r4 ( filehandle, name, data ) REAL*4, INTENT(IN) :: data(*) !< the array of data END FUNCTION -!> \ingroup h5blockf_data +!> \ingroup h5block_data_f !! See \ref H5Block3dReadScalarFieldFloat32 !! \return 0 on success or error code !< @@ -63,7 +63,7 @@ INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_r4 ( filehandle, name, data ) REAL*4, INTENT(OUT) :: data(*) !< buffer to read the data into END FUNCTION -!> \ingroup h5blockf_data +!> \ingroup h5block_data_f !! See \ref H5Block3dWriteVector3dFieldFloat32 !! \return 0 on success or error code !< @@ -75,7 +75,7 @@ INTEGER*8 FUNCTION h5bl_3d_write_vector3d_field_r4 ( filehandle, name, x, y, z ) REAL*4, INTENT(IN) :: z(*) !< the array of z data to write END FUNCTION -!> \ingroup h5blockf_data +!> \ingroup h5block_data_f !! See \ref H5Block3dReadVector3dFieldFloat32 !! \return 0 on success or error code !< @@ -87,7 +87,7 @@ INTEGER*8 FUNCTION h5bl_3d_read_vector3d_field_r4 ( filehandle, name, x, y, z ) REAL*4, INTENT(OUT) :: z(*) !< buffer to read the z data into END FUNCTION -!> \ingroup h5blockf_data +!> \ingroup h5block_data_f !! See \ref H5Block3dWriteScalarFieldInt64 !! \return 0 on success or error code !< @@ -97,7 +97,7 @@ INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_i8 ( filehandle, name, data ) INTEGER*8, INTENT(IN) :: data(*) !< the array of data END FUNCTION -!> \ingroup h5blockf_data +!> \ingroup h5block_data_f !! See \ref H5Block3dReadScalarFieldInt64 !! \return 0 on success or error code !< @@ -107,7 +107,7 @@ INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_i8 ( filehandle, name, data ) INTEGER*8, INTENT(OUT) :: data(*) !< buffer to read the data into END FUNCTION -!> \ingroup h5blockf_data +!> \ingroup h5block_data_f !! See \ref H5Block3dWriteVector3dFieldInt64 !! \return 0 on success or error code !< @@ -119,7 +119,7 @@ INTEGER*8 FUNCTION h5bl_3d_write_vector3d_field_i8 ( filehandle, name, x, y, z ) INTEGER*8, INTENT(IN) :: z(*) !< the array of z data to write END FUNCTION -!> \ingroup h5blockf_data +!> \ingroup h5block_data_f !! See \ref H5Block3dReadVector3dFieldInt64 !! \return 0 on success or error code !< @@ -131,7 +131,7 @@ INTEGER*8 FUNCTION h5bl_3d_read_vector3d_field_i8 ( filehandle, name, x, y, z ) INTEGER*8, INTENT(OUT) :: z(*) !< buffer to read the z data into END FUNCTION -!> \ingroup h5blockf_data +!> \ingroup h5block_data_f !! See \ref H5Block3dWriteScalarFieldInt32 !! \return 0 on success or error code !< @@ -141,7 +141,7 @@ INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_i4 ( filehandle, name, data ) INTEGER*4, INTENT(IN) :: data(*) !< the array of data END FUNCTION -!> \ingroup h5blockf_data +!> \ingroup h5block_data_f !! See \ref H5Block3dReadScalarFieldInt32 !! \return 0 on success or error code !< @@ -151,7 +151,7 @@ INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_i4 ( filehandle, name, data ) INTEGER*4, INTENT(OUT) :: data(*) !< buffer to read the data into END FUNCTION -!> \ingroup h5blockf_data +!> \ingroup h5block_data_f !! See \ref H5Block3dWriteVector3dFieldInt32 !! \return 0 on success or error code !< @@ -163,7 +163,7 @@ INTEGER*8 FUNCTION h5bl_3d_write_vector3d_field_i4 ( filehandle, name, x, y, z ) INTEGER*4, INTENT(IN) :: z(*) !< the array of z data to write END FUNCTION -!> \ingroup h5blockf_data +!> \ingroup h5block_data_f !! See \ref H5Block3dReadVector3dFieldInt32 !! \return 0 on success or error code !< @@ -175,7 +175,7 @@ INTEGER*8 FUNCTION h5bl_3d_read_vector3d_field_i4 ( filehandle, name, x, y, z ) INTEGER*4, INTENT(OUT) :: z(*) !< buffer to read the z data into END FUNCTION -!> \ingroup h5_attrib_f +!> \ingroup h5block_attrib_f !! See \ref H5BlockWriteFieldAttribFloat64 !! \return 0 on success or error code !< @@ -187,7 +187,7 @@ INTEGER*8 FUNCTION h5bl_writefieldattrib_r8 ( filehandle, field_name, attrib_nam INTEGER*8, INTENT(IN) :: nvalues !< the number of elements in the array END FUNCTION -!> \ingroup h5_attrib_f +!> \ingroup h5block_attrib_f !! See \ref H5BlockReadFieldAttribFloat64 !! \return 0 on success or error code !< @@ -198,7 +198,7 @@ INTEGER*8 FUNCTION h5bl_readfieldattrib_r8 ( filehandle, field_name, attrib_name REAL*8, INTENT(IN) :: values(*) !< the buffer to read into END FUNCTION -!> \ingroup h5_attrib_f +!> \ingroup h5block_attrib_f !! See \ref H5BlockWriteFieldAttribFloat32 !! \return 0 on success or error code !< @@ -210,7 +210,7 @@ INTEGER*8 FUNCTION h5bl_writefieldattrib_r4 ( filehandle, field_name, attrib_nam INTEGER*8, INTENT(IN) :: nvalues !< the number of elements in the array END FUNCTION -!> \ingroup h5_attrib_f +!> \ingroup h5block_attrib_f !! See \ref H5BlockReadFieldAttribFloat32 !! \return 0 on success or error code !< @@ -221,7 +221,7 @@ INTEGER*8 FUNCTION h5bl_readfieldattrib_r4 ( filehandle, field_name, attrib_name REAL*4, INTENT(IN) :: values(*) !< the buffer to read into END FUNCTION -!> \ingroup h5_attrib_f +!> \ingroup h5block_attrib_f !! See \ref H5BlockWriteFieldAttribInt64 !! \return 0 on success or error code !< @@ -233,7 +233,7 @@ INTEGER*8 FUNCTION h5bl_writefieldattrib_i8 ( filehandle, field_name, attrib_nam INTEGER*8, INTENT(IN) :: nvalues !< the number of elements in the array END FUNCTION -!> \ingroup h5_attrib_f +!> \ingroup h5block_attrib_f !! See \ref H5BlockReadFieldAttribInt64 !! \return 0 on success or error code !< @@ -244,7 +244,7 @@ INTEGER*8 FUNCTION h5bl_readfieldattrib_i8 ( filehandle, field_name, attrib_name INTEGER*8, INTENT(IN) :: values(*) !< the buffer to read into END FUNCTION -!> \ingroup h5_attrib_f +!> \ingroup h5block_attrib_f !! See \ref H5BlockWriteFieldAttribInt32 !! \return 0 on success or error code !< @@ -256,7 +256,7 @@ INTEGER*8 FUNCTION h5bl_writefieldattrib_i4 ( filehandle, field_name, attrib_nam INTEGER*8, INTENT(IN) :: nvalues !< the number of elements in the array END FUNCTION -!> \ingroup h5_attrib_f +!> \ingroup h5block_attrib_f !! See \ref H5BlockReadFieldAttribInt32 !! \return 0 on success or error code !< diff --git a/src/Fortran/H5Part.f90 b/src/Fortran/H5Part.f90 index fd4d308..5d5ca93 100644 --- a/src/Fortran/H5Part.f90 +++ b/src/Fortran/H5Part.f90 @@ -1,6 +1,6 @@ !!!!!!!! Setting up the Data Model !!!!!!!! -!> \ingroup h5_model_f +!> \ingroup h5part_model_f !! See \ref H5PartSetNumParticles !! \return 0 on success or error code !< @@ -9,7 +9,7 @@ INTEGER*8 FUNCTION h5pt_setnpoints ( filehandle, npoints ) INTEGER*8, INTENT(IN) :: npoints !< the number of particles on *this* processor END FUNCTION -!> \ingroup h5_model_f +!> \ingroup h5part_model_f !! See \ref H5PartSetNumParticlesStrided !! \return 0 on success or error code !< @@ -19,7 +19,7 @@ INTEGER*8 FUNCTION h5pt_setnpoints_strided ( filehandle, npoints, stride ) INTEGER*8, INTENT(IN) :: stride !< the stride value (e.g. the number of fields in the particle data array) END FUNCTION -!> \ingroup h5_model_f +!> \ingroup h5part_model_f !! See \ref H5PartGetNumDatasets !! \return the number of datasets or error code !< @@ -27,7 +27,7 @@ INTEGER*8 FUNCTION h5pt_getndatasets (filehandle) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open END FUNCTION -!> \ingroup h5_model_f +!> \ingroup h5part_model_f !! See \ref H5PartGetNumParticles !! \return the number of particles or error code !< @@ -35,7 +35,7 @@ INTEGER*8 FUNCTION h5pt_getnpoints (filehandle) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open END FUNCTION -!> \ingroup h5_model_f +!> \ingroup h5part_model_f !! See \ref H5PartGetDatasetName !! \return 0 on success or error code !< @@ -45,7 +45,7 @@ INTEGER*8 FUNCTION h5pt_getdatasetname (filehandle,index,name) CHARACTER(LEN=*), INTENT(OUT) :: name !< buffer to read the dataset name into END FUNCTION -!> \ingroup h5_model_f +!> \ingroup h5part_model_f !! See \ref H5PartSetView !! \return 0 on success or error code !< @@ -55,7 +55,7 @@ INTEGER*8 FUNCTION h5pt_setview (filehandle,start,end) INTEGER*8, INTENT(IN) :: end !< offset of the last particle in the view (inclusive) END FUNCTION -!> \ingroup h5_model_f +!> \ingroup h5part_model_f !! See \ref H5PartSetViewIndices !! \return 0 on success or error code !< @@ -65,7 +65,7 @@ INTEGER*8 FUNCTION h5pt_setview_indices (filehandle,indices,nelem) INTEGER*8, INTENT(IN) :: nelem !< number of particles in the list END FUNCTION -!> \ingroup h5_model_f +!> \ingroup h5part_model_f !! See \ref H5PartSetViewEmpty !! \return 0 on success or error code !< @@ -73,7 +73,7 @@ INTEGER*8 FUNCTION h5pt_setview_empty (filehandle) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open END FUNCTION -!> \ingroup h5_model_f +!> \ingroup h5part_model_f !! See \ref H5PartResetView !! \return 0 on success or error code !< @@ -81,7 +81,7 @@ INTEGER*8 FUNCTION h5pt_resetview (filehandle) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open END FUNCTION -!> \ingroup h5_model_f +!> \ingroup h5part_model_f !! See \ref H5PartResetView !! \return 1 if true, 0 if false, or error code !< @@ -89,7 +89,7 @@ INTEGER*8 FUNCTION h5pt_hasview (filehandle) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open END FUNCTION -!> \ingroup h5_model_f +!> \ingroup h5part_model_f !! See \ref H5PartGetView !! \return 0 on success or error code !< @@ -102,7 +102,7 @@ END FUNCTION !!!!!!!! Reading and Writing Datasets !!!!!!!! -!> \ingroup h5_data_f +!> \ingroup h5part_data_f !! See \ref H5PartWriteDataFloat64 !! \return 0 on success or error code !< @@ -112,7 +112,7 @@ INTEGER*8 FUNCTION h5pt_writedata_r8 ( filehandle, name, data ) REAL*8, INTENT(IN) :: data(*) !< the array of float64 data to write END FUNCTION -!> \ingroup h5_data_f +!> \ingroup h5part_data_f !! See \ref H5PartWriteDataFloat32 !! \return 0 on success or error code !< @@ -122,7 +122,7 @@ INTEGER*8 FUNCTION h5pt_writedata_r4 ( filehandle, name, data ) REAL, INTENT(IN) :: data(*) !< the array of float32 data to write END FUNCTION -!> \ingroup h5_data_f +!> \ingroup h5part_data_f !! See \ref H5PartWriteDataInt64 !! \return 0 on success or error code !< @@ -132,7 +132,7 @@ INTEGER*8 FUNCTION h5pt_writedata_i8 ( filehandle, name, data ) INTEGER*8, INTENT(IN) :: data(*) !< the array of int64 data to write END FUNCTION -!> \ingroup h5_data_f +!> \ingroup h5part_data_f !! See \ref H5PartWriteDataInt32 !! \return 0 on success or error code !< @@ -143,7 +143,7 @@ INTEGER*8 FUNCTION h5pt_writedata_i4 ( filehandle, name, data ) END FUNCTION -!> \ingroup h5_data_f +!> \ingroup h5part_data_f !! See \ref H5PartReadDataFloat64 !! \return 0 on success or error code !< @@ -153,7 +153,7 @@ INTEGER*8 FUNCTION h5pt_readdata_r8 (filehandle,name,data) REAL*8, INTENT(OUT) :: data(*) !< array to read float64 data into END FUNCTION -!> \ingroup h5_data_f +!> \ingroup h5part_data_f !! See \ref H5PartReadDataFloat32 !! \return 0 on success or error code !< @@ -163,7 +163,7 @@ INTEGER*8 FUNCTION h5pt_readdata_r4 (filehandle,name,data) REAL, INTENT(OUT) :: data(*) !< array to read float32 data into END FUNCTION -!> \ingroup h5_data_f +!> \ingroup h5part_data_f !! See \ref H5PartReadDataInt64 !! \return 0 on success or error code !< @@ -173,7 +173,7 @@ INTEGER*8 FUNCTION h5pt_readdata_i8 (filehandle,name,data) INTEGER*8, INTENT(OUT) :: data(*) !< array to read int64 data into END FUNCTION -!> \ingroup h5_data_f +!> \ingroup h5part_data_f !! See \ref H5PartReadDataInt32 !! \return 0 on success or error code !< diff --git a/src/Fortran/H5_attribs.f90 b/src/Fortran/H5_attribs.f90 index 759ab6f..a8e49a2 100644 --- a/src/Fortran/H5_attribs.f90 +++ b/src/Fortran/H5_attribs.f90 @@ -1,6 +1,6 @@ !!!!!!!! Reading and Writing Attributes !!!!!!!! -!> \ingroup h5_attrib_f +!> \ingroup h5hut_attrib_f !! See \ref H5WriteFileAttribString !! \return 0 on success or error code !< @@ -10,7 +10,7 @@ INTEGER*8 FUNCTION h5_writefileattrib_string (filehandle,attrib_name,attrib_valu CHARACTER(LEN=*), INTENT(IN) :: value !< the string value to store END FUNCTION -!> \ingroup h5_attrib_f +!> \ingroup h5hut_attrib_f !! See \ref H5WriteStepAttribString !! \return 0 on success or error code !< @@ -20,7 +20,7 @@ INTEGER*8 FUNCTION h5_writestepattrib_string (filehandle,attrib_name,attrib_valu CHARACTER(LEN=*), INTENT(IN) :: value !< the string value to store END FUNCTION -!> \ingroup h5_attrib_f +!> \ingroup h5hut_attrib_f !! See \ref H5ReadFileAttribString !! \return 0 on success or error code !< @@ -30,7 +30,7 @@ INTEGER*8 FUNCTION h5_readfileattrib_string (filehandle,attrib_name,attrib_value CHARACTER(LEN=*), INTENT(OUT) :: value !< buffer to read the string value into END FUNCTION -!> \ingroup h5_attrib_f +!> \ingroup h5hut_attrib_f !! See \ref H5ReadStepAttribString !! \return 0 on success or error code !< @@ -40,7 +40,7 @@ INTEGER*8 FUNCTION h5_readstepattrib_string (filehandle,attrib_name,attrib_value CHARACTER(LEN=*), INTENT(OUT) :: value !< buffer to read the string value into END FUNCTION -!< \ingroup h5_attrib_f +!< \ingroup h5hut_attrib_f !! See \ref H5WriteFileAttribFloat64 !! \return 0 on success or error code !> @@ -51,7 +51,7 @@ INTEGER*8 FUNCTION h5_writefileattrib_r8 ( filehandle, field_name, attrib_name, INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array END FUNCTION -!< \ingroup h5_attrib_f +!< \ingroup h5hut_attrib_f !! See \ref H5ReadFileAttribFloat64 !! \return 0 on success or error code !> @@ -61,7 +61,7 @@ INTEGER*8 FUNCTION h5_readfileattrib_r8 ( filehandle, name, data ) REAL*8, INTENT(OUT) :: data(*) !< buffer to read value into END FUNCTION -!< \ingroup h5_attrib_f +!< \ingroup h5hut_attrib_f !! See \ref H5WriteFileAttribFloat32 !! \return 0 on success or error code !> @@ -72,7 +72,7 @@ INTEGER*8 FUNCTION h5_writefileattrib_r4 ( filehandle, field_name, attrib_name, INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array END FUNCTION -!< \ingroup h5_attrib_f +!< \ingroup h5hut_attrib_f !! See \ref H5ReadFileAttribFloat32 !! \return 0 on success or error code !> @@ -82,7 +82,7 @@ INTEGER*8 FUNCTION h5_readfileattrib_r4 ( filehandle, name, data ) REAL*4, INTENT(OUT) :: data(*) !< buffer to read value into END FUNCTION -!< \ingroup h5_attrib_f +!< \ingroup h5hut_attrib_f !! See \ref H5WriteFileAttribInt64 !! \return 0 on success or error code !> @@ -93,7 +93,7 @@ INTEGER*8 FUNCTION h5_writefileattrib_i8 ( filehandle, field_name, attrib_name, INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array END FUNCTION -!< \ingroup h5_attrib_f +!< \ingroup h5hut_attrib_f !! See \ref H5ReadFileAttribInt64 !! \return 0 on success or error code !> @@ -103,7 +103,7 @@ INTEGER*8 FUNCTION h5_readfileattrib_i8 ( filehandle, name, data ) INTEGER*8, INTENT(OUT) :: data(*) !< buffer to read value into END FUNCTION -!< \ingroup h5_attrib_f +!< \ingroup h5hut_attrib_f !! See \ref H5WriteFileAttribInt32 !! \return 0 on success or error code !> @@ -114,7 +114,7 @@ INTEGER*8 FUNCTION h5_writefileattrib_i4 ( filehandle, field_name, attrib_name, INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array END FUNCTION -!< \ingroup h5_attrib_f +!< \ingroup h5hut_attrib_f !! See \ref H5ReadFileAttribInt32 !! \return 0 on success or error code !> @@ -124,7 +124,7 @@ INTEGER*8 FUNCTION h5_readfileattrib_i4 ( filehandle, name, data ) INTEGER*4, INTENT(OUT) :: data(*) !< buffer to read value into END FUNCTION -!< \ingroup h5_attrib_f +!< \ingroup h5hut_attrib_f !! See \ref H5WriteStepAttribFloat64 !! \return 0 on success or error code !> @@ -135,7 +135,7 @@ INTEGER*8 FUNCTION h5_writestepattrib_r8 ( filehandle, field_name, attrib_name, INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array END FUNCTION -!< \ingroup h5_attrib_f +!< \ingroup h5hut_attrib_f !! See \ref H5ReadStepAttribFloat64 !! \return 0 on success or error code !> @@ -145,7 +145,7 @@ INTEGER*8 FUNCTION h5_readstepattrib_r8 ( filehandle, name, data ) REAL*8, INTENT(OUT) :: data(*) !< buffer to read value into END FUNCTION -!< \ingroup h5_attrib_f +!< \ingroup h5hut_attrib_f !! See \ref H5WriteStepAttribFloat32 !! \return 0 on success or error code !> @@ -156,7 +156,7 @@ INTEGER*8 FUNCTION h5_writestepattrib_r4 ( filehandle, field_name, attrib_name, INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array END FUNCTION -!< \ingroup h5_attrib_f +!< \ingroup h5hut_attrib_f !! See \ref H5ReadStepAttribFloat32 !! \return 0 on success or error code !> @@ -166,7 +166,7 @@ INTEGER*8 FUNCTION h5_readstepattrib_r4 ( filehandle, name, data ) REAL*4, INTENT(OUT) :: data(*) !< buffer to read value into END FUNCTION -!< \ingroup h5_attrib_f +!< \ingroup h5hut_attrib_f !! See \ref H5WriteStepAttribInt64 !! \return 0 on success or error code !> @@ -177,7 +177,7 @@ INTEGER*8 FUNCTION h5_writestepattrib_i8 ( filehandle, field_name, attrib_name, INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array END FUNCTION -!< \ingroup h5_attrib_f +!< \ingroup h5hut_attrib_f !! See \ref H5ReadStepAttribInt64 !! \return 0 on success or error code !> @@ -187,7 +187,7 @@ INTEGER*8 FUNCTION h5_readstepattrib_i8 ( filehandle, name, data ) INTEGER*8, INTENT(OUT) :: data(*) !< buffer to read value into END FUNCTION -!< \ingroup h5_attrib_f +!< \ingroup h5hut_attrib_f !! See \ref H5WriteStepAttribInt32 !! \return 0 on success or error code !> @@ -198,7 +198,7 @@ INTEGER*8 FUNCTION h5_writestepattrib_i4 ( filehandle, field_name, attrib_name, INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array END FUNCTION -!< \ingroup h5_attrib_f +!< \ingroup h5hut_attrib_f !! See \ref H5ReadStepAttribInt32 !! \return 0 on success or error code !> @@ -208,7 +208,7 @@ INTEGER*8 FUNCTION h5_readstepattrib_i4 ( filehandle, name, data ) INTEGER*4, INTENT(OUT) :: data(*) !< buffer to read value into END FUNCTION -!> \ingroup h5_attrib_f +!> \ingroup h5hut_attrib_f !! See \ref H5GetNumStepAttribs !! \return number of attributes or error code !< @@ -216,7 +216,7 @@ INTEGER*8 FUNCTION h5_getnstepattribs (filehandle) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open END FUNCTION -!> \ingroup h5_attrib_f +!> \ingroup h5hut_attrib_f !! See \ref H5GetNumFileAttribs !! \return number of attributes or error code !< @@ -224,7 +224,7 @@ INTEGER*8 FUNCTION h5_getnfileattribs (filehandle) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open END FUNCTION -!> \ingroup h5_attrib_f +!> \ingroup h5hut_attrib_f !! See \ref H5GetStepAttribInfo !! \return 0 on success or error code !< @@ -235,7 +235,7 @@ INTEGER*8 FUNCTION h5_getstepattribinfo (filehandle,idx,attrib_name,attrib_nelem INTEGER*8, INTENT(OUT) :: nelem !< number of elements in the attribute's array END FUNCTION -!> \ingroup h5_attrib_f +!> \ingroup h5hut_attrib_f !! See \ref H5GetFileAttribInfo !! \return 0 on success or error code !< diff --git a/src/Fortran/Makefile.am b/src/Fortran/Makefile.am index 3fe3aed..c3d64d8 100644 --- a/src/Fortran/Makefile.am +++ b/src/Fortran/Makefile.am @@ -2,10 +2,8 @@ OBJEXT=o -HDFLIB = -L@HDF5ROOT@/lib -lhdf5 -lz @SZLIB@ -LIBS = $(HDFLIB) @MPILIB@ - -INCLUDES = -I../include -I@HDF5ROOT@/include @MPIINC@ +LIBS = @LIBS@ +INCLUDES = -I../include @INCLUDES@ F90_FILES = H5.f90 \ H5_attribs.f90 \ diff --git a/src/h5core/Makefile.am b/src/h5core/Makefile.am index 8152d6f..59f62d9 100644 --- a/src/h5core/Makefile.am +++ b/src/h5core/Makefile.am @@ -2,10 +2,8 @@ OBJEXT=o -HDFLIB = -L@HDF5ROOT@/lib -lhdf5 -lz @SZLIB@ -LIBS = $(HDFLIB) @MPILIB@ - -INCLUDES = -I../include -I@HDF5ROOT@/include @MPIINC@ +LIBS = @LIBS@ +INCLUDES = -I../include @INCLUDES@ EXTRA_HEADERS = \ ../include/h5core/h5_attribs.h \ diff --git a/src/h5core/h5_mpi.c b/src/h5core/h5_mpi.c index ea22865..2327920 100644 --- a/src/h5core/h5_mpi.c +++ b/src/h5core/h5_mpi.c @@ -188,9 +188,40 @@ h5priv_mpi_type_free ( h5_file_t* const f, MPI_Datatype *type ) { - int err = MPI_Type_free ( type ); + int err = MPI_Type_free( type ); if (err != MPI_SUCCESS) - return h5_error (f, H5_ERR_MPI, "Cannot free MPI type"); + return h5_error(f, H5_ERR_MPI, "Cannot free MPI type"); + return H5_SUCCESS; +} + +h5_err_t +h5priv_mpi_cart_create ( + h5_file_t* const f, + MPI_Comm old_comm, + int ndims, + int *dims, + int *period, + int *reorder, + MPI_Comm *new_comm + ) { + int err = MPI_Cart_create( + old_comm, ndims, dims, period, reorder, new_comm); + if (err != MPI_SUCCESS) + return h5_error(f, H5_ERR_MPI, "Cannot create cartesian grid"); + return H5_SUCCESS; +} + +h5_err_t +h5priv_mpi_cart_coords ( + h5_file_t* const f, + MPI_Comm comm, + int rank, + int maxdim, + int *coords + ) { + int err = MPI_Cart_coords( comm, rank, maxdim, coords ); + if (err != MPI_SUCCESS) + return h5_error(f, H5_ERR_MPI, "Cannot create cartesian grid"); return H5_SUCCESS; } diff --git a/src/h5core/h5_mpi_private.h b/src/h5core/h5_mpi_private.h index bbc22c8..6a8a744 100644 --- a/src/h5core/h5_mpi_private.h +++ b/src/h5core/h5_mpi_private.h @@ -94,5 +94,25 @@ h5priv_mpi_type_free ( MPI_Datatype *type ); +h5_err_t +h5priv_mpi_cart_create ( + h5_file_t* const f, + MPI_Comm old_comm, + int ndims, + int *dims, + int *period, + int *reorder, + MPI_Comm *new_comm + ); + +h5_err_t +h5priv_mpi_cart_coords ( + h5_file_t* const f, + MPI_Comm comm, + int rank, + int maxdim, + int *coords + ); + #endif #endif diff --git a/src/h5core/h5_types_private.h b/src/h5core/h5_types_private.h index 36cf5d5..df59eb0 100644 --- a/src/h5core/h5_types_private.h +++ b/src/h5core/h5_types_private.h @@ -5,9 +5,9 @@ \struct h5_file This is an essentially opaque datastructure that - acts as the filehandle for all practical purposes. - It is created by H5PartOpenFile() and destroyed by - H5PartCloseFile(). + acts as a filehandle and is defined as type \c h5_file_t. + It is created by \ref H5OpenFile and destroyed by + \ref H5CloseFile. */ struct h5_file { hid_t file; /* file id -> fid */ diff --git a/src/h5core/h5b_attribs.c b/src/h5core/h5b_attribs.c index 3597a28..dad8329 100644 --- a/src/h5core/h5b_attribs.c +++ b/src/h5core/h5b_attribs.c @@ -59,15 +59,6 @@ h5b_get_num_field_attribs ( return n; } -/*! - \ingroup h5block_attrib - - Query information about a attribute given by index \c attrib_idx and - field name \c field_name. The function returns the name of the attribute, - the type of the attribute and the number of elements of this type. - - \return \c H5_SUCCESS or error code -*/ h5_err_t h5b_get_field_attrib_info ( h5_file_t *const f, /*!< IN: file handle */ diff --git a/src/h5core/h5b_model.c b/src/h5core/h5b_model.c index 9ccc14e..dcae95c 100644 --- a/src/h5core/h5b_model.c +++ b/src/h5core/h5b_model.c @@ -4,6 +4,9 @@ #include "h5core/h5_core.h" #include "h5_core_private.h" +#define MIN( x, y ) ( (x) <= (y) ? (x) : (y) ) +#define MAX( x, y ) ( (x) >= (y) ? (x) : (y) ) + /*! \note A partition must not be part of another partition. @@ -21,6 +24,10 @@ _normalize_partition ( ) { h5_size_t tmp; + p->i_start = MAX(0, p->i_start); + p->j_start = MAX(0, p->j_start); + p->k_start = MAX(0, p->k_start); + if ( p->i_start > p->i_end ) { tmp = p->i_start; p->i_start = p->i_end; @@ -101,9 +108,6 @@ _volume_of_partition ( } -#define MIN( x, y ) ( (x) <= (y) ? (x) : (y) ) -#define MAX( x, y ) ( (x) >= (y) ? (x) : (y) ) - /*! \ingroup h5block_private @@ -509,6 +513,13 @@ h5bpriv_create_field_group ( return H5_SUCCESS; } +h5_int64_t +h5b_3d_has_view ( + h5_file_t *const f /*!< IN: File handle */ + ) { + return f->b->have_layout; +} + h5_err_t h5b_3d_set_view ( h5_file_t *const f, /*!< IN: File handle */ @@ -576,6 +587,52 @@ h5b_3d_set_view ( return H5_SUCCESS; } +h5_err_t +h5b_3d_get_view ( + h5_file_t *const f, /*!< IN: File handle */ + h5_size_t *i_start, /*!< OUT: start index of \c i */ + h5_size_t *i_end, /*!< OUT: end index of \c i */ + h5_size_t *j_start, /*!< OUT: start index of \c j */ + h5_size_t *j_end, /*!< OUT: end index of \c j */ + h5_size_t *k_start, /*!< OUT: start index of \c k */ + h5_size_t *k_end /*!< OUT: end index of \c k */ + ) { + + h5b_partition_t *p = f->b->user_layout; + + *i_start = p->i_start; + *i_end = p->i_end; + *j_start = p->j_start; + *j_end = p->j_end; + *k_start = p->k_start; + *k_end = p->k_end; + + return H5_SUCCESS; +} + +h5_err_t +h5b_3d_get_reduced_view ( + h5_file_t *const f, /*!< IN: File handle */ + h5_size_t *i_start, /*!< OUT: start index of \c i */ + h5_size_t *i_end, /*!< OUT: end index of \c i */ + h5_size_t *j_start, /*!< OUT: start index of \c j */ + h5_size_t *j_end, /*!< OUT: end index of \c j */ + h5_size_t *k_start, /*!< OUT: start index of \c k */ + h5_size_t *k_end /*!< OUT: end index of \c k */ + ) { + + h5b_partition_t *p = f->b->write_layout; + + *i_start = p->i_start; + *i_end = p->i_end; + *j_start = p->j_start; + *j_end = p->j_end; + *k_start = p->k_start; + *k_end = p->k_end; + + return H5_SUCCESS; +} + h5_err_t h5b_3d_set_chunk ( h5_file_t *const f, /*!< IN: File handle */ @@ -638,78 +695,145 @@ h5b_3d_get_chunk ( } h5_err_t -h5b_3d_get_view ( - h5_file_t *const f, /*!< IN: File handle */ - const int proc, /*!< IN: Processor to get partition from */ - h5_size_t *i_start, /*!< OUT: start index of \c i */ - h5_size_t *i_end, /*!< OUT: end index of \c i */ - h5_size_t *j_start, /*!< OUT: start index of \c j */ - h5_size_t *j_end, /*!< OUT: end index of \c j */ - h5_size_t *k_start, /*!< OUT: start index of \c k */ - h5_size_t *k_end /*!< OUT: end index of \c k */ +h5b_3d_set_grid ( + h5_file_t *const f, /*!< IN: File handle */ + const h5_size_t i, /*!< IN: dimension in \c i */ + const h5_size_t j, /*!< IN: dimension in \c j */ + const h5_size_t k /*!< IN: dimension in \c k */ ) { - if ( ( proc < 0 ) || ( proc >= f->nprocs ) ) - return h5_error(f, H5_ERR_INVAL, "Invalid processor id %d!", proc); + if (i*j*k != f->nprocs) { + return h5_error(f, H5_ERR_INVAL, + "Grid dimensions (%lld,%lld,%lld) do not multiply " + "out to %d MPI processors!", + (long long)i, + (long long)j, + (long long)k, + f->nprocs); + } - h5b_partition_t *p = &f->b->user_layout[(size_t)proc]; + f->b->k_grid = i; + f->b->j_grid = j; + f->b->i_grid = k; - *i_start = p->i_start; - *i_end = p->i_end; - *j_start = p->j_start; - *j_end = p->j_end; - *k_start = p->k_start; - *k_end = p->k_end; + int dims[3] = { k, j, i }; + int period[3] = { 0, 0, 0 }; + TRY( h5priv_mpi_cart_create(f, + f->comm, 3, dims, period, period, &f->b->cart_comm) ); + + f->b->have_grid = 1; return H5_SUCCESS; } h5_err_t -h5b_3d_get_reduced_view ( - h5_file_t *const f, /*!< IN: File handle */ - const int proc, /*!< IN: Processor to get partition from */ - h5_size_t *i_start, /*!< OUT: start index of \c i */ - h5_size_t *i_end, /*!< OUT: end index of \c i */ - h5_size_t *j_start, /*!< OUT: start index of \c j */ - h5_size_t *j_end, /*!< OUT: end index of \c j */ - h5_size_t *k_start, /*!< OUT: start index of \c k */ - h5_size_t *k_end /*!< OUT: end index of \c k */ +h5b_3d_get_grid_coords ( + h5_file_t *const f, /*!< IN: File handle */ + const int proc, /*!< IN: MPI processor */ + h5_int64_t *i, /*!< OUT: index in \c i */ + h5_int64_t *j, /*!< OUT: index in \c j */ + h5_int64_t *k /*!< OUT: index in \c k */ ) { - if ( ( proc < 0 ) || ( proc >= f->nprocs ) ) - return h5_error(f, H5_ERR_INVAL, "Invalid processor id %d!", proc); + if ( ! f->b->have_grid ) + return h5_error(f, H5_ERR_INVAL, + "Grid dimensions have not been set!"); - h5b_partition_t *p = &f->b->write_layout[(size_t)proc]; + int coords[3]; + TRY( h5priv_mpi_cart_coords(f, f->b->cart_comm, proc, 3, coords) ); + *k = coords[0]; + *j = coords[1]; + *i = coords[2]; + return H5_SUCCESS; +} - *i_start = p->i_start; - *i_end = p->i_end; - *j_start = p->j_start; - *j_end = p->j_end; - *k_start = p->k_start; - *k_end = p->k_end; +h5_err_t +h5b_3d_set_dims ( + h5_file_t *const f, /*!< IN: File handle */ + const h5_size_t i, /*!< IN: dimension in \c i */ + const h5_size_t j, /*!< IN: dimension in \c j */ + const h5_size_t k /*!< IN: dimension in \c k */ + ) { + + if ( ! f->b->have_grid ) + return h5_error(f, H5_ERR_INVAL, + "Grid dimensions have not been set!"); + + h5_size_t dims[3] = { k, j, i }; + h5_size_t check_dims[3] = { k, j, i }; + + TRY( h5priv_mpi_bcast(f, + check_dims, 3, MPI_LONG_LONG, 0, f->comm) ); + + if ( dims[0] != check_dims[0] || + dims[1] != check_dims[1] || + dims[2] != check_dims[2] + ) { + return h5_error(f, H5_ERR_INVAL, + "[%d] Block dimensions do not agree: " + "(%lld,%lld,%lld) != (%lld,%lld,%lld)!", + f->myproc, + (long long)dims[0], (long long)dims[1], (long long)dims[2], + (long long)check_dims[0], (long long)check_dims[1], (long long)check_dims[2]); + } + + h5_int64_t coords[3]; + TRY( h5b_3d_get_grid_coords(f, + f->myproc, coords+0, coords+1, coords+2) ); + + h5b_fdata_t *b = f->b; + + b->user_layout->i_start = coords[2]*dims[2]; + b->user_layout->i_end = (coords[2]+1)*dims[2] - 1; + b->user_layout->j_start = coords[1]*dims[1]; + b->user_layout->j_end = (coords[1]+1)*dims[1] - 1; + b->user_layout->k_start = coords[0]*dims[0]; + b->user_layout->k_end = (coords[0]+1)*dims[0] - 1; + + b->write_layout[0] = b->user_layout[0]; + + b->i_max = b->i_grid * dims[2] - 1; + b->j_max = b->j_grid * dims[1] - 1; + b->k_max = b->k_grid * dims[0] - 1; + + b->have_layout = 1; return H5_SUCCESS; } -int -h5b_3d_get_proc ( +h5_err_t +h5b_3d_set_halo ( h5_file_t *const f, /*!< IN: File handle */ - const h5_int64_t i, /*!< IN: \c i coordinate */ - const h5_int64_t j, /*!< IN: \c j coordinate */ - const h5_int64_t k /*!< IN: \c k coordinate */ + const h5_size_t i, /*!< IN: radius in \c i */ + const h5_size_t j, /*!< IN: radius in \c j */ + const h5_size_t k /*!< IN: radius in \c k */ ) { - h5b_partition_t *layout = f->b->write_layout; - int proc; + if ( ! f->b->have_grid ) + return h5_error(f, H5_ERR_INVAL, + "Grid dimensions have not been set!"); + else if ( ! f->b->have_layout ) + return h5_error(f, H5_ERR_INVAL, + "Block dimensions for grid have not been set!"); - for ( proc = 0; proc < f->nprocs; proc++, layout++ ) { - if ( (layout->i_start <= i) && (i <= layout->i_end) && - (layout->j_start <= j) && (j <= layout->j_end) && - (layout->k_start <= k) && (k <= layout->k_end) ) - return proc; - } - - return -1; + h5b_fdata_t *b = f->b; + + b->user_layout->i_start -= k; + b->user_layout->i_end += k; + b->user_layout->j_start -= j; + b->user_layout->j_end += j; + b->user_layout->k_start -= i; + b->user_layout->k_end += i; + + b->user_layout->i_start = MAX(0, b->user_layout->i_start); + b->user_layout->j_start = MAX(0, b->user_layout->j_start); + b->user_layout->k_start = MAX(0, b->user_layout->k_start); + + b->user_layout->i_end = MIN(b->i_max, b->user_layout->i_end); + b->user_layout->j_end = MIN(b->j_max, b->user_layout->j_end); + b->user_layout->k_end = MIN(b->k_max, b->user_layout->k_end); + + return H5_SUCCESS; } h5_ssize_t diff --git a/src/h5core/h5b_readwrite.c b/src/h5core/h5b_readwrite.c index aaf2e44..6bbd5c0 100644 --- a/src/h5core/h5b_readwrite.c +++ b/src/h5core/h5b_readwrite.c @@ -230,7 +230,7 @@ _select_hyperslab_for_reading ( "Is the file corrupt?"); h5_debug (f, - "PROC[%d]: field_dims: (%lld,%lld,%lld)", + "[%d]: field_dims: (%lld,%lld,%lld)", f->myproc, (long long)field_dims[2], (long long)field_dims[1], diff --git a/src/h5core/h5b_types_private.h b/src/h5core/h5b_types_private.h index 5a41fe4..ddc35bb 100644 --- a/src/h5core/h5b_types_private.h +++ b/src/h5core/h5b_types_private.h @@ -19,6 +19,12 @@ struct h5b_fdata { struct h5b_partition write_layout[1]; int have_layout; + MPI_Comm cart_comm; + h5_size_t i_grid; + h5_size_t j_grid; + h5_size_t k_grid; + int have_grid; + hid_t shape; hid_t memshape; hid_t diskshape; diff --git a/src/include/H5.h b/src/include/H5.h index 3bf36f6..332fde8 100644 --- a/src/include/H5.h +++ b/src/include/H5.h @@ -16,8 +16,6 @@ #ifndef __H5_H #define __H5_H -#include "H5_attribs.h" - h5_file_t * H5OpenFile ( const char * filename, diff --git a/src/include/H5Block.h b/src/include/H5Block.h index 32d65f6..fdace4f 100644 --- a/src/include/H5Block.h +++ b/src/include/H5Block.h @@ -1,8 +1,10 @@ #ifndef __H5BLOCK_H #define __H5BLOCK_H -#include "H5.h" -#include "H5Block_readwrite.h" +h5_int64_t +H5Block3dHasView ( + h5_file_t *const f /*!< IN: File handle */ + ); h5_err_t H5Block3dSetView ( @@ -18,7 +20,6 @@ H5Block3dSetView ( h5_err_t H5Block3dGetView ( h5_file_t *const f, /*!< IN: File handle */ - const int proc, /*!< IN: Processor to get partition from */ h5_size_t *i_start, /*!< OUT: start index of \c i */ h5_size_t *i_end, /*!< OUT: end index of \c i */ h5_size_t *j_start, /*!< OUT: start index of \c j */ @@ -27,6 +28,17 @@ H5Block3dGetView ( h5_size_t *k_end /*!< OUT: end index of \c k */ ); +h5_err_t +H5Block3dGetReducedView ( + h5_file_t *const f, /*!< IN: File handle */ + h5_size_t *i_start, /*!< OUT: start index of \c i */ + h5_size_t *i_end, /*!< OUT: end index of \c i */ + h5_size_t *j_start, /*!< OUT: start index of \c j */ + h5_size_t *j_end, /*!< OUT: end index of \c j */ + h5_size_t *k_start, /*!< OUT: start index of \c j */ + h5_size_t *k_end /*!< OUT: end index of \c j */ + ); + h5_err_t H5Block3dSetChunk ( h5_file_t *const f, /*!< IN: File handle */ @@ -43,23 +55,36 @@ H5Block3dGetChunk ( ); h5_err_t -H5Block3dGetReducedView ( - h5_file_t *const f, /*!< IN: File handle */ - const int proc, /*!< IN: Processor to get partition from */ - h5_size_t *i_start, /*!< OUT: start index of \c i */ - h5_size_t *i_end, /*!< OUT: end index of \c i */ - h5_size_t *j_start, /*!< OUT: start index of \c j */ - h5_size_t *j_end, /*!< OUT: end index of \c j */ - h5_size_t *k_start, /*!< OUT: start index of \c j */ - h5_size_t *k_end /*!< OUT: end index of \c j */ +H5Block3dSetGrid ( + h5_file_t *const f, /*!< IN: File handle */ + const h5_size_t i, /*!< IN: dimension in \c i */ + const h5_size_t j, /*!< IN: dimension in \c j */ + const h5_size_t k /*!< IN: dimension in \c k */ ); -int -H5Block3dGetProc ( +h5_err_t +H5Block3dGetGridCoords ( h5_file_t *const f, /*!< IN: File handle */ - const h5_int64_t i, /*!< IN: \c i coordinate */ - const h5_int64_t j, /*!< IN: \c j coordinate */ - const h5_int64_t k /*!< IN: \c k coordinate */ + const int proc, /*!< IN: MPI processor */ + h5_int64_t *i, /*!< OUT: index in \c i */ + h5_int64_t *j, /*!< OUT: index in \c j */ + h5_int64_t *k /*!< OUT: index in \c k */ + ); + +h5_err_t +H5Block3dSetDims ( + h5_file_t *const f, /*!< IN: File handle */ + const h5_size_t i, /*!< IN: dimension in \c i */ + const h5_size_t j, /*!< IN: dimension in \c j */ + const h5_size_t k /*!< IN: dimension in \c k */ + ); + +h5_err_t +H5Block3dSetHalo ( + h5_file_t *const f, /*!< IN: File handle */ + const h5_size_t i, /*!< IN: radius in \c i */ + const h5_size_t j, /*!< IN: radius in \c j */ + const h5_size_t k /*!< IN: radius in \c k */ ); h5_size_t @@ -113,15 +138,15 @@ H5BlockGetNumFieldAttribs ( h5_int64_t H5BlockGetFieldAttribInfo ( - h5_file_t *const f, /*!< [in] Handle to open file */ + h5_file_t *const f, /*" + echo " OPTIONS:" + echo " -help This help message." + echo " -echo Show all the shell commands executed" + echo " -prefix=DIR Prefix directory to find HDF5 lib/ and include/" + echo " subdirectories [default: $prefix]" + echo " -show Show the commands without executing them" + echo " -showconfig Show the HDF5 library configuration summary" + echo " " + echo " - the normal compile line options for your compiler." + echo " $prog_name uses the same compiler you used to compile" + echo " HDF5. Check with your compiler's man pages for more" + echo " information on which options are needed." + echo " " + echo " You can override the compiler, linker, and whether or not to use static" + echo " or shared libraries to compile your program by setting the following" + echo " environment variables accordingly:" + echo " " + echo " H5HUT_CC - use a different C compiler" + echo " H5HUT_CLINKER - use a different linker" + echo " " + exit 1 +} + +# Show the configuration summary of the library recorded in the +# libhdf5.settings file reside in the lib directory. +showconfigure() +{ + cat ${hdf5dir}/lib/libhdf5.settings + status=$? +} + +# Main +status=0 + +if test "$#" = "0"; then + # No parameters specified, issue usage statement and exit. + usage +fi + +case "$CC" in + gcc) + kind="gcc" + ;; + mpicc|mpcc|mpicc_r) + # Is this gcc masquarading as an MPI compiler? + if test "`${CC} -v 2>&1 | sed -n 2p | cut -c1-3`" = "gcc"; then + kind="gcc" + else + # Nope + kind="$host_os" + fi + ;; + *) + kind="$host_os" + ;; +esac + +for arg in $@ ; do + if test "x$get_output_file" = "xyes"; then + link_args="$link_args $arg" + output_file="$arg" + get_output_file="no" + continue + fi + + case "$arg" in + -c) + allargs="$allargs $arg" + compile_args="$compile_args $arg" + + if test "x$do_link" = "xyes" -a -n "$output_file"; then + compile_args="$compile_args -o $outputfile" + fi + + do_link="no" + dash_c="yes" + ;; + -o) + allargs="$allargs $arg" + dash_o="yes" + + if test "x$dash_c" = "xyes"; then + compile_args="$compile_args $arg" + else + link_args="$link_args $arg" + do_link="yes" + get_output_file="yes" + fi + ;; + -E|-M) + allargs="$allargs $arg" + compile_args="$compile_args $arg" + dash_c="yes" + do_link="no" + ;; + -l*) + libraries=" $libraries $arg " + allargs="$allargs $arg" + ;; + -prefix=*) + prefix="`expr "$arg" : '-prefix=\(.*\)'`" + ;; + -echo) + set -x + ;; + -show) + SHOW="echo" + ;; + -showconfig) + showconfigure + exit $status + ;; + -help) + usage + ;; + *\"*) + qarg="'"$arg"'" + allargs="$allargs $qarg" + ;; + *\'*) + qarg='\"'"$arg"'\"' + allargs="$allargs $qarg" + ;; + *) + allargs="$allargs $qarg" + + if test -s "$arg"; then + ext=`expr "$arg" : '.*\(\..*\)'` + + if test "x$ext" = "x.c"; then + do_compile="yes" + compile_args="$compile_args $arg" + fname=`basename $arg .c` + link_objs="$link_objs $fname.o" + elif test "x$ext" = "x.o"; then + if test "x$dash_c" = "xyes"; then + compile_args="$compile_args $arg" + else + do_link="yes" + link_objs="$link_objs $arg" + fi + elif test "x$ext" = "x.a"; then + # This is an archive that we're linking in + libraries=" $libraries $arg " + else + compile_args="$compile_args $arg" + link_args="$link_args $arg" + fi + else + compile_args="$compile_args $arg" + link_args="$link_args $arg" + fi + ;; + esac +done + +if test "$dash_c" = "yes" -a "$do_compile" = no -a "$do_link" = no ; then + # -c was specified. Force do_compile on. + do_compile=yes +fi + +if test "x$do_compile" = "xyes"; then + if test "x$dash_c" != "xyes"; then + compile_args="-c $compile_args" + fi + + $SHOW $CC -I$includedir $INCLUDES $CPPFLAGS $CFLAGS $compile_args + status=$? + + if test "$status" != "0"; then + exit $status + fi +fi + +if test "x$do_link" = "xyes"; then + shared_link="" + libraries=" $libraries -lH5hutC -lH5hut " + link_args="$link_args -L${libdir}" + + case "$kind" in + gcc|linux*) + # MacOS X doesn't support the "-Wl,-rpath -Wl," style of linker flags. + # It appears to want none of them specified. + case "$host_os" in + darwin*) flag="" ;; + *) flag="-Wl,-rpath -Wl," ;; + esac + ;; + hpux*) flag="-Wl,+b -Wl," ;; + freebsd*|solaris*) flag="-R" ;; + rs6000*|aix*) flag="-L" ;; + irix*|sgi) flag="-rpath " ;; + *) flag="" ;; + esac + + if test -n "$flag"; then + shared_link="${flag}${libdir}" + fi + + for lib in $libraries; do + if echo $link_args | grep " $lib " > /dev/null || + echo $link_args | grep " $lib$" > /dev/null; then + : + else + link_args="$link_args $lib " + fi + done + + # The LIBS are just a bunch of -l* libraries necessary for the HDF5 + # module. It's okay if they're included twice in the compile line. + link_args="$link_args $LIBS" + + $SHOW $CLINKER $CFLAGS $LDFLAGS $clibpath $link_objs $link_args + status=$? +fi + +exit $status