Compare commits

..

68 Commits

Author SHA1 Message Date
adelmann f40c99b10c add -a zvalue 2010-07-05 17:53:57 +00:00
adelmann f816f1d9ff more features 2010-07-05 13:00:54 +00:00
adelmann ccdaca55c5 add H5PartWriteDataFloat32 H5PartReadDataFloat32 2010-06-15 13:10:11 +00:00
adelmann 35db555dce add h5ToVtk 2010-06-15 11:52:49 +00:00
adelmann 5333ff810f more small changes 2010-06-15 11:51:40 +00:00
adelmann 4e988bd0d6 first experimentatl version of h5 to VTK for dark current simulations 2010-06-10 11:09:35 +00:00
gsell 72ebca84e0 - documentation updates
- return H5PART_ERR_INVAL in function H5Block3dGetProcOf() on invalid 
coordinates
2009-01-21 12:13:20 +00:00
gsell 02eae3a724 * changed arg type of _H5Part_set_funcname() to "const char * const"
* HDF5 1.8 support added
2009-01-16 15:33:18 +00:00
gsell 6fc16f9e3e changed declaration of _H5Part_set_funcname: fname is now of type "const char * const" 2009-01-16 15:31:16 +00:00
gsell 9b0c18cd40 added HDF5 chunking 2009-01-16 15:27:38 +00:00
gsell 9d299def98 added following functions:
H5Block3dReadScalarFieldFloat64
	H5Block3dReadScalarFieldFloat32
	H5Block3dReadScalarFieldInt64
	H5Block3dWriteScalarFieldFloat64
	H5Block3dWriteScalarFieldFloat32
	H5Block3dWriteScalarFieldInt64
2009-01-16 15:26:31 +00:00
gsell 491c0a0fb1 typedef float added 2009-01-15 16:29:13 +00:00
gsell d0e6cc3a63 - HANDLE_H5P_SET_FAPL_ERR renamed
- HANDLE_H5P_SET_CHUNK_ERR added
2009-01-15 16:27:59 +00:00
gsell ed4d8af66e - patch from Mark revied and applied
- all "echo" calls removed by AC_MSG_XXX
- strict indention
2009-01-15 16:21:16 +00:00
gsell e3f2584c8c added 2009-01-15 15:19:02 +00:00
gsell 6633dace44 moved install instructions to file INSTALL 2009-01-15 15:18:37 +00:00
gsell 11bc7db824 added 2009-01-15 15:15:39 +00:00
gsell 34eea1e11a removed 2009-01-15 15:15:26 +00:00
gsell e72d5f351f moved some entries to ChangeLog 2009-01-15 15:10:46 +00:00
gsell 72fe466514 2009-01-15 15:09:49 +00:00
gsell da4a5e9080 removed, generated by autotools 2009-01-15 14:55:06 +00:00
gsell 06da58b100 News for version 1.4.1 added 2009-01-15 14:50:03 +00:00
gsell d41a59f991 Mark Howison added 2009-01-15 14:10:39 +00:00
adelmann a927ae4d67 bla bla bla :) add cast in order to fix problem with malloc 2008-11-20 16:08:35 +00:00
gsell 249117c89e serial and parallel code merged 2008-06-24 18:59:06 +00:00
gsell 463ef08da9 branch stable 1.4 version 2007-09-21 09:53:26 +00:00
Kurt Stockinger 607d1e86ab Corrected version number 2007-08-29 01:59:47 +00:00
Kurt Stockinger 3ebc9de7a9 Prepare new tag with updates on H5Block. 2007-08-29 01:26:50 +00:00
gsell d8ce890902 src/H5Block.c
_normalize_partition()
	* wrong type for 'x' fixed
_open_block_group()
_open_field_group()
	* 'herr' type error fixed
_select_hyperslab_for_reading()
	* 'herr' type error fixed
	* type cast boundaries to 'hsize_t'
_create_field_group()
	* 'herr' type error fixed
H5BlockWriteFieldAttrib()
	* type cast 'attrib_type' to 'hid_t'
H5Block3dSetFieldOrigin()
H5Block3dGetFieldSpacing()
	* type cast 'H5PART_FLOAT64' to 'hid_t'
2007-07-12 09:50:42 +00:00
gsell b191ac7a6a src/H5Part.c
- H5PartDefineStepName()
	* type cast 'width'
- _H5Part_iteration_operator()
	* type cast error return
- _H5Part_get_object_name()
	* type cast of arg 'idx' and 'len_obj_name' added
- H5PartGetDatasetInfo()
	* type of 'herr' changed from 'herr_t' to 'h5part_int64_t'
- _get_diskshape_for_reading()
 	* 'CHECK_FILEHANDLE()' removed
	* type cast error return to 'hid_t'
- _get_memshape_for_reading()
 	* 'CHECK_FILEHANDLE()' removed
	* type cast error return to 'hid_t'
2007-07-12 09:15:21 +00:00
gsell 356f7149c5 src/H5Part.c
- _read_data()
	* type error fixed
- H5PartAbortErrorHandler()
	* type cast exit code
- H5PartSetVerbosityLevel()
	* type cast 'level' to 'unsigned int'
2007-07-11 15:34:15 +00:00
gsell a0dd21b79e src/H5Part.c
- _H5Part_set_step()
	* revert use of 'snprintf()' (Windows doesn't have it!)
2007-07-11 15:10:06 +00:00
gsell 08ce0ee46a src/H5Part.c
- _H5Part_get_attrib_info():
	* type cast 'attrib_type' in call to '_H5Part_write_attrib()'
- H5PartWriteStepAttrib()
	* change type of 'herr' to 'h5part_int64_t'
	* type cast 'attrib_type' in call to '_H5Part_write_attrib()'
- H5PartWriteFileAttrib()
	* change type of 'herr' to 'h5part_int64_t'
	* type cast 'attrib_type' in call to '_H5Part_write_attrib()'
- H5PartGetStepAttribInfo()
  H5PartGetFileAttribInfo()
  H5PartReadStepAttrib()
  H5PartReadFileAttrib()
	* change type of 'herr' to 'h5part_int64_t'
- _H5Part_set_step()
	* use 'snprintf()' instead of 'sprintf()'
2007-07-11 15:06:49 +00:00
gsell 7085e22448 src/H5PartTypes.h
- revert last change
2007-07-11 14:58:20 +00:00
gsell 74a31f9b8f src/H5Part.c
- several implicit type conversions fixed
2007-07-11 14:37:39 +00:00
gsell a38a56865f src/H5PartTypes.h:
- change type 'stepno_width' in 'struct H5PartFile' from 'int' to
  'h5part_int64-t'
2007-07-11 14:35:51 +00:00
Kurt Stockinger 1a20e25a84 Added nSteps as command line parameter 2007-07-10 22:41:55 +00:00
gsell 43ff5d2ca0 src/H5PartF90.inc
- declarations for open in append mode functions added
2007-06-29 10:02:04 +00:00
gsell 8080f5e2e5 src/H5PartF.c
- h5pt_opena() open in append mode added
- h5pt_opena_par() open in append mode paralell version added
2007-06-29 10:01:06 +00:00
Kurt Stockinger 4f870ccbf7 Fixed H5PartGetDatasetInfo. 2007-06-27 23:12:51 +00:00
gsell e6364c637d src/H5BlockF.c
* correct macro definition of FORTRAN library names for field spacing/origin attribute
2007-06-16 21:35:37 +00:00
gsell 28c0ac78ad src/H5BlocF90.inc
* declaration of h5bl_3d_{g,s}et_field_origin() added
2007-06-14 15:13:26 +00:00
gsell a642074d85 src/H5Block.c
* Attribute name for field spacing renamed from "Spacing" to "__Spacing__"
* Attribute name for field origin renamed from "Origin" to "__Origin__"
2007-06-14 15:12:22 +00:00
gsell e962caf1b9 src/H5BlockF.c
* h5b_3d_set_field_origin() and h5b_3d_get_field_origin() added
* wrong types in h5b_3d_{g,s}et_field_spacing fixed
2007-06-14 15:10:37 +00:00
gsell 8cad5e3aea src/H5BlockF.c
* h5b_3d_set_field_spacing() and h5b_3d_get_field_spacing() added
2007-06-13 12:33:38 +00:00
gsell a2dfad7b69 src/H5BlockF90.inc
* Declarations to set/get field spacing functions added
2007-06-13 12:32:33 +00:00
Kurt Stockinger 15c2e1260a Removed trailing backslash. 2007-06-12 16:39:03 +00:00
gsell 655511a02a src/H5Block.c
* Documentation added
2007-06-12 09:59:35 +00:00
gsell 0231ece31b src/H5Block.h
* Obsolete declarations removed
2007-06-12 08:40:58 +00:00
Kurt Stockinger b64ddd03d1 Added MPI-IO for large block I/O + switch for COLLECTIVE/NON-COLLECTIVE IO. 2007-06-08 17:02:17 +00:00
Kurt Stockinger 853837477e Fixed wrong include file and variable types. 2007-06-07 00:35:31 +00:00
Kurt Stockinger 4956504d17 Fixed dataset name in _get_field_info 2007-06-06 23:47:27 +00:00
gsell e4c8f743ae src/H5Block.c
* doxygen documentation added
2007-06-06 09:30:05 +00:00
gsell df627138dc src/H5Part
* _H5Part_open_file()
	- set f->comm to 0 in serial caseI_COMM_WORLD;
2007-06-06 09:29:04 +00:00
gsell a4e77a138a doc/Makefile.am: web-pages removed 2007-05-21 13:29:31 +00:00
gsell 9a09f11631 undelete 2007-05-21 13:28:49 +00:00
gsell 783a1ce2b5 Web-pages moved to new repo "H5Webpages" 2007-05-21 12:57:37 +00:00
gsell c43f785ab0 src/H5Block.c
- more doxygen doc added
2007-05-17 16:30:37 +00:00
gsell e1a18b62e2 src/H5Part.h
- function H5PartHasStep() added
2007-05-17 16:29:08 +00:00
gsell 3ae60f8e46 src/H5Part.c
- _H5Part_open_file()
		* allocate mem for pnparticles in any case
	- H5PartHasStep()
		* function added
2007-05-17 16:28:24 +00:00
gsell 949505517c doc/H5X_File_Format.txt 2007-05-15 15:59:42 +00:00
gsell ae9fd98dac src/H5PartTypes.h
- "typdef" typo fixed in WIN32 section
2007-05-11 16:05:59 +00:00
gsell 70bc6af59f test/H5BlockTestAttributes.c
- include mpi.h removed if PARRALLEL_IO
	- typedef MPI_Comm removed if not PARALLEL_IO
2007-05-10 20:37:34 +00:00
gsell 825322c576 src/H5Part.c
- some type-casts added
	- internal error variable '_errno' renamed to '_h5part_errno'
2007-05-10 19:18:00 +00:00
gsell 58bd753fad src/H5Block.c
- type cast all malloc's
2007-05-10 19:15:22 +00:00
gsell 904e609377 src/H5Part.h
- don't wrap system include files in 'extern "C"'
2007-05-10 19:13:36 +00:00
gsell d1b594a788 src/H5Part/Types:
- tydef of int64_t added for Windows
2007-05-10 19:08:32 +00:00
gsell 3bafbc6029 continue writing 2007-05-10 15:03:37 +00:00
53 changed files with 2926 additions and 3798 deletions
+3 -25
View File
@@ -1,45 +1,22 @@
* text=auto !eol * text=auto !eol
/AUTHORS -text /AUTHORS -text
/COPYRIGHT -text /COPYING -text
/ChangeLog -text /ChangeLog -text
/GNUmakefile.orig -text /GNUmakefile.orig -text
/INSTALL -text
/Makefile.am -text /Makefile.am -text
/Makefile.orig -text /Makefile.orig -text
/NEWS -text /NEWS -text
/README -text /README -text
/autogen.sh -text /autogen.sh -text
/config.guess -text /config.guess -text
/config.h.in -text
/config.sub -text /config.sub -text
/configure.ac -text /configure.ac -text
/depcomp -text /depcomp -text
doc/Building.html -text
doc/BuildingHDF5.html -text
doc/Downloading.html -text
doc/Doxyfile -text doc/Doxyfile -text
doc/H5PartExpress.html -text
doc/H5PartIDL.html -text
doc/H5PartParaview.html -text
doc/H5PartTools.html -text
doc/H5PartVisIt.html -text
doc/H5PartVisIt/cloud_visit.png -text
doc/H5PartVisIt/cloud_visit.s.png -text
doc/H5PartVisIt/cloud_visit_2D.png -text
doc/H5PartVisIt/cloud_visit_2D.s.png -text
doc/H5PartVisIt/visit_query1.png -text
doc/H5PartVisIt/visit_query1.s.png -text
doc/H5X_File_Format.txt -text doc/H5X_File_Format.txt -text
doc/H5tools/H5tools.html -text
doc/H5tools/H5tools_files/snapshot1.jpg -text
doc/InternalLayout.html -text
doc/Makefile.am -text doc/Makefile.am -text
doc/UsingC.html -text
doc/UsingF.html -text
doc/collision_6.png -text
doc/collision_6.s.png -text
doc/doxyfooter -text doc/doxyfooter -text
doc/h5part.html -text
doc/layout.png -text
/install-sh -text /install-sh -text
/license.txt -text /license.txt -text
/missing -text /missing -text
@@ -79,6 +56,7 @@ test/H5testFpar.f90 -text
test/Makefile.am -text test/Makefile.am -text
tools/Makefile.am -text tools/Makefile.am -text
tools/README -text tools/README -text
tools/h5ToVtk.cc -text
tools/h5pAttrib.cc -text tools/h5pAttrib.cc -text
tools/h5pToGNUplot.cc -text tools/h5pToGNUplot.cc -text
tools/homdynToH5p.cc -text tools/homdynToH5p.cc -text
+1
View File
@@ -6,5 +6,6 @@ Benedikt Oswald (PSI)
Wes Bethel (NERSC/LBNL) Wes Bethel (NERSC/LBNL)
John Shalf (NERSC/LBNL) John Shalf (NERSC/LBNL)
Cristina Siegerist (NERSC/LBNL) Cristina Siegerist (NERSC/LBNL)
Mark Howison (NERSC/LBNL)
Please use h5part@lists.psi.ch for communicaion. Please use h5part@lists.psi.ch for communicaion.
+71
View File
@@ -0,0 +1,71 @@
*** Copyright Notice ***
H5Part Copyright (c) 2006-2009, 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.
If you have questions about your rights to use or distribute this
software, please contact Berkeley Lab's Technology Transfer Department
at TTD@lbl.gov referring to "H5Part (LBNL Ref CR-2255)"
NOTICE. This software was developed under partial funding from the U.S.
Department of Energy. As such, the U.S. Government has been granted for
itself and others acting on its behalf a paid-up, nonexclusive,
irrevocable, worldwide license in the Software to reproduce, prepare
derivative works, and perform publicly and display publicly. Beginning
five (5) years after the date permission to assert copyright is obtained
from the U.S. Department of Energy, and subject to any subsequent five
(5) year renewals, the U.S. Government is granted for itself and others
acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide
license in the Software to reproduce, prepare derivative works,
distribute copies to the public, perform publicly and display publicly,
and to permit others to do so.
*** License agreement ***
H5Part Copyright (c) 2006-2009, 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.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
(1) Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
(2) Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
(3) Neither the name of the University of California, Lawrence Berkeley
National Laboratory, U.S. Dept. of Energy, Paul Scherrer Institut
(Switzerland) nor the names of its contributors may be used to endorse
or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
You are under no obligation whatsoever to provide any bug fixes,
patches, or upgrades to the features, functionality or performance of
the source code ("Enhancements") to anyone; however, if you choose to
make your Enhancements available either publicly, or directly to
Lawrence Berkeley National Laboratory, without imposing a separate
written license agreement for such Enhancements, then you hereby grant
the following license: a non-exclusive, royalty-free perpetual license
to install, use, modify, prepare derivative works, incorporate into
other computer software, distribute, and sublicense such enhancements or
derivative works thereof, in binary and source code form.
-7
View File
@@ -1,7 +0,0 @@
*** Copyright Notice ***
H5Part Copyright (c) 2006, 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.
If you have questions about your rights to use or distribute this software, please contact Berkeley Lab's Technology Transfer Department at TTD@lbl.gov referring to "H5Part (LBNL Ref CR-2255)"
NOTICE. This software was developed under partial funding from the U.S. Department of Energy. As such, the U.S. Government has been granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, prepare derivative works, and perform publicly and display publicly. Beginning five (5) years after the date permission to assert copyright is obtained from the U.S. Department of Energy, and subject to any subsequent five (5) year renewals, the U.S. Government is granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, prepare derivative works, distribute copies to the public, perform publicly and display publicly, and to permit others to do so.
+24
View File
@@ -0,0 +1,24 @@
2008-12-19 Mark Howison <mhowison@lbl.gov>
* Added support for HDF 1.8.1.
* Added float32 and int64 versions of the H5Block scalar field
read/write functions, using a new naming convention:
H5Block3dWriteScalarFieldFloat64() (was H5Block3dWriteScalarField())
H5Block3dWriteScalarFieldFloat32() (new)
H5Block3dWriteScalarFieldInt64() (new)
* Modified _write_data() in H5Block to write arbitrary data types.
* Fixed a bug in the configure script which was preventing
compilation of the FORTRAN library on Cray XT4 architectures.
* Added the "--with-mpiposix" option to the configure script to enable
the MPI-POSIX VFD in the HDF5 layer.
2008-11-20 Andreas Adelmann <andreas.adelmann@psi.ch>
* Fixed a bug in ./test/H5BlockTestAttributes.c
+437
View File
@@ -0,0 +1,437 @@
==============================================================================
README file for H5Part configure
==============================================================================
+ 0. HDF5 library
-----------------
Make sure you have a working version of the HDF5 library installed. If you plan
to use parallel I/O you need to use a parallel HDF5 version. Source files and
installation instructions are available from the HDF5 website:
http://www.hdfgroup.org/HDF5/
+ 1. Quick start (If you feel lucky...)
----------------------------------------
For many platforms, where compilers are installed in the "default" location
and all the environment variables are set correctly, it should be sufficient
to type:
./configure [OPTIONS] && make [install]
to have the libraries and test program compiled.
+ 2. Configure line options
----------------------------
To view a full list of configure option, use:
./configure --help
(1) Enable options
--enable-fortran
--enable-parallel
--enable-tools
--enable-python
--enable-64 (only for AIX and Irix)
(2) Setting compilers related variables manually
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE before running configure. For example, if you are using the bash
shell, you might type:
export CC=gcc
to set the default C compiler. See below for descriptions of some useful
variables.
Compiler environment variables:
CC C compiler command
CXX C++ compiler command
FC Fortran compiler command
MPICC MPI-enabled C compiler command
MPICXX MPI-enabled C++ compiler command
MPIFC MPI-enabled Fortran compiler command
CFLAGS flags to append when invoking the C compiler
Library environment variables:
LDFLAGS flags to append when invoking the linker
(3) Setting prefix for installation manually (by default, the package will
install itself in the 'build' subdirectory of your source directory)
--prefix=PREFIX install files in PREFIX
+ 3. Platform specific settings for compiling libraries & test programs
------------------------------------------------------------------------
Building
make : builds the libraries and test programs
make install: builds and installs
make clean : removes extraneous object files
make distclean : returns configuration to unconfigured state
As tested on hosts:
(0) Franklin <franklin.nersc.gov> (CNL - Cray XT4)
--------------------------------------------------
module add hdf5_par
module add zlib
module add szip
export CC=cc CXX=CC FC=ftn MPICC=cc MPICXX=CC MPIFC=ftn
export LDFLAGS=$HDF5
./configure --enable-fortran --enable-parallel --with-hdf5path=$HDF5_PAR_DIR --with-mpiposix
make install
(1) Davinci <davinci.nersc.gov> (Linux"SUSE"-ia64)
---------------------------------------------------
FIRST THING FIRST!! Type:
module load intel
to have the proper compilers set up for use.
module load hdf5_par
[NOTE: module load hdf5 does not work at this moment.
Possible installation error of HDF5 on Davinci.]
Brief profile:
CC = icc
CXX = icc
FC = ifort
MPICC = icc
MPICXX = icc
MPIFC = ifort
If default doesn't work, try:
For C shell:
env CC=icc CXX=icc FC=ifort MPICC=icc MPICXX=icc MPIFC=ifort ./configure && make install
For Korn or Bourne shell:
CC=icc CXX=icc FC=ifort MPICC=icc MPICXX=icc MPIFC=ifort ./configure && make install
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
On this host, executing:
For C shell:
env CC=icc CXX=icc FC=ifort MPICC=icc MPICXX=icc MPIFC=ifort ./configure --enable-fortran --enable-parallel && make install
For Korn or Bourne shell:
CC=icc CXX=icc FC=ifort MPICC=icc MPICXX=icc MPIFC=ifort ./configure --enable-fortran --enable-parallel && make install
has functioned correctly.
To run test program, go to test directory:
(i) Serial test
run:
./H5testF
./H5PartTest
(ii) Parallel test
run:
mpirun 2 H5testFpar
mpirun 2 H5PartTestP
NOTE: Number 2 above is a arbitrary number that indicates the number of processes.
(2) Jacquard <jacquard.nersc.gov> (Linux"SUSE"-x86_64)
-------------------------------------------------------
Brief profile:
CC = pathcc
CXX = pathCC
FC = pathf90
MPICC = mpicc
MPICXX = mpicxx
MPIFC = mpif90
If default doesn't work, try:
For C shell:
env CC=pathcc CXX=pathCC FC=pathf90 MPICC=mpicc MPICXX=mpicxx MPIFC=mpif90 ./configure && make install
For Korn or Bourne shell:
CC=pathcc CXX=pathCC FC=pathf90 MPICC=mpicc MPICXX=mpicxx MPIFC=mpif90 ./configure && make install
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
On this host, executing:
For C shell:
env CC=pathcc CXX=pathCC FC=pathf90 MPICC=mpicc MPICXX=mpicxx MPIFC=mpif90 ./configure --enable-fortran --enable-parallel && make install
For Korn or Bourne shell:
CC=pathcc CXX=pathCC FC=pathf90 MPICC=mpicc MPICXX=mpicxx MPIFC=mpif90 ./configure --enable-fortran --enable-parallel && make install
has functioned correctly.
To run test program, go to test directory:
(i) Serial test
run:
./H5testF
./H5PartTest
(ii) Parallel test
In Jacquard, we need a script to run parallel programs, since Jacquard does not support interactive parallel processing. Instead, we need to submit the task to a queue. A sample script (run_H5testFpar.scr) may look like below:
+++++++++++++++++++++++++++++++++++++++
#!/bin/csh
#PBS -l nodes=1:ppn=2,walltime=00:05:00
#PBS -N H5testFpar
#PBS -o H5testFpar.out
#PBS -e H5testFpar.err
#PBS -q debug
#PBS -A mpccc
#PBS -V
setenv PBS_OWORKDIR /home/H5Part/test
cd $PBS_O_WORKDIR
mpirun -np 2 ./H5testFpar
+++++++++++++++++++++++++++++++++++++++
Then, we need to submit the task to a queue by running:
qsub run_H5testFpar.scr
After processed, the result will appear in H5testFpar.out, and error messages will appear in H5testFpar.err.
(3) Bassi <bassi.nersc.ogv> (AIX5.3.0.0-Power 3)
-------------------------------------------------
FIRST THING FIRST!! Type:
module load gcc
to have the proper compilers set up for use.
Brief profile:
CC = cc_r
CXX = cc_r
FC = xlf_r
MPICC = mpcc_r
MPICXX = mpcc_r
MPIFC = mpxlf_r
If default doesn't work, try:
For C shell:
env CC=cc_r CXX=cc_r FC=xlf_r MPICC=mpcc_r MPICXX=mpcc_r MPIFC=mpxlf_r ./configure && make install
For Korn or Bourne shell:
CC=cc_r CXX=cc_r FC=xlf_r MPICC=mpcc_r MPICXX=mpcc_r MPIFC=mpxlf_r ./configure && make install
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
On this host, executing:
For C shell:
env CC=cc_r CXX=cc_r FC=xlf_r MPICC=mpcc_r MPICXX=mpcc_r MPIFC=mpxlf_r ./configure --enable-fortran --enable-parallel && make install
For Korn or Bourne shell:
CC=cc_r CXX=cc_r FC=xlf_r MPICC=mpcc_r MPICXX=mpcc_r MPIFC=mpxlf_r ./configure --enable-fortran --enable-parallel && make install
has functioned correctly.
To run test program, go to test directory:
(i) Serial test
run:
./H5testF
./H5PartTest
(ii) Parallel test
run:
unsetenv MP_SINGLE_THREAD
poe ./H5PartTestP -procs 2 -nodes 1
poe ./H5testFpar -procs 2 -nodes 1
For more details on how to run parallel programs on Bassi, go to:
http://www.nersc.gov/nusers/resources/bassi/running_jobs/
(4) Starsky <starsky.lbl.gov> (Darwin8.5.0-PowerPC)
----------------------------------------------------
FIRST THING FIRST!! Set environment variables: (in tcsh)
setenv LD_LIBRARY_PATH /usr/local/g95/lib/gcc-lib/powerpc-apple-darwin8.5.0/4.0.3/
setenv PATH ${PATH}:/usr/local/g95/bin
NOTE: This environment variable setting is specifit to Starsky. It is to make configure find the fortran compiler.
Brief profile:
CC = gcc
CXX = g++
FC = g95
If default doesn't work, try:
For C shell:
env CC=gcc CXX=g++ FC=g95 ./configure && make install
For Korn or Bourne shell:
CC=gcc CXX=g++ FC=g95 ./configure && make install
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
On this host, executing:
For C shell:
env CC=gcc CXX=g++ FC=g95 ./configure --enable-fortran && make install
For Korn or Bourne shell:
CC=gcc CXX=g++ FC=g95 ./configure --enable-fortran && make install
has functioned correctly.
To run test program, go to test directory:
(i) Serial test
run:
./H5testF
./H5PartTest
(5) Linux AMD64 Visualization group workstations (Linux"SUSE"-x86_64)
---------------------------------------------------------
Brief profile:
CC = gcc
CXX = g++
FC = g95
If default doesn't work, try:
For C shell:
env CC=gcc CXX=g++ FC=g95 ./configure && make install
For Korn or Bourne shell:
CC=gcc CXX=g++ FC=g95 ./configure && make install
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
On this host, executing:
For C shell:
env CC=gcc CXX=g++ FC=g95 ./configure --enable-fortran && make install
For Korn or Bourne shell:
CC=gcc CXX=g++ FC=g95 ./configure --enable-fortran && make install
has functioned correctly.
To run test program, go to test directory:
(i) Serial test
run:
./H5testF
./H5PartTest
(6) Cray XT3 @ CSCS gele
1) modules/3.1.6 9) PrgEnv-pgi/1.4.26 17) xt-lustre-ss/1.4.26
2) MySQL/4.0.26 10) xt-pbs/5.3.4 18) Base-opts/1.4.26
3) acml/3.0 11) xt-service/1.4.26 19) subversion/1.3.2
4) pgi/6.1.4 12) xt-libc/1.4.26 20) zlib/1.2.3
5) totalview/7.2.0 13) xt-os/1.4.26 21) szip/2.0
6) xt-libsci/1.4.26 14) xt-catamount/1.4.26 22) hdf5/1.6.5
7) xt-mpt/1.4.26 15) xt-boot/1.4.26
8) xt-pe/1.4.26 16) xt-crms/1.4.26
CFLAGS="-I$H5HOME/include -DF77_SINGLE_UNDERSCORE" LDFLAGS="-L$H5HOME/lib -L$ZHOME/lib" ./configure --enable-parallel --enable-fortran
(7) merlin00 / merlin3
Currently Loaded Modulefiles:
1) hdf5/hdf5-1.6.5 2) root/root-5.10.00 3) mpi/mpich2-1.0.3-pgi-6.1 4) pgi/pgi_64-6.1
FC=mpif90 ./configure --enable-parallel --enable-fortran
==============================================================================
+ 4. Trouble shooting (Things to check for...)
--------------------------------------------
(0) Have you set the LD_LIBRARY_PATH?
---Some systems require the user to manually set the environment variable, LD_LIBRARY_PATH. To do so:
set the environment variable HDF5ROOT or PHDF5ROOT to point to your installation of HDF5 (serial and/or parallel respectively).
For Korn or Bourne shell:
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${HDF5ROOT}/lib;export LD_LIBRARY_PATH
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:{PHDF5ROOT}/lib;export LD_LIBRARY_PATH
For C shell:
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${HDF5ROOT}/lib
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${PHDF5ROOT}/lib
Note that the values of HDF5ROOT & PHDF5ROOT will be in the "summary" section when you run configure.
Not properly set LD_LIBRARY_PATH value may result in a runtime error:
./H5PartTest: error while loading shared libraries: libhdf5.so.0: cannot open shared object file: No such file or directory
(1) Are the compilers set correctly?
---Check with: which COMPILER
(2) Have you installed HDF5?
---You can get it at: http://vis.lbl.gov/Research/AcceleratorSAPP/index.html
(3) Have you loaded the proper modules?
---It is necessary in Davinci & Bassi, and configure && make install may not work without it.
+18
View File
@@ -1,3 +1,21 @@
VERSION 1.4.1
*************
* Added support for HDF 1.8.1.
* Added float32 and int64 versions of the H5Block scalar field
read/write functions, using a new naming convention:
H5Block3dWriteScalarFieldFloat64() (was H5Block3dWriteScalarField())
H5Block3dWriteScalarFieldFloat32() (new)
H5Block3dWriteScalarFieldInt64() (new)
The old functions still exist, but may be removed in the future.
VERSION 1.4.0
*************
Error Handling Error Handling
-------------- --------------
Now all functions, in which an error could occure, are returning a Now all functions, in which an error could occure, are returning a
+56 -417
View File
@@ -1,418 +1,57 @@
============================================================================== For more information on using the H5Part API, see the H5Part website:
README file for H5Part configure
============================================================================== http://www-vis.lbl.gov/Research/AcceleratorSAPP/
+ 0. HDF5 library
----------------- Motivation
----------
Make sure you have a working version of the HDF5 library in your computer. If you plan
to use parallel I/O you need to use a parallel HDF5 version. If you don't have the Particle based simulations of accelerator beam-lines, especially in six
library download the sources from http://hdf.ncsa.uiuc.edu/HDF5/ dimensional phase space, generate vast amounts of data. Even though a subset
of statistical information regarding phase space or analysis needs to be
+ 1. Quick start (If you feel lucky...) preserved, reading and writing such enormous restart files on massively
---------------------------------------- parallel supercomputing systems remains challenging.
For many platforms, where compilers are installed in the "default" location H5Part is a very simple data storage schema and provides an API that
and all the environment variables are set correctly, it should be sufficient simplifies the reading/writing of the data to the HDF5 file format. An
to type: important foundation for a stable visualization and data analysis environment
is a stable and portable file storage format and its associated APIs. The
./configure [OPTIONS] && make [install] presence of a "common file storage format," including associated APIs, will
help foster a fundamental level of interoperability across the project's
to have the libraries and test program compiled. software infrastructure. It will also help ensure that key data analysis
capabilities are present during the earliest phases of the software development
effort.
==============================================================================
H5Part is built on top of the HDF5 (Hierarchical Data Format) library. HDF5
offers a self-describing machine-independent binary file format that supports
+ 2. configure line options scalable parallel I/O performance for MPI codes on a variety of supercomputing
---------------------------- systems, and works equally well on laptop computers. The API is available for
C, C++, and Fortran codes. The H5Part file format and APIs enable disparate
(1) Enable options research groups with different simulation implementations to transparently
--enable-fortran share datasets and data analysis tools. For instance, the common file format
--enable-parallel will enable groups that depend on completely different simulation
--enable-tools implementations to share data analysis tools.
--enable-python
--enable-64 (only for AIX and Irix)
File Organization and API
(2) Setting compilers related variables manually -------------------------
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables. The proposed file storage format uses HDF5 for the lowlevel file storage and a
simple API to provide a high-level interface to that file format. A programmer
Compiler environment variables: can either use the H5Part API to access the data files or write directly to the
CC C compiler command file format using some simple conventions for organizing and naming the objects
CXX C++ compiler command stored in the file.
FC Fortran compiler command
In order to store Particle Data in the HDF5 file format, we have formalized the
(3) Setting prefix for installation manually hierarchical arrangement of the datasets and naming conventions for the groups
--prefix=PREFIX install files in PREFIX and associated datasets. The sample H5Part API formally encodes these
conventions in order to provide a simple and uniform way to access these files
from C, C++, and Fortran codes. The API makes it easier to write very portable
For more information, type: data adaptors for visualization tools in order to expand the number of tools
available to access the data. Even so, anyone can use the HDF5 h5ls utility to
./configure --help examine the organization of the H5Part files and even write their own
HDF5-based interface for reading and writing the file format. The standards
offered by the sample API are completely independent of the standard for
============================================================================== organizing data within the file.The file format supports the storage of
multiple timesteps of datasets that contain multiple fields.
+ 3. Platform specific settings for compiling libraries & test programs
------------------------------------------------------------------------
Building
make : builds the libraries and test programs
make install: builds and installs
make clean : removes extraneous object files
make distclean : returns configuration to unconfigured state
As tested on hosts:
(1) Davinci <davinci.nersc.gov> (Linux"SUSE"-ia64)
---------------------------------------------------
FIRST THING FIRST!! Type:
module load intel
to have the proper compilers set up for use.
module load hdf5_par
[NOTE: module load hdf5 does not work at this moment.
Possible installation error of HDF5 on Davinci.]
Brief profile:
CC = icc
CXX = icc
FC = ifort
MPICC = icc
MPICXX = icc
MPIFC = ifort
If default doesn't work, try:
For C shell:
env CC=icc CXX=icc FC=ifort MPICC=icc MPICXX=icc MPIFC=ifort ./configure && make install
For Korn or Bourne shell:
CC=icc CXX=icc FC=ifort MPICC=icc MPICXX=icc MPIFC=ifort ./configure && make install
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
On this host, executing:
For C shell:
env CC=icc CXX=icc FC=ifort MPICC=icc MPICXX=icc MPIFC=ifort ./configure --enable-fortran --enable-parallel && make install
For Korn or Bourne shell:
CC=icc CXX=icc FC=ifort MPICC=icc MPICXX=icc MPIFC=ifort ./configure --enable-fortran --enable-parallel && make install
has functioned correctly.
To run test program, go to test directory:
(i) Serial test
run:
./H5testF
./H5PartTest
(ii) Parallel test
run:
mpirun 2 H5testFpar
mpirun 2 H5PartTestP
NOTE: Number 2 above is a arbitrary number that indicates the number of processes.
(2) Jacquard <jacquard.nersc.gov> (Linux"SUSE"-x86_64)
-------------------------------------------------------
Brief profile:
CC = pathcc
CXX = pathCC
FC = pathf90
MPICC = mpicc
MPICXX = mpicxx
MPIFC = mpif90
If default doesn't work, try:
For C shell:
env CC=pathcc CXX=pathCC FC=pathf90 MPICC=mpicc MPICXX=mpicxx MPIFC=mpif90 ./configure && make install
For Korn or Bourne shell:
CC=pathcc CXX=pathCC FC=pathf90 MPICC=mpicc MPICXX=mpicxx MPIFC=mpif90 ./configure && make install
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
On this host, executing:
For C shell:
env CC=pathcc CXX=pathCC FC=pathf90 MPICC=mpicc MPICXX=mpicxx MPIFC=mpif90 ./configure --enable-fortran --enable-parallel && make install
For Korn or Bourne shell:
CC=pathcc CXX=pathCC FC=pathf90 MPICC=mpicc MPICXX=mpicxx MPIFC=mpif90 ./configure --enable-fortran --enable-parallel && make install
has functioned correctly.
To run test program, go to test directory:
(i) Serial test
run:
./H5testF
./H5PartTest
(ii) Parallel test
In Jacquard, we need a script to run parallel programs, since Jacquard does not support interactive parallel processing. Instead, we need to submit the task to a queue. A sample script (run_H5testFpar.scr) may look like below:
+++++++++++++++++++++++++++++++++++++++
#!/bin/csh
#PBS -l nodes=1:ppn=2,walltime=00:05:00
#PBS -N H5testFpar
#PBS -o H5testFpar.out
#PBS -e H5testFpar.err
#PBS -q debug
#PBS -A mpccc
#PBS -V
setenv PBS_OWORKDIR /home/H5Part/test
cd $PBS_O_WORKDIR
mpirun -np 2 ./H5testFpar
+++++++++++++++++++++++++++++++++++++++
Then, we need to submit the task to a queue by running:
qsub run_H5testFpar.scr
After processed, the result will appear in H5testFpar.out, and error messages will appear in H5testFpar.err.
(3) Bassi <bassi.nersc.ogv> (AIX5.3.0.0-Power 3)
-------------------------------------------------
FIRST THING FIRST!! Type:
module load gcc
to have the proper compilers set up for use.
Brief profile:
CC = cc_r
CXX = cc_r
FC = xlf_r
MPICC = mpcc_r
MPICXX = mpcc_r
MPIFC = mpxlf_r
If default doesn't work, try:
For C shell:
env CC=cc_r CXX=cc_r FC=xlf_r MPICC=mpcc_r MPICXX=mpcc_r MPIFC=mpxlf_r ./configure && make install
For Korn or Bourne shell:
CC=cc_r CXX=cc_r FC=xlf_r MPICC=mpcc_r MPICXX=mpcc_r MPIFC=mpxlf_r ./configure && make install
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
On this host, executing:
For C shell:
env CC=cc_r CXX=cc_r FC=xlf_r MPICC=mpcc_r MPICXX=mpcc_r MPIFC=mpxlf_r ./configure --enable-fortran --enable-parallel && make install
For Korn or Bourne shell:
CC=cc_r CXX=cc_r FC=xlf_r MPICC=mpcc_r MPICXX=mpcc_r MPIFC=mpxlf_r ./configure --enable-fortran --enable-parallel && make install
has functioned correctly.
To run test program, go to test directory:
(i) Serial test
run:
./H5testF
./H5PartTest
(ii) Parallel test
run:
unsetenv MP_SINGLE_THREAD
poe ./H5PartTestP -procs 2 -nodes 1
poe ./H5testFpar -procs 2 -nodes 1
For more details on how to run parallel programs on Bassi, go to:
http://www.nersc.gov/nusers/resources/bassi/running_jobs/
(4) Starsky <starsky.lbl.gov> (Darwin8.5.0-PowerPC)
----------------------------------------------------
FIRST THING FIRST!! Set environment variables: (in tcsh)
setenv LD_LIBRARY_PATH /usr/local/g95/lib/gcc-lib/powerpc-apple-darwin8.5.0/4.0.3/
setenv PATH ${PATH}:/usr/local/g95/bin
NOTE: This environment variable setting is specifit to Starsky. It is to make configure find the fortran compiler.
Brief profile:
CC = gcc
CXX = g++
FC = g95
If default doesn't work, try:
For C shell:
env CC=gcc CXX=g++ FC=g95 ./configure && make install
For Korn or Bourne shell:
CC=gcc CXX=g++ FC=g95 ./configure && make install
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
On this host, executing:
For C shell:
env CC=gcc CXX=g++ FC=g95 ./configure --enable-fortran && make install
For Korn or Bourne shell:
CC=gcc CXX=g++ FC=g95 ./configure --enable-fortran && make install
has functioned correctly.
To run test program, go to test directory:
(i) Serial test
run:
./H5testF
./H5PartTest
(5) Linux AMD64 Visualization group workstations (Linux"SUSE"-x86_64)
---------------------------------------------------------
Brief profile:
CC = gcc
CXX = g++
FC = g95
If default doesn't work, try:
For C shell:
env CC=gcc CXX=g++ FC=g95 ./configure && make install
For Korn or Bourne shell:
CC=gcc CXX=g++ FC=g95 ./configure && make install
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
On this host, executing:
For C shell:
env CC=gcc CXX=g++ FC=g95 ./configure --enable-fortran && make install
For Korn or Bourne shell:
CC=gcc CXX=g++ FC=g95 ./configure --enable-fortran && make install
has functioned correctly.
To run test program, go to test directory:
(i) Serial test
run:
./H5testF
./H5PartTest
(6) Cray XT3 @ CSCS gele
1) modules/3.1.6 9) PrgEnv-pgi/1.4.26 17) xt-lustre-ss/1.4.26
2) MySQL/4.0.26 10) xt-pbs/5.3.4 18) Base-opts/1.4.26
3) acml/3.0 11) xt-service/1.4.26 19) subversion/1.3.2
4) pgi/6.1.4 12) xt-libc/1.4.26 20) zlib/1.2.3
5) totalview/7.2.0 13) xt-os/1.4.26 21) szip/2.0
6) xt-libsci/1.4.26 14) xt-catamount/1.4.26 22) hdf5/1.6.5
7) xt-mpt/1.4.26 15) xt-boot/1.4.26
8) xt-pe/1.4.26 16) xt-crms/1.4.26
CFLAGS="-I$H5HOME/include -DF77_SINGLE_UNDERSCORE" LDFLAGS="-L$H5HOME/lib -L$ZHOME/lib" ./configure --enable-parallel --enable-fortran
(7) merlin00 / merlin3
Currently Loaded Modulefiles:
1) hdf5/hdf5-1.6.5 2) root/root-5.10.00 3) mpi/mpich2-1.0.3-pgi-6.1 4) pgi/pgi_64-6.1
FC=mpif90 ./configure --enable-parallel --enable-fortran
==============================================================================
+ 4. Trouble shooting (Things to check for...)
--------------------------------------------
(0) Have you set the LD_LIBRARY_PATH?
---Some systems require the user to manually set the environment variable, LD_LIBRARY_PATH. To do so:
set the environment variable HDF5ROOT or PHDF5ROOT to point to your installation of HDF5 (serial and/or parallel respectively).
For Korn or Bourne shell:
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${HDF5ROOT}/lib;export LD_LIBRARY_PATH
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:{PHDF5ROOT}/lib;export LD_LIBRARY_PATH
For C shell:
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${HDF5ROOT}/lib
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${PHDF5ROOT}/lib
Note that the values of HDF5ROOT & PHDF5ROOT will be in the "summary" section when you run configure.
Not properly set LD_LIBRARY_PATH value may result in a runtime error:
./H5PartTest: error while loading shared libraries: libhdf5.so.0: cannot open shared object file: No such file or directory
(1) Are the compilers set correctly?
---Check with: which COMPILER
(2) Have you installed HDF5?
---You can get it at: http://vis.lbl.gov/Research/AcceleratorSAPP/index.html
(3) Have you loaded the proper modules?
---It is necessary in Davinci & Bassi, and configure && make install may not work without it.
-44
View File
@@ -1,44 +0,0 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* "" */
#undef MY_BUILD_CPU
/* "" */
#undef MY_BUILD_OS
/* "" */
#undef MY_BUILD_VENDOR
/* "" */
#undef MY_GNUNAME
/* "" */
#undef MY_UNAME
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Version number of package */
#undef VERSION
/* Define to 1 if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
+281 -281
View File
@@ -1,6 +1,6 @@
# Every configure script must call AC_INIT before doing anything else. # Every configure script must call AC_INIT before doing anything else.
# AC_INIT (package, version, [bug-report], [tarname]) # AC_INIT (package, version, [bug-report], [tarname])
AC_INIT([H5Part], [1.3.3], [h5part@lists.psi.ch], H5Part) AC_INIT([H5Part], [1.4.1], [h5part@lists.psi.ch], H5Part)
# Ensure that a recent enough version of Autoconf is being used. # Ensure that a recent enough version of Autoconf is being used.
@@ -26,27 +26,27 @@ AC_ARG_ENABLE(
AC_ARG_ENABLE( AC_ARG_ENABLE(
[fortran], [fortran],
[AC_HELP_STRING([--enable-fortran], [AC_HELP_STRING([--enable-fortran],
[Compile the Fortran interface [default=no]])], [Compile the Fortran interface [default=no]])],
[USE_FORTRAN=$enableval]) [USE_FORTRAN=$enableval])
AC_ARG_ENABLE( AC_ARG_ENABLE(
[parallel], [parallel],
[AC_HELP_STRING([--enable-parallel], [AC_HELP_STRING([--enable-parallel],
[Compile the MPI/IO interface [default=no]])], [Compile the MPI/IO interface [default=no]])],
[USE_PARALLEL=$enableval]) [USE_PARALLEL=$enableval])
AC_ARG_ENABLE( AC_ARG_ENABLE(
[tools], [tools],
[AC_HELP_STRING([--enable-tools], [AC_HELP_STRING([--enable-tools],
[Compile h5part tools [default=no]])], [Compile h5part tools [default=no]])],
[USE_TOOLS=$enableval]) [USE_TOOLS=$enableval])
AC_ARG_WITH( AC_ARG_WITH(
[mpipath], [mpipath],
[AC_HELP_STRING([--with-mpipath], [AC_HELP_STRING([--with-mpipath],
[path to MPI installation [default=""]])], [path to MPI installation [default=""]])],
[MPIPATH=$withval], [MPIPATH=""]) [MPIPATH=$withval], [MPIPATH=""])
AC_ARG_WITH( AC_ARG_WITH(
[hdf5path], [hdf5path],
@@ -54,6 +54,13 @@ AC_ARG_WITH(
[path to HDF5 installation [default=""]])], [path to HDF5 installation [default=""]])],
[HDF5PATH=$withval], [HDF5PATH=""]) [HDF5PATH=$withval], [HDF5PATH=""])
AC_ARG_WITH(
[mpiposix],
[AC_HELP_STRING([--with-mpiposix],
[enable MPI-POSIX VFD in HDF5 [default=no]])],
[USE_MPIPOSIX=$enableval])
############################################################################### ###############################################################################
################# A SIMPLE WORK AROUND TO USE ENV. VARS ####################### ################# A SIMPLE WORK AROUND TO USE ENV. VARS #######################
############################################################################### ###############################################################################
@@ -85,35 +92,26 @@ SAVE_LDFLAGS=$LDFLAGS
# @enddesc # @enddesc
#@@*/ #@@*/
PATH_Search() PATH_Search() {
{ eval $1=""
eval $1="" if test $# -lt 4 ; then
if test $# -lt 4 ; then h5part_basedir=""
h5part_basedir="" else
else h5part_basedir="$4/"
h5part_basedir="$4/" fi
fi for h5part_place in $2; do
for h5part_place in $2 AC_MSG_CHECKING([looking in $h5part_place ... ])
do if test -r "$h5part_basedir$h5part_place/$3" ; then
echo -n "looking in $h5part_place ... $ac_c" #1>&6 AC_MSG_RESULT([found])
if test -r "$h5part_basedir$h5part_place/$3" ; then eval $1="$h5part_place"
echo "$ac_t"" found" #1>&6 break
eval $1="$h5part_place" fi
break AC_MSG_RESULT([no])
fi done
if test -d "$h5part_basedir$h5part_place/$3" ; then return
echo "$ac_t"" found" #1>&6
eval $1="$h5part_place"
break
fi
echo "$ac_t"" no" #1>&6
done
return
} }
############################################################################### ###############################################################################
############# MISC SETTINGS INCLUDING C & C++ COMPILER SETTING ################ ############# MISC SETTINGS INCLUDING C & C++ COMPILER SETTING ################
############################################################################### ###############################################################################
@@ -124,32 +122,12 @@ AC_CANONICAL_HOST
uname=`uname -s` uname=`uname -s`
if test $uname = "AIX"; then if test $uname = "AIX"; then
AC_MSG_CHECKING([if system is AIX]) AC_MSG_CHECKING([if system is AIX])
AC_MSG_RESULT([OK]) AC_MSG_RESULT([OK])
# If on AIX, define _ALL_SOURCE. Allows the use of some BSD functions. # If on AIX, define _ALL_SOURCE. Allows the use of some BSD functions.
# Should be called before any macros that run the C compiler. # Should be called before any macros that run the C compiler.
AC_AIX AC_AIX
fi
# DAVINCI SPECIFIC!!!
if test `uname -n` = "davinci"; then
echo "DAVINCI SPECIFIC TESTING FOR STDC++ LIBRARY!"
PATH_Search STDCXX_CHECK '/usr/lib64 /usr/lib' libstdc++.a
# if STDCXX_CHECK is set...
if test "$STDCXX_CHECK" = "/usr/lib64"; then
echo "STDCXX setting ..."
echo "STDCXX_CHECK = $STDCXX_CHECK ..."
STDCXX="-L/usr/lib64 -lstdc++"
echo "STDCXX = $STDCXX ..."
elif test "$STDCXX_CHECK" = "/usr/lib"; then
echo "STDCXX setting ..."
echo "STDCXX_CHECK = $STDCXX_CHECK ..."
STDCXX="-L/usr/lib -lstdc++"
echo "STDCXX = $STDCXX ..."
fi
fi fi
@@ -165,9 +143,9 @@ AC_PATH_PROGS([BAS_CC], [cc_r], [], [$PATH])
# if BAS_CC not empty # if BAS_CC not empty
if test -n "$BAS_CC"; then if test -n "$BAS_CC"; then
echo "CC setting for Bassi ..." AC_MSG_CHECKING([CC setting for Bassi])
CC=$BAS_CC CC=$BAS_CC
echo "CC = $CC ..." AC_MSG_RESULT([CC = $CC])
fi fi
@@ -181,6 +159,16 @@ fi
AC_PROG_CXX(pathCC icc cc_r g++ gcc cc) AC_PROG_CXX(pathCC icc cc_r g++ gcc cc)
# DAVINCI SPECIFIC!!!
AC_MSG_CHECKING([for icc linker -lstdc++ flag])
if test ${CXX} = "icc"; then
AC_MSG_RESULT([yes])
STDCXX="-lstdc++"
else
AC_MSG_RESULT([no])
fi
# Set output variable INSTALL to the path of a BSD-compatible install program, # Set output variable INSTALL to the path of a BSD-compatible install program,
# if one is found in the current PATH. # if one is found in the current PATH.
# Otherwise, set INSTALL to `dir/install-sh -c` # Otherwise, set INSTALL to `dir/install-sh -c`
@@ -218,186 +206,199 @@ AC_MSG_CHECKING([if 64-bit compilation is enabled])
# If --enable-64 is set in the configure line # If --enable-64 is set in the configure line
if test "X$USE_64" = "Xyes"; then if test "X$USE_64" = "Xyes"; then
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
if test $uname = "AIX"; then if test $uname = "AIX"; then
CFLAGS="$CFLAGS -q64" CFLAGS="$CFLAGS -q64"
FFLAGS="$FFLAGS -q64" FFLAGS="$FFLAGS -q64"
fi fi
if test $uname = "IRIX64"; then if test $uname = "IRIX64"; then
CFLAGS="$CFLAGS -64" CFLAGS="$CFLAGS -64"
FFLAGS="$FFLAGS -64 -fPIC -fno-second-underscore" FFLAGS="$FFLAGS -64 -fPIC -fno-second-underscore"
fi fi
else else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
fi fi
############################ fortran enabled ################################## ############################ fortran enabled ##################################
AC_MSG_CHECKING([if fortran interface enabled]) AC_MSG_CHECKING([if fortran interface enabled])
if test "X$USE_FORTRAN" = "Xyes"; then if test "X$USE_FORTRAN" = "Xyes"; then
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
AC_PROG_FC(ifort xlf_r pathf90 g95 g90 ftn gfortran) AC_PROG_FC(ifort xlf_r pathf90 g95 g90 ftn gfortran)
if test -z "$FC" ; then if test -z "$FC" ; then
AC_MSG_ERROR([Cannot find a fortran compiler!!!]) AC_MSG_ERROR([Cannot find a fortran compiler!!!])
exit 1 exit 1
fi fi
if test ! $uname = "AIX"; then if test ! $uname = "AIX"; then
FFLAGS="${FFLAGS} -fPIC -fno-second-underscore" FFLAGS="${FFLAGS} -fPIC"
fi fi
AC_MSG_CHECKING([symbol convention in object files]) if test $FC = "g90"; then
`cd src && rm -f TestUnderscore.o TestUnderscoreC.o TestUnderscore` FFLAGS="${FFLAGS} -fno-second-underscore"
`cd src && ${FC} ${FFLAGS} -c TestUnderscore.f` fi
`cd src && ${CC} ${CFLAGS} -c TestUnderscoreC.c`
`cd src && ${FC} ${FFLAGS} -o TestUnderscore TestUnderscore.o TestUnderscoreC.o -lc`
if test -f src/TestUnderscore ; then if test $FC = "g95"; then
UNDERSCORE_H=Underscore.h FFLAGS="${FFLAGS} -fno-second-underscore"
`cd src && ./TestUnderscore > Underscore.h` fi
AC_MSG_RESULT([ok])
else AC_MSG_CHECKING([symbol convention in object files])
AC_MSG_RESULT([nok]) `cd src && rm -f TestUnderscore.o TestUnderscoreC.o TestUnderscore`
AC_MSG_ERROR([Cannot build fortran executables!!!]) `cd src && ${FC} ${FFLAGS} -c TestUnderscore.f`
exit 1 `cd src && ${CC} ${CFLAGS} -c TestUnderscoreC.c`
fi # `cd src && ${FC} ${FFLAGS} -o TestUnderscore TestUnderscore.o TestUnderscoreC.o -lc`
`cd src && ${FC} ${FFLAGS} -o TestUnderscore TestUnderscore.o TestUnderscoreC.o`
if test -f src/TestUnderscore ; then
UNDERSCORE_H=Underscore.h
`cd src && ./TestUnderscore > Underscore.h`
AC_MSG_RESULT([ok])
else
AC_MSG_RESULT([nok])
AC_MSG_ERROR([Cannot build fortran executables!!!])
exit 1
fi
else else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
fi fi
######################## parallel interface enabled ########################### ######################## parallel interface enabled ###########################
AC_MSG_CHECKING([if parallel interface enabled]) AC_MSG_CHECKING([if parallel interface enabled])
if test "X$USE_PARALLEL" = "Xyes"; then if test "X$USE_PARALLEL" = "Xyes"; then
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
CFLAGS="${CFLAGS} -DPARALLEL_IO -DH5_HAVE_PARALLEL -DMPICH_IGNORE_CXX_SEEK" CFLAGS="${CFLAGS} -DPARALLEL_IO -DH5_HAVE_PARALLEL -DMPICH_IGNORE_CXX_SEEK"
AC_MSG_CHECKING([if we can compile MPI code without setting flags]) AC_MSG_CHECKING([if we can compile MPI code without setting flags])
AC_TRY_LINK([#include "mpi.h"], [ AC_TRY_LINK([#include "mpi.h"], [
MPI_Comm comm; MPI_Comm comm;
int n; int n;
MPI_Comm_size( comm, &n ); ], MPI_Comm_size( comm, &n ); ],
[echo 'yes'; r='yes'], [echo "no"; r='no'] ) [AC_MSG_RESULT([yes]); r='yes'], [AC_MSG_RESULT([no]); r='no'] )
if test "X$r" = "Xno"; then if test "X$USE_MPIPOSIX" = "Xyes"; then
AC_PATH_PROGS([MPICC], [mpicc mpcc_r], [], [$PATH]) CFLAGS="${CFLAGS} -DH5PART_MPIPOSIX"
AC_PATH_PROGS([MPICXX], [mpicxx mpcc_r], [], [$PATH])
if test -z "$MPICC" -o -z "$MPICXX"; then
AC_MSG_CHECKING([for MPI root ])
AC_MSG_RESULT([])
if test -n "$MPIROOT"; then
P=${MPIROOT}
elif test -n "$MPIHOME"; then
P=${MPIHOME}
elif test -n "$MPIPATH"; then
P=${MPIPATH}
else
P=''
P="$P /usr"
P="$P /usr/local"
P="$P /usr/local/mpi"
P="$P /usr/local/packages/mpi"
P="$P /usr/local/mpich2"
P="$P /usr/local/mpich"
P="$P /opt/xt-mpt/default/mpich2-64/P2"
fi
PATH_Search MPIROOT "$P" include/mpi.h
if test ! -n "$MPIROOT"; then
AC_MSG_ERROR([Cannot determine MPI root!!!])
exit 1
fi
if test -e "${MPIROOT}/bin/mpicc"; then
MPICC=${MPIROOT}/bin/mpicc
fi
if test -e "${MPIROOT}/bin/mpicxx"; then
MPICXX=${MPIROOT}/bin/mpicxx
fi
fi fi
if test -z "$MPICC" -o -z "$MPICXX"; then if test "X$r" = "Xno"; then
MPIINC="${MPIINC} -I${MPIROOT}/include" AC_PATH_PROGS([MPICC], [mpicc mpcc_r], [], [$PATH])
FFLAGS="${FFLAGS} -I${MPIROOT}/include" AC_PATH_PROGS([MPICXX], [mpicxx mpcc_r], [], [$PATH])
AC_MSG_CHECKING([for name of MPI lib ]) if test -z "$MPICC" -o -z "$MPICXX"; then
if test -e ${MPIROOT}/lib/libmpi.a; then AC_MSG_CHECKING([for MPI root ])
MPILIB="-L${MPIROOT}/lib -lmpi" AC_MSG_RESULT([])
elif test -e ${MPIROOT}/lib/libmpi.so; then if test -n "$MPIROOT"; then
MPILIB="-L${MPIROOT}/lib -lmpi" P=${MPIROOT}
elif test -e ${MPIROOT}/lib/libmpich.a; then elif test -n "$MPIHOME"; then
MPILIB="-L${MPIROOT}/lib -lmpich" P=${MPIHOME}
elif test -e ${MPIROOT}/lib/libmpich.so; then elif test -n "$MPIPATH"; then
MPILIB="-L${MPIROOT}/lib -lmpich" P=${MPIPATH}
else else
AC_MSG_RESULT([not found]) P=''
exit 1 P="$P /usr"
fi P="$P /usr/local"
AC_MSG_RESULT([${MPILIB}]) P="$P /usr/local/mpi"
P="$P /usr/local/packages/mpi"
P="$P /usr/local/mpich2"
P="$P /usr/local/mpich"
P="$P /opt/xt-mpt/default/mpich2-64/P2"
fi
PATH_Search MPIROOT "$P" include/mpi.h
if test ! -n "$MPIROOT"; then
AC_MSG_ERROR([Cannot determine MPI root!!!])
exit 1
fi
if test -e "${MPIROOT}/bin/mpicc"; then
MPICC=${MPIROOT}/bin/mpicc
fi
if test -e "${MPIROOT}/bin/mpicxx"; then
MPICXX=${MPIROOT}/bin/mpicxx
fi
fi
if test -z "$MPICC" -o -z "$MPICXX"; then
MPIINC="${MPIINC} -I${MPIROOT}/include"
FFLAGS="${FFLAGS} -I${MPIROOT}/include"
AC_MSG_CHECKING([for name of MPI lib ])
if test -e ${MPIROOT}/lib/libmpi.a; then
MPILIB="-L${MPIROOT}/lib -lmpi"
elif test -e ${MPIROOT}/lib/libmpi.so; then
MPILIB="-L${MPIROOT}/lib -lmpi"
elif test -e ${MPIROOT}/lib/libmpich.a; then
MPILIB="-L${MPIROOT}/lib -lmpich"
elif test -e ${MPIROOT}/lib/libmpich.so; then
MPILIB="-L${MPIROOT}/lib -lmpich"
else
AC_MSG_RESULT([not found])
exit 1
fi
AC_MSG_RESULT([${MPILIB}])
fi
if test -n "$MPICC"; then
CC=${MPICC}
fi
if test -n "$MPICXX"; then
CXX=${MPICXX}
fi
fi fi
if test -n "$MPICC"; then MTARGET="libpH5Part.a"
CC=${MPICC} TTARGET="H5PartTestP H5PartAndreasTest Bench"
fi TTARGET="${TTARGET} H5BlockTestAttributes"
TTARGET="${TTARGET} H5BlockParTestScalarField"
if test -n "$MPICXX"; then # parallel + fortran
CXX=${MPICXX} if test "X$USE_FORTRAN" = "Xyes"; then
fi AC_PATH_PROGS([MPIFC], [mpxlf_r mpif90], [], [$PATH])
fi
MTARGET="libpH5Part.a" if test -z "${MPIFC}" ; then
TTARGET="H5PartTestP H5PartAndreasTest Bench" if test -e "${MPIROOT}/bin/mpif90"; then
TTARGET="${TTARGET} H5BlockTestAttributes" MPIFC=${MPIROOT}/bin/mpif90
TTARGET="${TTARGET} H5BlockParTestScalarField" fi
fi
# parallel + fortran # if MPIFC empty
if test "X$USE_FORTRAN" = "Xyes"; then if test ! -n "$MPIFC"; then
AC_PATH_PROGS([MPIFC], [mpxlf_r mpif90], [], [$PATH]) AC_MSG_CHECKING([ No MPIFC detected. Setting MPIFC to FC.])
MPIFC=$FC
AC_MSG_RESULT([MPIFC = $MPIFC])
fi
if test -z "${MPIFC}" ; then if test -n "$MPIFC"; then
if test -e "${MPIROOT}/bin/mpif90"; then FC=${MPIFC}
MPIFC=${MPIROOT}/bin/mpif90 fi
fi
MTARGET="${MTARGET} libpH5PartF.a"
TTARGET="${TTARGET} H5testFpar"
TTARGET="${TTARGET} H5BlockParTestScalarFieldF"
fi fi
# if MPIFC empty
if test ! -n "$MPIFC"; then
AC_MSG_CHECKING([ No MPIFC detected. Setting MPIFC to FC.])
MPIFC=$FC
echo "MPIFC = $MPIFC ..."
fi
if test -n "$MPIFC"; then
FC=${MPIFC}
fi
MTARGET="${MTARGET} libpH5PartF.a"
TTARGET="${TTARGET} H5testFpar"
TTARGET="${TTARGET} H5BlockParTestScalarFieldF"
fi
else # --enable-parallel=no else # --enable-parallel=no
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
MTARGET="libH5Part.a" MTARGET="libH5Part.a"
TTARGET="H5PartTest H5test" TTARGET="H5PartTest H5test"
TTARGET="${TTARGET} H5BlockTestAttributes" TTARGET="${TTARGET} H5BlockTestAttributes"
if test "X$USE_FORTRAN" = "Xyes"; then if test "X$USE_FORTRAN" = "Xyes"; then
MTARGET="${MTARGET} libH5PartF.a" MTARGET="${MTARGET} libH5PartF.a"
TTARGET="${TTARGET} H5testF" TTARGET="${TTARGET} H5testF"
TTARGET="${TTARGET} H5BlockTestAttributesF" TTARGET="${TTARGET} H5BlockTestAttributesF"
fi fi
fi fi
AC_MSG_CHECKING([wheter tools are enabled]) AC_MSG_CHECKING([wheter tools are enabled])
if test "X$USE_TOOLS" = "Xyes"; then if test "X$USE_TOOLS" = "Xyes"; then
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
BUILD_TOOLS="h5pAttrib h5pToGNUplot # homdynToH5p" BUILD_TOOLS="h5pAttrib h5pToGNUplot h5ToVtk# homdynToH5p"
else else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
fi fi
############################################################################### ###############################################################################
@@ -407,58 +408,58 @@ fi
AC_MSG_CHECKING([for HDF5 root ]) AC_MSG_CHECKING([for HDF5 root ])
AC_MSG_RESULT([]) AC_MSG_RESULT([])
if test -n "${HDF5ROOT}"; then if test -n "${HDF5ROOT}"; then
P=${HDF5ROOT} P=${HDF5ROOT}
elif test -n "${HDF5HOME}" ; then elif test -n "${HDF5HOME}" ; then
P=${HDF5HOME} P=${HDF5HOME}
elif test -n "${HDF5PATH}" ; then elif test -n "${HDF5PATH}" ; then
P=${HDF5PATH} P=${HDF5PATH}
else else
P='' P=''
P="$P /usr" P="$P /usr"
P="$P /usr/local" P="$P /usr/local"
P="$P /usr/local/hdf5" P="$P /usr/local/hdf5"
P="$P /usr/local/packages/hdf5" P="$P /usr/local/packages/hdf5"
P="$P /apps/hdf5" P="$P /apps/hdf5"
if test "X$USE_PARALLEL" = "Xyes"; then if test "X$USE_PARALLEL" = "Xyes"; then
P="$P /usr/local/phdf5" P="$P /usr/local/phdf5"
P="$P /usr/local/hdf5/hdf5_par" P="$P /usr/local/hdf5/hdf5_par"
if test "X$USE_64" = "Xyes"; then if test "X$USE_64" = "Xyes"; then
P="$P /usr/common/usg/hdf5/64/default/parallel" P="$P /usr/common/usg/hdf5/64/default/parallel"
else else
P="$P /usr/common/usg/hdf5/32/default/parallel" P="$P /usr/common/usg/hdf5/32/default/parallel"
fi fi
else else
P="$P /usr/local/hdf5/hdf5_serial" P="$P /usr/local/hdf5/hdf5_serial"
if test "X$USE_64" = "Xyes"; then if test "X$USE_64" = "Xyes"; then
P="$P /usr/common/usg/hdf5/64/default/serial" P="$P /usr/common/usg/hdf5/64/default/serial"
else else
P="$P /usr/common/usg/hdf5/32/default/serial" P="$P /usr/common/usg/hdf5/32/default/serial"
fi fi
fi fi
fi fi
PATH_Search HDF5ROOT "$P" include/hdf5.h PATH_Search HDF5ROOT "$P" include/hdf5.h
if test -z "$HDF5ROOT"; then if test -z "$HDF5ROOT"; then
AC_MSG_ERROR([Cannot determine HDF5 root!!!]) AC_MSG_ERROR([Cannot determine HDF5 root!!!])
exit 1 exit 1
fi fi
AC_MSG_CHECKING([if we need to link to libsz ]) AC_MSG_CHECKING([if we need to link to libsz ])
if test -n "$HDF5ROOT"; then if test -n "$HDF5ROOT"; then
if test -f $HDF5ROOT/lib/libsz.a; then if test -f $HDF5ROOT/lib/libsz.a; then
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
SZLIB="-L$HDF5ROOT/lib/ -lsz" SZLIB="-L$HDF5ROOT/lib/ -lsz"
else else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
SZLIB="" SZLIB=""
fi fi
fi fi
AC_MSG_CHECKING([for static zlib root ]) AC_MSG_CHECKING([for static zlib root ])
echo AC_MSG_RESULT([ ])
PATH_Search ZLIBROOT '/apps/zlib' lib/libz.a PATH_Search ZLIBROOT '/apps/zlib' lib/libz.a
if test -n "$ZLIBROOT"; then if test -n "$ZLIBROOT"; then
LDFLAGS="$LDFLAGS -L$ZLIBROOT/lib" LDFLAGS="$LDFLAGS -L$ZLIBROOT/lib"
fi fi
@@ -474,65 +475,65 @@ H5P_LIB_LOC=`pwd`/src
#if there was an external input for the variable... #if there was an external input for the variable...
if test -n "$SAVE_CC"; then if test -n "$SAVE_CC"; then
CC=$SAVE_CC CC=$SAVE_CC
fi fi
if test -n "$SAVE_CXX"; then if test -n "$SAVE_CXX"; then
CXX=$SAVE_CXX CXX=$SAVE_CXX
fi fi
if test -n "$SAVE_FC"; then if test -n "$SAVE_FC"; then
FC=$SAVE_FC FC=$SAVE_FC
fi fi
if test -n "$SAVE_MPICC"; then if test -n "$SAVE_MPICC"; then
MPICC=$SAVE_MPICC MPICC=$SAVE_MPICC
fi fi
if test -n "$SAVE_MPICXX"; then if test -n "$SAVE_MPICXX"; then
MPICXX=$SAVE_MPICXX MPICXX=$SAVE_MPICXX
fi fi
if test -n "$SAVE_MPIFC"; then if test -n "$SAVE_MPIFC"; then
MPIFC=$SAVE_MPIFC MPIFC=$SAVE_MPIFC
fi fi
if test -n "$SAVE_MPILIB"; then if test -n "$SAVE_MPILIB"; then
MPILIB=$SAVE_MPILIB MPILIB=$SAVE_MPILIB
fi fi
if test -n "$SAVE_MPIINC"; then if test -n "$SAVE_MPIINC"; then
MPIINC=$SAVE_MPIINC MPIINC=$SAVE_MPIINC
fi fi
if test -n "$SAVE_CFLAGS"; then if test -n "$SAVE_CFLAGS"; then
CFLAGS="$SAVE_CFLAGS ${CFLAGS}" CFLAGS="$SAVE_CFLAGS ${CFLAGS}"
fi fi
if test -n "$SAVE_FFLAGS"; then if test -n "$SAVE_FFLAGS"; then
FFLAGS=$SAVE_FFLAGS FFLAGS=$SAVE_FFLAGS
fi fi
if test -n "$SAVE_MPIROOT"; then if test -n "$SAVE_MPIROOT"; then
MPIROOT=$SAVE_MPIROOT MPIROOT=$SAVE_MPIROOT
fi fi
if test -n "$SAVE_HDF5ROOT"; then if test -n "$SAVE_HDF5ROOT"; then
HDF5ROOT=$SAVE_HDF5ROOT HDF5ROOT=$SAVE_HDF5ROOT
fi fi
if test -n "$SAVE_LDFLAGS"; then if test -n "$SAVE_LDFLAGS"; then
LDFLAGS=$SAVE_LDFLAGS LDFLAGS=$SAVE_LDFLAGS
fi fi
if test -n "$MPICXX"; then if test -n "$MPICXX"; then
TOOLS_CXX=$MPICXX TOOLS_CXX=$MPICXX
TOOLS_H5PART_LIB="-lpH5Part" TOOLS_H5PART_LIB="-lpH5Part"
TOOLS_HDFLIB="-L$HDF5ROOT/lib -lhdf5" TOOLS_HDFLIB="-L$HDF5ROOT/lib -lhdf5"
else else
TOOLS_CXX=$CXX TOOLS_CXX=$CXX
TOOLS_H5PART_LIB="-lH5Part" TOOLS_H5PART_LIB="-lH5Part"
TOOLS_HDFLIB="-L$HDF5ROOT/lib -lhdf5" TOOLS_HDFLIB="-L$HDF5ROOT/lib -lhdf5"
fi fi
############################################################################### ###############################################################################
@@ -581,27 +582,26 @@ AC_OUTPUT
############################################################################### ###############################################################################
########################## PRINTING SUMMARY ################################### ########################## PRINTING SUMMARY ###################################
############################################################################### ###############################################################################
echo AC_MSG_RESULT([ ])
echo AC_MSG_RESULT([Summary:])
echo "Summary for `(hostname || uname -n) 2>/dev/null | sed 1q`:" AC_MSG_RESULT([ ])
echo AC_MSG_RESULT([Host OS: $host_os])
echo "Host OS: $host_os" AC_MSG_RESULT([Host CPU: $host_cpu])
echo "Host CPU: $host_cpu" AC_MSG_RESULT([Host vendor: $host_vendor])
echo "Host vendor: $host_vendor" AC_MSG_RESULT([Build libraries: $MTARGET])
echo "Build libraries: $MTARGET" AC_MSG_RESULT([Build test programs: $TTARGET])
echo "Build test programs: $TTARGET" AC_MSG_RESULT([Build tools: $BUILD_TOOLS])
echo "Build tools: $BUILD_TOOLS" AC_MSG_RESULT([CC = $CC])
echo "CC = $CC" AC_MSG_RESULT([CXX = $CXX])
echo "CXX = $CXX" AC_MSG_RESULT([FC = $FC])
echo "FC = $FC" AC_MSG_RESULT([MPICC = $MPICC])
echo "MPICC = $MPICC" AC_MSG_RESULT([MPICXX = $MPICXX])
echo "MPICXX = $MPICXX" AC_MSG_RESULT([MPIFC = $MPIFC])
echo "MPIFC = $MPIFC" AC_MSG_RESULT([CFLAGS = $CFLAGS])
echo "CFLAGS = $CFLAGS" AC_MSG_RESULT([FFLAGS = $FFLAGS])
echo "FFLAGS = $FFLAGS" AC_MSG_RESULT([MPILIB = $MPILIB])
echo "MPILIB = $MPILIB" AC_MSG_RESULT([MPIINC = $MPIINC])
echo "MPIINC = $MPIINC" AC_MSG_RESULT([MPIROOT = $MPIROOT])
echo "MPIROOT = $MPIROOT" AC_MSG_RESULT([HDF5ROOT = $HDF5ROOT])
echo "HDF5ROOT = $HDF5ROOT" AC_MSG_RESULT([LDFLAGS = $LDFLAGS])
echo "LDFLAGS = $LDFLAGS" AC_MSG_RESULT([ ])
echo
-262
View File
@@ -1,262 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Put your title here!!</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="keywords" content="scientific visualization">
<meta name="sitemap" content="put a brief descriptive phrase here that will show up in the site map:foo">
<div id="maincenter">
<head>
<title>Building H5Part</title>
</head>
<body bgcolor="#F0F0F0">
<font face="arial,helvetica" size="+2" color="#555588"><h2>Building H5Part</h2></font>
<UL>
<LI><a href="#Quickstart">Quickstart guide for the impatient.</a>
<LI><a href="#Details">Details of the Configuration Script</a>
<!-- <LI><a href="UsingC++.html">Using the C++ interface</a> -->
<LI><a href="#ConfigOptions">Important Configure Options</a>
<LI><a href="#EnvVariables">Important Environment Variables</a>
</UL>
<hr>
<a name="Quickstart">
<h2>Quickstart <i>for the impatient</i></h2>
</a>
<OL>
<LI><b>Configure</b>:<br>
For the serial implementation
<pre>
./configure
</pre>
For the parallel implementation configure with
<pre>
./configure --enable-parallel
</pre>
If you also want to build fortran bindings, add the
<code>--enable-fortran</code> flag to the configure line.
</LI><p>
<LI><b>Make the Library</b>:<br>
Type <code>make</code> to build the library. The libraries are
named accordingly.
<UL>
<LI>libH5Part.a: Serial C/C++ Library.</LI>
<LI>libpH5Part.a: Parallel C/C++ library.</LI>
<LI>libH5PartF.a: Serial F77/F90 library.</LI>
<LI>libpH5PartF.a: Parallel F77/F90 library.</LI>
</UL>
</LI><p>
<LI><b>Make Regression Tests and Examples</b>:<br>
Just type <code>make tests</code> to build regression tests
and/or example programs for H5Part. These tests are
<UL>
<LI>H5PartF: Fortran example (only build if --enable-fortran
is specified).</LI>
<LI>H5PartFpar: Parallel Fortran example (only built if both
--enable-fortran and --enable-parallel are specified).</LI>
<LI>H5PartTest: Serial C example. This test writes a sample
datafile and then reopens it for reading. It demonstrates
the most basic reading/writing capabilities.</LI>
<LI>H5PartTestP: Parallel C example (only built if
--enable-parallel is specified). This program only works
as an MPI/parallel program.</LI>
<LI>Bench: This program will only be built if
--enable-parallel is specified. It compares the
performance of raw binary
I/O (one file per processor), raw binary MPI-IO based
parallel I/O to a single file, and the parallel H5Part/HDF5 to
a single file. Generally, H5Part should be very close to the
MPI-IO implementation in terms of performance, but slower
than one-file-per-processor. If HDF5 is slower the
MPI-IO, it would indicate that some performance tuning
will be required for your platform (contact us, and we will
see what we can do!).</LI>
</UL>
</LI><p>
<LI><b>Building Your Own Programs</b>:<br>
There are many different subtleties to linking on various
computer platforms, but typically one does the following.
<UL>
<LI>C/C++ Serial:
<br><code>#include
&lt H5Part.h &gt </code> into your
source file.
<br><code>$CC -I<i>path_to_H5Part.h</i>
-I<i>path_to_hdf5.h</i> -o outfile
MyFile.cc -L<i>path_to_libH5Part.a</i> -lH5Part
-L<i>path_to_libhdf5</i> -lhdf5 -lz <i>-lsz</i></code>
</LI>
<LI>C/C++ Parallel:
<br><code>#include
&lt H5Part.h &gt </code> into your
source file.
<br><code>$MPICC -I<i>path_to_H5Part.h</i>
-I<i>path_to_hdf5.h</i> -DPARALLEL_IO
-DH5_HAVE_PARALLEL -o outfile
MyFile.cc -L<i>path_to_libH5Part.a</i> -lH5Part
-L<i>path_to_libhdf5</i> -lhdf5 -lz <i>-lsz</i></code>
</LI>
<LI>Fortran Serial:
<br><code>include
'H5Part.inc'</code> into your
source file.
<br><code>$FC -I<i>path_to_H5Part.h</i>
-I<i>path_to_hdf5.h</i> -o outfile
MyFile.cc -L<i>path_to_libH5PartF.a</i> -lH5PartF
-L<i>path_to_libhdf5</i> -lhdf5 -lz <i>-lsz</i> -lc</code>
</LI>
<LI>Fortran Parallel:
<br><code>include
'H5Part.inc'</code> into your
source file.
<br><code>$MPIF90 -I<i>path_to_H5Part.h</i>
-o outfile
MyFile.cc -L<i>path_to_libpH5PartF.a</i> -lpH5PartF
-L<i>path_to_libhdf5</i> -lhdf5 -lz <i>-lsz</i> -lc</code>
</LI><p>
</UL>
</OL>
<hr>
<a name="Details">
<h1>Details for H5Part Configure and Build</h1>
</a>
<a name="ConfigOptions">
<h2>Configure Options</h2>
</a>
H5Part uses GNU Autoconf to generate a Makefile from the makefile
template called <code>Makefile.in</code>.
The configure script pays attention to the following
configure options;<p>
<UL>
<LI><b>--prefix=PREFIX</b> Install files in PREFIX</LI>
<LI><b>--enable-fortran</b> By default H5part will make no attempt to
build Fortran bindings. If you add the
<code>--enable-fortran</code> flag to the ./configure line, it
will create a small test program to determine how to generate
the fortran bindings and then create a library that includes
those bindings. You may need to set the fortran compiler by
setting the <code>FC</code> environment variable in your shell.</LI>
<LI><b>--enable-parallel</b> The version of HDF5 that you build for
Parallel I/O differs from the library you would build for
serial I/O. Consequently, the H5Part libraries must be built
specifically for the kind of I/O you have in mind (parallel or
serial). The configure script will attempt to find an
<code>mpicc</code> if it is available. If no
<code>mpicc</code> is available it will use the regular
C-compiler and will try to locate the location of the MPI
include files and libraries. You can assist the configure
program in its search by setting the <code>MPIROOT</code>
environment variable.</LI>
<LI><b>--enable-tools</b> Builds the currently available tools
<br>
<b>h5pAttrib</b>, an inspection tool that prints the number of timesteps in a file
the file attributes, the step attributes, the dataset names and their values.
<br>
<b>h5pToGNUplot</b>, a converter to two column ASCII format to load in GNUplot.
</LI>
<LI><b>--enable-python</b><font color=red> Under construction</font> Option to build python bindings. It has not been tested.
</LI>
<LI><b>--help</b> Prints configure options.
</LI>
</UL>
<p>
<a name="MakeOptions">
<h2>Make Options</h2>
</a>
<UL>
<LI>make</LI>builds the libraries and test programs
<LI>make install</LI>builds and installs
<LI>make clean</LI>removes extraneous object files
<LI>make distclean</LI>returns configuration to unconfigured state
</UL>
<a name="EnvVariables">
<h2>Environment Variables for Configure</h2>
</a>
The
configuration script is of limited intelligence. Sometimes, you
have to define the following environment variables in order to
help it on its way. You will often only need to tell it where to
find the HDF5 libraries (<code>H5ROOT</code> for serial or
<code>PHDF5ROOT</code> for parallel builds). All of these
environment variables can also be overidden in the Makefile that
is generated by the autoconfigure script.
The configure script pays attention to the following
environment variables;
<p>
<UL>
<LI><b>CC</b>: Use the <code>CC</code> environment variable to tell the
configure script where to find the C compiler. You can
also directly modify this variable in the
<code>Makefile</code> that is generated by the autoconfigure</LI>
<LI><b>CXX</b>: Use the <code>CXX</code> environment variable to tell the
configure script where to find the C++ compiler. You can
also directly modify this variable in the
<code>Makefile</code> that is generated by the autoconfigure</LI>
<LI><b>FC</b>: Use the <code>FC</code> environment variable to tell the
configure script where to find the fortran compiler. You can
also directly modify this variable in the
<code>Makefile</code> that is generated by the autoconfigure</LI>
<LI><b>MPICC</b>: If you are building for parallel C I/O, then it is
useful to tell the configure script where to find the
<code>mpicc</code> script. Normally, <code>mpicc</code> is
merely a wrapper script for a build using a regular C-compiler.
If no <code>mpicc</code> is available, then the
<code>configure</code> script will attempt to locate the mpi
header files and libraries. In that case, it may be useful to
define the <code>MPI_HOME</code> environment variable.</LI>
<LI><b>MPICXX</b>If you are building for parallel C++</LI>
<LI><b>MPIFC</b>: If you are building for parallel Fortran I/O, then it is
useful to tell the configure script where to find the parallel fortran compiler.
<LI><b>MPIROOT</b>: Set this environment variable to help the
configure script to locate the MPI libraries that should be
used to build the parallel version of the libraries. This
variable will be ignored if configured only to build the
serial implementation of the library.</LI>
<LI><b>HDF5ROOT</b>: Find the path to your serial HDF5 installation. If you
are building the serial version of H5part, then you should set
the <code>PHDF5ROOT</code> environment variable.</LI>
</UL><p>
<h3>Common compiler environemt variables for NERSC platforms</h3>
<UL>
<LI><b>DaVinci</b>: Linux ia64 </LI>
CC=icc CXX=icc F90=ifort MPICC=icc MPIFC=ifort MPILIB=-L/usr/lib/ -lmpi MPIINC=-I/usr/include
<LI><b>Bassi</b>: AIX</LI>
CC=cc_r CXX=cc_r FC=xlf_r MPICC=mpcc_r MPICXX=mpcc_r MPIFC=mpxlf_r
<LI><b>Jacquard</b>: Linux x86_64</LI>
CC=pathcc CXX=pathCC FC=pathf90 MPICC=mpicc MPICXX=mpicxx MPIFC=mpif90
<LI><b>Starsky.lbl.gov:</b> (Darwin) PowerPC</LI>
CC=gcc CXX=g++ FC=g95
</UL>
<br>
NOTE: You might need to set the MPI library path (MPILIB) and MPI includes (MPIIINC) if they are in non standard places. For example: <br>
MPILIB=-L/usr/lpp/ppe.poe/lib -lmpi_r MPIINC=-I/usr/lpp/ppe.poe/include/thread
<h3>How to set the variables for configure:</h3>
It is very simple just call env with the variables together with configure. Notice the quotes in MPILIB.
<pre>
% env CC=icc CXX=icc F90=ifort MPICC=icc MPILIB=-L/usr/lib/ -lmpi MPIINC=-I/usr/include ./configure (configure options follow here)
</pre>
In the worst case, you can edit the <code>src/Makefile.am</code> and <code>test/Makefile.am</code> as
needed to perform the proper build.
</div>
-64
View File
@@ -1,64 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Put your title here!!</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="keywords" content="scientific visualization">
<meta name="sitemap" content="put a brief descriptive phrase here that will show up in the site map:foo">
<div id="maincenter">
<head>
<title>Building HDF5</title>
</head>
<body>
<font face="arial,helvetica" size="+2" color="#555588"><h2>Building H5Part</h2></font>
<UL>
<LI><a href="#ConfigOptions">Configure Options</a>
<LI><a href="#EnvVariables">Important Environment Variables</a>
</UL>
<hr>
<a name="ConfigOptions">
<h2>Configure options</h2></a>
</a>
To set the installation path configure with
<pre>
./configure --prefix=your hdf5 installation full path, e.g.--prefix=/usr/local/hdf5
</pre>
For the serial implementation configure with
<pre>
./configure
</pre>
For the parallel implementation configure with
<pre>
./configure --enable-parallel
</pre>
To enable shared objects configure with
<pre>
./configure --enable-shared
</pre>
<a name="EnvVariables">
<h2>Environment Variables</h2></a>
</a>
To add HDF5 to your PATH and LD_LIBRARY_PATH edit your
.tcshr, or .cshrc depending on the shell you are using and add
<pre>
setenv HDF5 "your hdf5 installation full path"
setenv PATH ${PATH}:${HDF5}/bin
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${HDF5}/lib
</pre>
if you are using bash, add to your .bashrc
<pre>
export HDF5="your hdf5 installation full path"
export PATH=$PATH:${HDF5}/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${HDF5}/lib
</pre>
Open a new terminal or do a
source .tcshr (.cshrc, .bashrc) in the one that you are using.
You can <a href="http://vis.lbl.gov/Research/AcceleratorSAPP/Downloading.html">continue <a/>downloading and installing H5Part.
</div>
-37
View File
@@ -1,37 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Downloading HDF5 and H5Part</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="keywords" content="scientific visualization">
<meta name="sitemap" content="put a brief descriptive phrase here that will show up in the site map:foo">
<div id="maincenter">
<head>
<title>Downloading HDF5 and H5Part</title>
</head>
<body>
<font face="arial,helvetica" size="+2" color="#555588"><h2>Downloading H5Part</h2></font>
<UL>
<LI><a href="#hdf5">Downloading HDF5</a>
<LI><a href="#h5part">Downloading H5Part</a>
</UL>
<hr>
<a name="hdf5">
<h2>Downloading HDF5</h2></a>
You will need to download and install the HDF5 library and link H5Part with it.
<UL>
<LI><a href="ftp://ftp.hdfgroup.org/HDF5/current/src/hdf5-1.6.5.tar.gz">ftp://ftp.hdfgroup.org/HDF5/current/src/hdf5-1.6.5.tar.gz</a></LI>
<LI><a href="http://www.zlib.net/zlib-1.2.3.tar.gz">http://www.zlib.net/zlib-1.2.3.tar.gz</a></LI>
<LI><a href="ftp://ftp.hdfgroup.org/lib-external/szip/2.0/src/szip-2.0.tar.gz">ftp://ftp.hdfgroup.org/lib-external/szip/2.0/src/szib-2.0.tar.gz</a></LI>
</UL>
<P>
Note: you might already have libz in your system and you will not need libsz unless you build hdf5 with support for it.
</P>
<h2 id="h5part">Downloading H5Part</h2>
H5Part is available for download from Berkeley Labs Codeforge system <a href="https://codeforge.lbl.gov/projects/h5part/">https://codeforge.lbl.gov/projects/h5part</a>.
</div>
-14
View File
@@ -1,14 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Put your title here!!</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="keywords" content="scientific visualization">
<meta name="sitemap" content="put a brief descriptive phrase here that will show up in the site map:foo">
<div id="maincenter">
Under construction, will be here soon.
</div>
-15
View File
@@ -1,15 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Put your title here!!</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="keywords" content="scientific visualization">
<meta name="sitemap" content="put a brief descriptive phrase here that will show up in the site map:foo">
<div id="maincenter">
Under construction, will be here soon.
</div>
-15
View File
@@ -1,15 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Put your title here!!</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="keywords" content="scientific visualization">
<meta name="sitemap" content="put a brief descriptive phrase here that will show up in the site map:foo">
<div id="maincenter">
Under construction, will be here soon.
</div>
-94
View File
@@ -1,94 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Put your title here!!</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="keywords" content="scientific visualization">
<meta name="sitemap" content="put a brief descriptive phrase here that will show up in the site map:foo">
<div id="maincenter">
<head>
<title>H5Part Utility Tools</title>
</head>
<body>
<font face="arial,helvetica" size="+2" color="#555588"><h2>H5Part Utility Tools</h2></font>
<UL>
<LI><a href="h5pAttrib">h5pAttrib</a>
<LI><a href="h5pToGNUplot">h5pToGNUplot</a>
</UL>
<hr>
<a name="h5pAttrib">
<h2>h5pAttrib</h2>
</a>
<b>h5pAttrib</b> is an inspection tool that prints to stdout the number of timesteps in a file
the file attributes, the step attributes, the dataset names and their values. It's simpler to use than h5dump.
Usage options are given by typing:
<br><br>
<PRE>
% ./h5pAttrib -h
usage: h5pAttrib [OPTIONS] file
OPTIONS
-h, --help Print help page
-n, --nstep Print number of steps
-A, --fileA Print file attributes
-a, --stepA Print step attributes & values for time step n
-d, --dataset Print data sets names & values for time step n
-H, --header Print shorter version without the values
</PRE>
<h3>Examples</h3>
<OL>
<LI>
Show file attribute names & values of sample.h5part
</LI>
h5pAttrib -A sample.h5part
<LI>
Show step attribute names for time step 5 of sample.h5part
</LI>
h5pAttrib -a 5 -H sample.h5part
</OL>
<a name="h5pToGNUplot">
<h2>h5pToGNUplot</h2>
</a>
<b>h5pToGNUplot</b> is a converter from H5Part to two column ASCII text format for loading into GNUplot. Usage options are given by typing:
<br><br>
<PRE>
% ./h5pToGNUplot -h
usage: h5pToGNUplot -t TIMESTEP -1 VARIABLE#1 -2 VARIABLE#2 -i INPUTFILE [OPTIONAL_FLAGS]
FLAGS
-h, --help Print help page
-1, --1var (REQUIRED) Takes first variable parameter
-2, --2var (REQUIRED) Takes second variable parameter
-i, --input (REQUIRED) Takes input file name
-t, --timestep (REQUIRED) Sets the timestep (Value -1 will result in dumping values of all timesteps.)
-o, --output (OPTIONAL) Takes output file name (without this flag, the program will print to stdout)
-n, --number (OPTIONAL) Sets number of output points
-s, --start (OPTIONAL) Sets the starting particle index
</PRE>
<h3>Examples</h3>
<OL>
<LI>
Create a GNU plot file output.txt from sample.h5part by ploting x vs px for timestep 54
</LI>
h5pToGNUplot -t 54 -1 x -2 px -i sample.h5part -o output.txt
<LI>
Create a GNU plot file output.txt from sample.h5part by ploting x vs px for timestep 54
using 1200 points from particle index 76
</LI>
h5pToGNUplot -t 54 -1 x -2 px -i sample.h5part -o output.txt -s 76 -n 1200
</OL>
</div>
-75
View File
@@ -1,75 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>H5Part: VisIt Plugins</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="keywords" content="scientific visualization">
<meta name="sitemap" content="put a brief descriptive phrase here that will show up in the site map:foo">
<div id="maincenter">
<font face="arial,helvetica"><h1>H5Part: VisIt Plugins</h1></font>
<font face="arial,helvetica" color="#555588"><h2>Introduction</h2></font>
<P>
<a href="http://www.llnl.gov/visit">VisIt</a> is an open source point-and-click 3D scientific visualization application that supports most of the common visualization techniques on structured and unstructured grids. One of its advantages is that it employs a distributed and parallel architecture in order to handle extremely large data sets interactively. VisIt's rendering and data processing capabilities are split into viewer and engine components that may be distributed across multiple machines. See this link for <a href="http://vis.lbl.gov/NERSC/Software/visit/">details</a> on how to run VisIt in NERSC.
</P>
<P>
VisIt achieves extensibility through the use of dynamically loaded plugins. All of VisIt's plots, operators, and database readers are implemented as plugins and are loaded at run-time from the plugin directory. New plugins can be added simply by installing them in this directory. VisIt comes with a graphical plugin creation tool, which greatly simplifies the process of creating new plugins. The user describes the properties of the plugin and then the tool generates most of the code necessary to implement the plugin. For example, in the case of an operator, the plugin creation tool creates the code necessary for the graphical user interface attribute window; the C++, Python, and Java interfaces; and the code necessary to interface to VisIt. The only code you need to write is the C++ code that actually performs the operation.
</P>
<font face="arial,helvetica" color="#555588"><h2>H5Part in VisIt</h2></font>
<font face="arial,helvetica" color="#555588"><h3>Database Reader Plugin</h3></font>
<P>
We wrote a Multiple Time Step Multiple Domain database reader to read H5Part data into VisIt. H5Part datasets should be named with the extension <font color=red>".h5part"</font> to be recognized by the reader since VisIt does not have a format selection mechanism at the time of reading. Figure 1 shows a Pseudocolor plot of a data set and Figure 2 shows a Scatter plot x-y (any combination of x, px, y, py, z, pz, id are possible).
</P>
<P>
<TABLE>
<TR>
<TD>
<a href="H5PartVisIt/cloud_visit.png"><img src="H5PartVisIt/cloud_visit.s.png" width=400 height=300></a>
</TD
></TR>
<TR>
<TD width=300>
Figure 1. VisIt User interface showing an H5Part particle file rendered as spheres using the Pseudocolor plot.
</TD>
</TR>
<TR>
<TD>
<a href="H5PartVisIt/cloud_visit_2D.png"><img src="H5PartVisIt/cloud_visit_2D.s.png" width=300 height=300></a>
</TD>
</TR>
<TR>
<TD>
Figure 2. A Scatter plot of the x-y projection of the particles.
</TD>
</TR>
</TABLE>
</P>
<P>
VisIt provides a Query interface, for single time steps and for time series. Figure 3 shows the query interace over time for the sum of the x position and the z position of the particoes.
</P>
<P>
<TABLE>
<TR>
<TD>
<a href="H5PartVisIt/visit_query1.png"><img src="H5PartVisIt/visit_query1.s.png" width=400 height=300></a>
</TD
></TR>
<TR>
<TD width=300>
Figure 3. VisIt's Time Query Output.
</TD>
</TR>
</TABLE>
</p>
<font face="arial,helvetica" color="#555588"><h2>Operator Plugins</h2></font>
<P>
<font face="arial,helvetica" color="#555588"><h3>Particle Random Sampler</h3></font>
</P>
<P>
<font face="arial,helvetica" color="#555588"><h3>Particle Binner</h3></font>
</P>
</div>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 329 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

+26 -7
View File
@@ -28,9 +28,10 @@ top of HDF5: A H5X file is a very special HDF5 file.
2.1.1 File attributes 2.1.1 File attributes
Attributes of the HDF5 root group are called "file attributes". There Attributes of the HDF5 root group are called "file attributes". There
are no restrictions on file attribute names. Supported values are are no restrictions on file attribute names. Names with "__" as prefix and
scalars and arrays of 64bit integer and 64bit floating point number as postfix are intended for internal use. Supported values for file attributes
well as string values, but not arrays of strings. are scalars and arrays of 64bit integer and 64bit floating point number as
well as string values. Arrays of strings are not supported.
2.1.1.1 Predefined file attributes 2.1.1.1 Predefined file attributes
@@ -63,18 +64,28 @@ Example: With __stepnumwidth__ := 5 the name of the step group with
number 42 is "Step#00042", with __stepnumwidth__ := 0 the name is number 42 is "Step#00042", with __stepnumwidth__ := 0 the name is
"Step#42". "Step#42".
Step groups may be unsorted in the HDF5 file und may not be number Step groups may be unsorted in the HDF5 file und needn't be number
consecutively. consecutively.
2.1.3 Other members of the root group
Other sub-groups of the root group are allowed, but the group names are restricted
to names not matching "Step#.*".
2.2 Format of a step group 2.2 Format of a step group
2.2.1 Step attributes 2.2.1 Step attributes
Step attributes are HDF5 attributes asigned to a step group. There Step attributes are HDF5 attributes asigned to a step group. There
are no restrictions on file attribute names. Supported values are are no restrictions on step attribute names. As with file attributes names
scalars and arrays of 64bit integer and 64bit floating point number as enclosed in "__" are intended for internal use. Supported values are the same
well as string values, but not arrays of strings. as for file attributes:
* 64bit integer value
* arrays of 64bit integer values
* 64bit floating point number
* array of 64bit floating point number
* strings
Note that array of strings are not supported!
2.2.2 Predefined step attributes 2.2.2 Predefined step attributes
@@ -147,5 +158,13 @@ n-dimensional vector values with n := 1.
2.3 Step properties [NEW] 2.3 Step properties [NEW]
Why? Much faster than step attributes if you need to access consecutive values
Group of root group with name "StepProperties"
Members are datasets
Supported values are the same as for step attributes
Mapping of value to step via object index of step group
-417
View File
@@ -1,417 +0,0 @@
<html><head><title>H5Part Tools How-to</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr"></head>
<body bgcolor="#ffffff" text="#000000">
<table border="0" cellpadding="0" cellspacing="0" width="987">
<tbody><tr>
<td height="6050" width="27"></td>
<td colspan="3" valign="top">
<div id="body">
<div id="mainleft"><font face="Arial, Helvetica, sans-serif"><a name="TOP"></a>
</font></div>
<div id="maincenter"> <font face="arial,helvetica">
<h1 align="center"><font face="Arial, Helvetica, sans-serif"><b><font color="#666699">H5Part
Tools How-to</font></b></font></h1>
</font><font color="#555588" face="arial,helvetica">
<h2><font color="#666699" face="Arial, Helvetica, sans-serif">Table
of Contents</font></h2>
</font>
<p><font face="Arial, Helvetica, sans-serif"><b><a href="#Quick%20Guide">
[1] Quick Guide</a></b> </font></p>
<p><font face="Arial, Helvetica, sans-serif" size="+1"><b><font color="#999999">---
For h5pAttrib</font></b></font><font face="Arial, Helvetica, sans-serif"><br>
<b><br>
<a href="#timesteps">[2] To see number of timesteps in a h5part file</a><br>
<br>
<a href="#file%20attributes">[3] To see file attributes in a h5part
file</a><br>
<br>
<a href="#step%20attributes"> [4] To see step attributes in a h5part
file</a><br>
<br>
<a href="#dataset">[5] To see dataset in a h5part file</a><br>
<br>
<a href="#flags">[6] Providing more than one flag at once for h5pAttrib</a></b></font></p>
<p><font face="Arial, Helvetica, sans-serif" size="+1"><b><font color="#999999">---
For h5pToGNUplot</font></b></font><font face="Arial, Helvetica, sans-serif"><br>
<br>
<b><a href="#parameters">[7] What parameters to provide</a><br>
<br>
<a href="#input%20file">[8] How to create an input file to GNUplot</a></b></font></p>
<p>&nbsp;</p>
<p align="center"><font face="Arial, Helvetica, sans-serif"><a href="#TOP">&lt;back
to top&gt;</a></font></p>
<p>&nbsp;</p>
<h2><font color="#555588" face="Arial, Helvetica, sans-serif"><a name="Quick Guide">[1]
Quick Guide</a></font></h2>
<p><font face="Arial, Helvetica, sans-serif">Executing the program with
-h option will display a concise help page.</font></p>
<p><font face="Arial, Helvetica, sans-serif"><b><font face="Courier New, Courier, mono" size="+1">$&gt;</font></b><font face="Courier New, Courier, mono">./h5pAttrib
-h</font></font></p>
<p><font face="Courier New, Courier, mono">usage: h5pAttrib [OPTIONS]
file</font></p>
<p><font face="Courier New, Courier, mono"> OPTIONS<br>
-h, --help Print help page<br>
-n, --nstep Print number of steps<br>
-A, --fileA Print file attributes<br>
-a n, --stepA n Print step attributes &amp; values for time step n<br>
-d n, --dataset n Print data sets names &amp; values for time step
n<br>
-H, --header Print shorter version without the values</font></p>
<p><font face="Courier New, Courier, mono"> Examples:</font></p>
<p><font face="Courier New, Courier, mono"> 1) Show file attribute names
&amp; values of sample.h5part</font></p>
<p><font face="Courier New, Courier, mono"> h5pAttrib -A sample.h5part<br>
OR<br>
h5pAttrib --fileA sample.h5part</font></p>
<p><font face="Courier New, Courier, mono"> 2) Show step attribute names
for time step 5 of sample.h5part</font></p>
<p><font face="Courier New, Courier, mono"> h5pAttrib -a 5 -H sample.h5part<br>
OR<br>
h5pAttrib --stepA 5 -H sample.h5part</font></p>
<p><font face="Courier New, Courier, mono"><br>
<b><font size="+1">$&gt;</font></b> ./h5pToGNUplot -h</font></p>
<p><font face="Courier New, Courier, mono">usage: h5pToGNUplot -t TIMESTEP
-1 VARIABLE#1 -2 VARIABLE#2 -i INPUTFILE [OPTIONAL_FLAGS]</font></p>
<p><font face="Courier New, Courier, mono"> FLAGS<br>
-h, --help Print help page</font><br>
<font face="Courier New, Courier, mono">-1 par, --1var par (REQUIRED)
Takes first variable parameter to "par"<br>
-2 par, --2var par (REQUIRED) Takes second variable parameter to "par"<br>
-i file, --input file (REQUIRED) Takes input file name to "file"<br>
</font><font face="Courier New, Courier, mono">-t step, --timestep
step (REQUIRED) Sets the timestep to "step" (Value -1 will
result in dumping values of all timesteps.)<br>
-o file, --output file (OPTIONAL) Takes output file name to "file"
(without this flag, the program will print to stdout)<br>
-n num, --number num (OPTIONAL) Sets number of output points to "num"<br>
-s idx, --start idx (OPTIONAL) Sets the starting particle index to
"idx"</font></p>
<p><font face="Courier New, Courier, mono"><br>
Examples:</font></p>
<p><font face="Courier New, Courier, mono"> 1) Create GNU plot file
output.txt from sample.h5part by ploting x vs px for timestep 54</font></p>
<p><font face="Courier New, Courier, mono"> h5pToGNUplot -t 54 -1 x
-2 px -i sample.h5part -o output.txt</font></p>
<p><font face="Courier New, Courier, mono"> 2) Create GNU plot file
output.txt from sample.h5part by ploting x vs px for timestep 54<br>
using 1200 points from particle index 76</font></p>
<p><font face="Courier New, Courier, mono"> h5pToGNUplot -t 54 -1 x
-2 px -i sample.h5part -o output.txt -s 76 -n 1200</font></p>
<p>&nbsp;</p>
<p align="center"><font face="Arial, Helvetica, sans-serif"><a href="#TOP">&lt;back
to top&gt;</a></font></p>
<p>&nbsp;</p>
<p><font face="Arial, Helvetica, sans-serif" size="+1"><b><font color="#999999">---
For h5pAttrib</font></b></font></p>
<p>&nbsp;</p>
<h2><font color="#555588" face="Arial, Helvetica, sans-serif"><a name="timesteps">[2]
To see number of timesteps in a h5part file</a></font></h2>
<p>Executing the program h5pAttrib with -n flag will display the number
of timesteps in the file.</p>
<p><font face="Arial, Helvetica, sans-serif"><b>EXAMPLE&gt;&gt;</b></font></p>
<p><font face="Arial, Helvetica, sans-serif" size="+1"><b><font face="Courier New, Courier, mono">$&gt;</font></b></font><font face="Courier New, Courier, mono">
./h5pAttrib -n sample.h5part</font></p>
<p><font face="Courier New, Courier, mono">++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</font></p>
<p><font face="Courier New, Courier, mono">Printing number of timesteps
for: sample.h5part ...</font></p>
<p><font face="Courier New, Courier, mono">There are total 252 number
of timesteps.<br>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</font></p>
<p><font face="Courier New, Courier, mono">done</font><font face="Arial, Helvetica, sans-serif"><br>
</font></p>
<p>&nbsp; </p>
<p align="center"><font face="Arial, Helvetica, sans-serif"><a href="#TOP">&lt;back
to top&gt;</a></font></p>
<h2><font color="#666699" face="Arial, Helvetica, sans-serif"><br>
<font color="#555588"><a name="file attributes">[3] To see file attributes
in a h5part file</a></font></font></h2>
<p>File attribute contains information about the file. (file description
etc...) Executing the program h5pAttrib with -A flag will display
the file attributes in the file.</p>
<p><font face="Arial, Helvetica, sans-serif"><b>EXAMPLE&gt;&gt;</b></font></p>
<p><font face="Arial, Helvetica, sans-serif" size="+1"><b><font face="Courier New, Courier, mono">$&gt;</font></b></font><font face="Courier New, Courier, mono">
./h5pAttrib -A sample.h5part</font></p>
<p><font face="Courier New, Courier, mono">++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</font></p>
<p><font face="Courier New, Courier, mono">Printing file attributes
for: sample.h5part ...</font></p>
<p><font face="Courier New, Courier, mono">The number of file attributes
for file sample.h5part is 0 ...<br>
There are no file attributes.<br>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</font></p>
<p><font face="Courier New, Courier, mono">done</font></p>
<p><font face="Arial, Helvetica, sans-serif"><br>
<i>NOTE: -H option will omit the list of values of file attributes.</i></font></p>
<p>&nbsp; </p>
<p align="center"><font face="Arial, Helvetica, sans-serif"><a href="#TOP">&lt;back
to top&gt;</a></font></p>
<p align="center">&nbsp;</p>
<h2><font color="#555588" face="Arial, Helvetica, sans-serif"><a name="step attributes">[4]
To see step attributes in a h5part file</a></font></h2>
<p>Step attribute contains information that belongs to a specific step.
(step name, timestep number, etc...) Executing the program h5pAttrib
with -a flag will display the step attributes in the file.<br>
Note that the timestep index should follow -a flag.</p>
<p><font face="Arial, Helvetica, sans-serif"><b>EXAMPLE&gt;&gt;</b></font></p>
<p><font face="Arial, Helvetica, sans-serif"><b><font face="Courier New, Courier, mono" size="+1">$&gt;</font></b><font face="Courier New, Courier, mono">
./h5pAttrib -a 2 sample.h5part</font></font></p>
<p><font face="Courier New, Courier, mono">++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</font></p>
<p><font face="Courier New, Courier, mono">Printing step attributes
for: sample.h5part ...</font></p>
<p><font face="Courier New, Courier, mono">The number of step attributes
for timestep #2 is 10 ...</font></p>
<p><font face="Courier New, Courier, mono">Attribute #0 = Step<br>
There are 1 elements in the attribute<br>
Attribute Type is H5T_NATIVE_INT64<br>
Printing 1 element value(s):<br>
COUNT[0]: 2</font></p>
<p><font face="Courier New, Courier, mono">Attribute #1 = Spos<br>
There are 1 elements in the attribute<br>
Attribute Type is H5T_NATIVE_DOUBLE<br>
Printing 1 element value(s):<br>
COUNT[0]: 0.143580</font></p>
<p><font face="Courier New, Courier, mono">Attribute #2 = structLen<br>
There are 1 elements in the attribute<br>
Attribute Type is H5T_NATIVE_DOUBLE<br>
Printing 1 element value(s):<br>
COUNT[0]: 2.393000</font></p>
<p><font face="Courier New, Courier, mono">.<br>
.<br>
.</font></p>
<p><font face="Courier New, Courier, mono"><br>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</font></p>
<p><font face="Courier New, Courier, mono">done</font></p>
<p><font face="Arial, Helvetica, sans-serif"><br>
<i>NOTE: -H option will omit the list of values of step attributes.</i></font></p>
<p>&nbsp; </p>
<p align="center"><font face="Arial, Helvetica, sans-serif"><a href="#TOP">&lt;back
to top&gt;</a></font></p>
<h2><font color="#555588" face="Arial, Helvetica, sans-serif"><br>
<a name="dataset">[5] To see dataset in a h5part file</a></font></h2>
<p>Executing the program h5pAttrib with -d flag will display the datasets
information in the file. (dataset name, type, number of elements,
etc...) Executing the program h5pAttrib with -d flag will display
the datasets information in the file.<br>
Note that the timestep index should follow -d flag.</p>
<p><font face="Arial, Helvetica, sans-serif"><b>EXAMPLE&gt;&gt;</b></font></p>
<p><font face="Arial, Helvetica, sans-serif" size="+1"><b><font face="Courier New, Courier, mono">$&gt;</font></b></font><font face="Courier New, Courier, mono">
./h5pAttrib -d 2 -H sample.h5part</font></p>
<p><font face="Courier New, Courier, mono">++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</font></p>
<p><font face="Courier New, Courier, mono">Printing names of datasets
for: sample.h5part ...</font></p>
<p><font face="Courier New, Courier, mono">The number of datasets for
timestep #2 is 7 ...</font></p>
<p><font face="Courier New, Courier, mono">Dataset Name #0 = id<br>
Dataset Type is H5T_NATIVE_INT64<br>
Number of elements: 67587</font></p>
<p><font face="Courier New, Courier, mono">Dataset Name #1 = px<br>
Dataset Type is H5T_NATIVE_DOUBLE<br>
Number of elements: 67587</font></p>
<p><font face="Courier New, Courier, mono">Dataset Name #2 = py<br>
Dataset Type is H5T_NATIVE_DOUBLE<br>
Number of elements: 67587</font></p>
<p><font face="Courier New, Courier, mono">Dataset Name #3 = pz<br>
Dataset Type is H5T_NATIVE_DOUBLE<br>
Number of elements: 67587</font></p>
<p><font face="Courier New, Courier, mono">Dataset Name #4 = x<br>
Dataset Type is H5T_NATIVE_DOUBLE<br>
Number of elements: 67587</font></p>
<p><font face="Courier New, Courier, mono">Dataset Name #5 = y<br>
Dataset Type is H5T_NATIVE_DOUBLE<br>
Number of elements: 67587</font></p>
<p><font face="Courier New, Courier, mono">Dataset Name #6 = z<br>
Dataset Type is H5T_NATIVE_DOUBLE<br>
Number of elements: 67587</font></p>
<p><font face="Courier New, Courier, mono">++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</font></p>
<p><font face="Courier New, Courier, mono">done</font></p>
<p><font face="Arial, Helvetica, sans-serif"><br>
<i>NOTE: -H option will omit the list of values of datasets.</i></font></p>
<p>&nbsp; </p>
<p align="center"><font face="Arial, Helvetica, sans-serif"><a href="#TOP">&lt;back
to top&gt;</a></font></p>
<p>&nbsp;</p>
<h2><font color="#555588" face="Arial, Helvetica, sans-serif"><a name="flags">[6]
Providing more than one flag at once</a></font></h2>
<p><font face="Arial, Helvetica, sans-serif">When more than one flags
are provided, one result after another will be displayed.</font></p>
<p><font face="Arial, Helvetica, sans-serif"><b>EXAMPLE&gt;&gt;</b></font></p>
<p><font face="Arial, Helvetica, sans-serif" size="+1"><b><font face="Courier New, Courier, mono">$&gt;</font></b></font><font face="Courier New, Courier, mono">
./h5pAttrib -H -a 1 -d 1 sample.h5part</font></p>
<p><font face="Courier New, Courier, mono">++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</font></p>
<p><font face="Courier New, Courier, mono">Printing step attributes
for: sample.h5part ...</font></p>
<p><font face="Courier New, Courier, mono">The number of step attributes
for timestep #1 is 10 ...</font></p>
<p><font face="Courier New, Courier, mono">Attribute #0 = Step<br>
Attribute #1 = Spos<br>
Attribute #2 = structLen<br>
Attribute #3 = org<br>
Attribute #4 = maxX<br>
Attribute #5 = minX<br>
Attribute #6 = maxP<br>
Attribute #7 = minP<br>
Attribute #8 = centroid<br>
Attribute #9 = nloc<br>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</font></p>
<p><font face="Courier New, Courier, mono"><br>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</font></p>
<p><font face="Courier New, Courier, mono">Printing names of datasets
for: sample.h5part ...</font></p>
<p><font face="Courier New, Courier, mono">The number of datasets for
timestep #1 is 7 ...</font></p>
<p><font face="Courier New, Courier, mono">Dataset Name #0 = id<br>
Dataset Type is H5T_NATIVE_INT64<br>
Number of elements: 60214</font></p>
<p><font face="Courier New, Courier, mono">Dataset Name #1 = px<br>
Dataset Type is H5T_NATIVE_DOUBLE<br>
Number of elements: 60214</font></p>
<p><font face="Courier New, Courier, mono">Dataset Name #2 = py<br>
Dataset Type is H5T_NATIVE_DOUBLE<br>
Number of elements: 60214</font></p>
<p><font face="Courier New, Courier, mono">Dataset Name #3 = pz<br>
Dataset Type is H5T_NATIVE_DOUBLE<br>
Number of elements: 60214</font></p>
<p><font face="Courier New, Courier, mono">Dataset Name #4 = x<br>
Dataset Type is H5T_NATIVE_DOUBLE<br>
Number of elements: 60214</font></p>
<p><font face="Courier New, Courier, mono">Dataset Name #5 = y<br>
Dataset Type is H5T_NATIVE_DOUBLE<br>
Number of elements: 60214</font></p>
<p><font face="Courier New, Courier, mono">Dataset Name #6 = z<br>
Dataset Type is H5T_NATIVE_DOUBLE<br>
Number of elements: 60214</font></p>
<p><font face="Courier New, Courier, mono">++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</font></p>
<p><font face="Courier New, Courier, mono">done</font></p>
<p>&nbsp;</p>
<div align="center"><font face="Arial, Helvetica, sans-serif"><a href="#TOP">&lt;back
to top&gt;</a></font></div>
</div>
</div>
</td>
</tr>
<tr>
<td height="80"></td>
<td colspan="3" valign="top">
<h2><font face="Arial, Helvetica, sans-serif" size="+1"><b><font color="#999999">---
For h5pToGNUplot</font></b></font></h2>
<h2><font color="#555588" face="Arial, Helvetica, sans-serif"><a name="parameters">[7]
What parameters to provide</a></font></h2>
<p><font face="Arial, Helvetica, sans-serif">When you execute the program
with -h option, it displays what flags are necessary and what flags are
optional.</font></p>
</td>
</tr>
<tr>
<td height="200"></td>
<td valign="top" width="137">
<p align="left"><b><font face="Arial, Helvetica, sans-serif">Short Version</font></b></p>
<p><font face="Arial, Helvetica, sans-serif">-h<br>
-1<br>
-2<br>
-i<br>
-t<br>
-o<br>
-n<br>
-s </font></p>
</td>
<td valign="top" width="144">
<p align="left"><b><font face="Arial, Helvetica, sans-serif">Long Version</font></b></p>
<p><font face="Arial, Helvetica, sans-serif">--help<br>
--1var<br>
--2var<br>
--input<br>
--timestep<br>
--output<br>
--number<br>
--start </font></p>
</td>
<td valign="top" width="679">
<p align="left"><b><font face="Arial, Helvetica, sans-serif">Meanings</font></b></p>
<p><font face="Arial, Helvetica, sans-serif">Print help page<br>
(REQUIRED) Takes first variable parameter<br>
(REQUIRED) Takes second variable parameter<br>
(REQUIRED) Takes input file name<br>
(REQUIRED) Sets the timestep (Value -1 will result in dumping values of
all timesteps.)<br>
(OPTIONAL) Takes output file name (without this flag, the program will
print to stdout)<br>
(OPTIONAL) Sets number of output points<br>
(OPTIONAL) Sets the starting particle index</font> </p>
</td>
</tr>
<tr>
<td height="1786"></td>
<td colspan="3" valign="top">
<p>&nbsp;</p>
<p align="center"><font face="Arial, Helvetica, sans-serif"><a href="#TOP">&lt;back
to top&gt;</a></font></p>
<h2><font color="#555588" face="Arial, Helvetica, sans-serif"><br>
<a name="input file">[8] How to create an input file to GNUplot</a></font></h2>
<p><font face="Arial, Helvetica, sans-serif"><b>EXAMPLE&gt;&gt;</b><br>
<i>Create input file to GNUplot that plots x vs. y.</i></font></p>
<p><font face="Arial, Helvetica, sans-serif"><b><font face="Courier New, Courier, mono" size="+1">$&gt;</font></b><font face="Courier New, Courier, mono">
./h5pToGNUplot -1 x -2 y -t 1 -i sample.h5part -o output.txt<br>
<b><font size="+1">$&gt;</font></b> cat output.txt<br>
-0.390779 -0.254793<br>
-0.396527 -0.252781<br>
-0.375362 -0.285137<br>
-0.396527 -0.252781<br>
-0.379917 -0.283147<br>
-0.390779 -0.254793<br>
-0.387536 -0.287346<br>
-0.371787 -0.319797<br>
-0.379917 -0.283147<br>
-0.378967 -0.326058<br>
-0.378976 -0.326078<br>
-0.387536 -0.287346<br>
-0.378957 -0.326069<br>
-0.379917 -0.283147<br>
-0.388762 -0.265390<br>
-0.371787 -0.319797<br>
-0.390779 -0.254793<br>
-0.376825 -0.266804<br>
-0.379917 -0.283147<br>
-0.375362 -0.285137<br>
...</font></font></p>
<p><font face="Courier New, Courier, mono"><i>Then run GNUplot...</i></font></p>
<p><font face="Courier New, Courier, mono"><b><font size="+1">$&gt;</font></b>
gnuplot</font></p>
<p><font face="Courier New, Courier, mono"> G N U P L O T<br>
Version 4.0 patchlevel 0<br>
last modified Thu Apr 15 14:44:22 CEST 2004<br>
System: Linux 2.6.11.4-21.11-smp</font></p>
<p><font face="Courier New, Courier, mono"> Copyright (C) 1986 - 1993, 1998,
2004<br>
Thomas Williams, Colin Kelley and many others</font></p>
<p><font face="Courier New, Courier, mono"> This is gnuplot version 4.0.
Please refer to the documentation<br>
for command syntax changes. The old syntax will be accepted<br>
throughout the 4.0 series, but all save files use the new syntax.</font></p>
<p><font face="Courier New, Courier, mono"> Type `help` to access the on-line
reference manual.<br>
The gnuplot FAQ is available from<br>
http://www.gnuplot.info/faq/</font></p>
<p><font face="Courier New, Courier, mono"> Send comments and requests for
help to<br>
&lt;gnuplot-info@lists.sourceforge.net&gt;<br>
Send bugs, suggestions and mods to<br>
&lt;gnuplot-bugs@lists.sourceforge.net&gt;</font></p>
<p><font face="Courier New, Courier, mono"><br>
Terminal type set to 'x11'<br>
<font size="+1"><b>gnuplot&gt;</b></font> plot "output.txt"</font></p>
<p><font face="Arial, Helvetica, sans-serif"><i>This will open a GNUplot
window that plots output.txt.</i></font></p>
<p align="center"><img src="H5tools_files/snapshot1.jpg" height="541" width="672"><br>
<font face="Arial, Helvetica, sans-serif">&lt;Sample screen shot of GNUplot
with input datafile generated by h5pToGNUplot&gt;</font></p>
</td>
</tr>
<tr>
<td height="44"></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody></table>
</body></html>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 KiB

-54
View File
@@ -1,54 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>H5Part, Logical Internal HDF5 File Layout</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="keywords" content="scientific visualization">
<meta name="sitemap" content="put a brief descriptive phrase here that will show up in the site map:foo">
<div id="maincenter">
<font face="arial,helvetica"><h1>H5Part: Logical Internal HDF5 File Layout</h1></font>
<P>
HDF5 is extremely flexible in the sense that it allows the user to define a higher level data model to describe domain-specific data relationships. This flexibility however makes it necessary to develop an agreement on the logical layout of the data. The H5Part data model consists of Particle groups corresponding to the simulation time steps, each with seven datasets corresponding to x, px, y, py, z, pz, id for each particle. Attributes can be added to the file and to the datasets.
</P>
<center><img src="layout.png"></center>
<PRE>
HDF5 "parttest.h5" {
GROUP "/" {
GROUP "Particles#0" {
DATASET "id" {
DATATYPE H5T_STD_I64LE
DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
}
DATASET "px" {
DATATYPE H5T_IEEE_F64LE
DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
}
DATASET "py" {
DATATYPE H5T_IEEE_F64LE
DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
}
DATASET "pz" {
DATATYPE H5T_IEEE_F64LE
DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
}
DATASET "x" {
DATATYPE H5T_IEEE_F64LE
DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
}
DATASET "y" {
DATATYPE H5T_IEEE_F64LE
DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
}
DATASET "z" {
DATATYPE H5T_IEEE_F64LE
DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
}
}
</PRE>
<P>
See <a href="http://www-vis.lbl.gov/Publications/2002/hdf5.pdf">hdf5.pdf</a> for an introduction on the use of HDF5.
</P>
</div>
+1 -6
View File
@@ -1,7 +1,2 @@
EXTRA_DIST = \ EXTRA_DIST = \
Doxyfile doxyfooter \ Doxyfile doxyfooter
$(wildcard *.html) \
$(wildcard *.png) \
$(wildcard H5PartVisIt/*.png) \
$(wildcard H5tools/*.html) \
$(wildcard H5tools/H5tools_files/*.jpg)
-603
View File
@@ -1,603 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>H5Part, the C/C++ API</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="keywords" content="scientific visualization">
<meta name="sitemap" content="put a brief descriptive phrase here that will show up in the site map:foo">
<div id="maincenter">
<h1>The C/C++ Application Programming Interface (API)</h1>
<UL>
<LI><a href="#Opening">Opening, Closing, and Validating Datafiles</a>
<LI><a href="#SetStep">Setting the Simulation Timestep</a>
<LI><a href="#SetNumParticles">Setting the Number of Particles</a>
<LI><a href="#Writing">Writing Datasets</a>
<LI><a href="#ReadingNumTimeSteps">Reading the Number of Time Steps</a>
<LI><a href="#ReadingNumParticles">Reading the Number of Particles</a>
<LI><a href="#Reading">Reading Datasets</a>
<LI><a href="#DatasetsInfo">Reading the Number and the Names of Datasets</a>
<LI><a href="#AttributesInfo">Attributes Interface</a>
<LI><a href="#WriteAttribs">Writing Additional Attributes</a>
<LI><a href="#ReadAttribs">Reading Attributes</a>
</UL>
<br>
<a href="ReferencePages/index.html">Reference Manual (Doxygen)</a>
<br>
<hr>
<a name="Opening"><h2>Opening Datafiles</h2></a>
<P>
Just like the familiar <code>FILE*</code> type for C stdio operations, all
H5Part file operations require a file handle. The type of this handle is
<code>(H5PartFile*)</code>.
<br>
<code>H5PartOpenFile()</code> is
used to open a serial file and
<code>HDFPartOpenFileParallel()</code> is used to open a file for
Parallel I/O (in an MPI program).
After you open the file handle you can use the same set of
subroutines for operations on the file regardless of whether the
file is a parallel or serial I/O file.
The libraries manage all of this internally.<p>
</P>
<b>C Prototypes</b><br>
<P>
<b>Serial File</b><br>
<code>H5PartFile *H5PartOpenFile(const char *filename, unsigned
accessmode);</code><br>
<b>Parallel File</b><br>
<code>H5PartFile *H5PartOpenFileParallel(char *filename,int
accessmode,MPI_Comm communicator);</code><br>
<DT><i>filename</i>: </DT><DD>The name of the IEEEIO data file to
open. The typical extension for these files is <i>.h5</i></DD>
<DT><i>accessmode</i>: </DT><DD>The accessmode for the file. This is
one of 2 different access modes<br>
<code>H5PART_READ</code> : Opens a file in read-only mode.</DT><br>
<code>H5PART_WRITE</code> : Opens a file in write-only mode.
If the
file does not exist, it will be created. If it does
exist, it will be
truncated.
<DT><i>communicator</i>: </DT>
<DD>This argument is only available if the program has been
compiled with the <code>PARALLEL_IO</code> C-preprocessor flag
defined. It is used to pass in the communicator that will be
used for all collective I/O operations that target the same
file on disk.</DD>
<DT><i>Returns</i>:</DT><DD>A new filehandle with an open file or NULL if error.</DD>
</DL>
</P>
<br><b>Example Use</b><br>
<pre>
#include &lt H5Part.h &gt
. . . code . . .
/* Open an HDF5 file for writing */
H5PartFile *writer = H5PartOpenFile("datafileout.h5",H5PART_WRITE);
/* Open an HDF5 file for Parallel I/O */
H5PartFile *writer = H5PartOpenFileParallel("datafileout.h5",H5PART_WRITE,MPI_COMM_WORLD);
/* open HDF5 file for reading */
H5PartFile *reader = H5PartOpenFile("datafilein.h5",H5PART_READ);
/* open HDF5 file for parallel reads */
H5PartFile *reader = H5PartOpenFileParallel("datafilein.h5",H5PART_READ,MPI_COMM_WORLD);
. . . more code . . .
</pre> <br>
<hr>
<h2>Closing Datafiles</h2>
<P>
To close the file, you simply use H5PartCloseFile() for both
parallel and serial files. You must call H5PartCloseFile() on any
file descriptor created by H5PartFileOpen() regardless of
whether the file turns out to be valid or not.
</P>
<b>C Prototypes</b><br>
<P>
<code>void H5PartCloseFile(H5PartFile *fileID);</code>
<DL>
<DT><i>fileID</i>: </DT><DD>A FileHandle opened by
H5PartOpenFile() or H5PartOpenFileParallel().</DD>
<DT><i>Returns</i>:</DT><DD>void.</DD>
</DL>
</P>
<br><b>Example Use</b><br>
<pre>
#include &lt H5Part.h &gt
H5PartFile *file;
... code ...
file=H5PartOpenFileParallel("parttest.h5",H5PART_WRITE,comm);
... more code ...
H5PartCloseFile(file);
</pre>
<br>
<hr>
<h2>Validating Datafiles</h2>
<P>
You can test if the file was opened successfully using the
H5PartFileIsValid() function. It returns 1 if valid, 0 if invalid.<p>
</P>
<b>C Prototype</b><br>
<P>
<code>int H5PartFileIsValid(H5PartFile *fileID);</code>
<DL>
<DT><i>fileID</i>: </DT><DD>A FileHandle opened by
H5PartOpenFile() or H5PartOpenFileParallel().</DD>
<DT><i>Returns</i>:</DT><DD>1 if valid, 0 if invalid.</DD>
</DL>
</P>
<br><b>Example Use</b><br>
<P>
Here is an example of validating a newly opened file. Even if
the file is invalid, you must use H5PartCloseFile() to reclaim
the file handle.
</P>
<pre>
#include &lt H5Part.h &gt
. . . code . . .
H5PartFile *fileID = H5PartOpenFile("datafileout.h5",H5PART_WRITE);
if(!H5PartFileIsValid(fileID)){
puts("The file you specified does not exist or is not in a
readable format");
H5PartClose(fileID); /* must reclaim fileID even if file is invalid */
. . . do other cleanup . . .
}
. . . more code . . .
</pre><br>
<hr>
<a name="SetStep">
<h2>Setting the Timestep</h2>
</a>
<P>
When writing data to a file the current time step must be set (even if there is only one). In a file with N time steps, the steps are numbered from 0 to N-1.
</P>
<b>C Prototype</b><br>
<P>
<code>void H5PartSetStep((H5PartFile *fileID,int step);</code>
<DL>
<DT><i>fileID</i>: </DT><DD>A FileHandle opened by
H5PartOpenFile() or H5PartOpenFileParallel().</DD>
<DT><i>step</i>: </DT><DD>An integer time step.
</DD>
<DT><i>Returns</i>: </DT><DD>void.</DD>
</DL>
<br><b>Example Use</b><br>
</P>
<pre>
#include &lt H5Part.h &gt
H5PartFile *fileID;
int timeStep;
....
H5PartSetStep(fileID,timeStep);
....
</pre>
<hr>
<a name="SetNumParticles">
</a>
<h2>Setting the Number of Particles</h2>
<P>
H5PartSetNumParticles: This function's sole purpose is to
prevent needless creation of new HDF5 DataSpace handles if
the number of particles is invariant throughout the sim.
That's its only reason for existence. After you call this
subroutine, all subsequent operations will assume this
number of particles will be written.
</P>
<b>C Prototype</b><br>
<P>
<code>void H5PartSetNumParticles(H5PartFile *fileID,long long nparticles);</code>
<DL>
<DT><i>fileID</i>: </DT><DD>A FileHandle opened by
H5PartOpenFile() or H5PartOpenFileParallel().</DD>
<DT><i>nparticles</i>: </DT><DD>A long long integer specifying the number of particles.
</DD>
<DT><i>Returns</i>: </DT><DD>void.</DD>
</DL>
</P>
<br><b>Example Use</b><br>
<pre>
#include &lt H5Part.h &gt
H5PartFile *fileID;
long long nparticles;
....
H5PartSetStep(fileID,nparticles);
....
</pre>
<hr>
<a name="Writing">
<h2>Writing Datasets</h2>
</a>
<P>
After setting the number of particles with
<a href="#SetNumParticles">H5PartSetNumParticles()</a>
and the current timestep using
<a href="#SetStep">H5PartSetStep()</a>, you can start
writing datasets into the file. Each dataset has a name
associated with it (chosen by the user) in order to facilitate
later retrieval. The writing routines also implicitly store
the datatype of the array so that the array can be
reconstructed properly on other systems with incompatible type
representations. The data is committed to disk before the
routine returns. All data that is written after setting the
timestep is associated with that timestep. While the number of
particles can change for each timestep, you cannot change the
number of particles in the middle of a given timestep.
</P>
<b>C Prototypes</b><br>
<P>
<code>int H5PartWriteDataFloat64(H5PartFile *fileID,char
*name,double *array);</code></br>
<code>int H5PartWriteDataInt64(H5PartFile *fileID,char
*name,double *array);</code>
<DL>
<DT><i>fileID</i>: </DT><DD>A FileHandle opened by
<a href="#Opening">H5PartOpenFile()</a> or
<a href="#Opening">H5PartOpenFileParallel()</a>.</DD>
<DT><i>name</i>: </DT><DD>A null-terminated string for the
name of the array. When retrieving datasets from disk,
you ask for them by name. There are no restrictions on
naming of arrays, but it is useful to arrive at some common
naming convention when sharing data with other groups.</DD>
<DT><i>array</i>: </DT><DD>A buffer containing an array of
particle data to commit to disk. The datatype for
elements in the buffer is implicit in the name of the
subroutine call.</DD>
<DT><i>Returns</i>: </DT><DD>1 on success, 0 on failure.</DD>
</DL>
</P>
<br><b>Example Use</b><br>
<pre>
#include &lt H5Part.h &gt
H5PartFile *fileID;
double *x,*y,*z;
int timeStep;
long long nparticles;
...
H5PartSetStep(fileID,timeStep); /* must set the current timestep in file */
H5PartSetNumParticles(fileID,nparticles); /* then set number of particles to store */
/* now write different tuples of data into this timestep of the file */
H5PartWriteDataFloat64(fileID,"x",x);
H5PartWriteDataFloat64(fileID,"y",y);
H5PartWriteDataFloat64(file,"z",z);
..
</pre>
<hr>
<a name="ReadingNumTimeSteps">
<h2>Reading the Number of Time Steps</h2>
</a>
<P>
This reads the number of datasteps that are
currently stored in the datafile.
It works for both reading and writing of files, but is probably
only typically used when you are reading.
</P>
<b>C Prototype</b><br>
<P>
<code>int H5PartGetNumSteps (H5PartFile *fileID);</code><br>
<DL>
<DT><i>fileID</i>: </DT><DD>A FileHandle opened by <a href="#Opening">H5PartOpenFile()</a> or
<a href="#Opening">H5PartOpenFileParallel()</a>.</DD>
<DT><i>Returns</i>: </DT><DD>The number of timesteps currently stored in the file.
</DL>
</P>
<hr>
<a name="ReadingNumParticles">
<h2>Reading the Number of Particles</h2>
</a>
<P>
This reads the number of particles that are
currently stored in the current time step.
It will arbitrarily select a timestep if you haven't
already set the timestep with H5PartSetStep().
</P>
<b>C Prototype</b><br>
<P>
<code>long long H5PartGetNumParticles (H5PartFile *fileID);</code><br>
<DL>
<DT><i>fileID</i>: </DT><DD>A FileHandle opened by <a href="#Opening">H5PartOpenFile()</a> or
<a href="#Opening">H5PartOpenFileParallel()</a>.</DD>
<DT><i>Returns</i>: </DT><DD>The number of particles in current timestep.
</DL>
</P>
<br><b>Example Use</b><br>
<pre>
#include &lt H5Part.h &gt
H5PartFile *fileID;
int timeStep;
long long nparticles;
H5PartSetStep(fileID,0);
nparticles=H5PartGetNumParticles(fileID);
...
</pre>
<hr>
<a name="Reading">
<h2>Reading Datasets</h2>
</a>
<P>
After setting the time step and getting the number of particles to allocate the data arrays, you can start to read the data.
</P>
<b>C Prototypes</b><br>
<P>
<code>int H5PartReadDataFloat64(H5PartFile *fileID,char *name,double *array);</code><br>
<code>int H5PartReadDataInt64(H5PartFile *fileID,char *name,long long *array);</code><br>
<DL>
<DT><i>fileID</i>: </DT><DD>A FileHandle opened by
<a href="#Opening">H5PartOpenFile()</a> or
<a href="#Opening">H5PartOpenFileParallel()</a>.</DD>
<DT><i>name</i>: </DT><DD>A null-terminated string for the
name of the array. When retrieving datasets from disk,
you ask for them by name. There are no restrictions on
naming of arrays, but it is useful to arrive at some common
naming convention when sharing data with other groups.</DD>
<DT><i>array</i>: </DT><DD>A buffer to which the particle data will be read.i
The datatype for
elements in the buffer is implicit in the name of the
subroutine call.</DD>
<DT><i>Returns</i>: </DT><DD>1 on success, 0 on failure.</DD>
</DL>
</P>
<br><b>Example Use</b><br>
<pre>
#include &lt H5Part.h &gt
H5PartFile *fileID;
double *x,*y,*z;
int timeStep;
long long nparticles;
H5PartSetStep(fileID,0);
nparticles=H5PartGetNumParticles(fileID);
...
H5PartReadDataFloat64(file,"x",x);
H5PartReadDataFloat64(file,"y",y);
H5PartReadDataFloat64(file,"z",z);
...
</pre>
<hr>
<a name="DatasetsInfo"><h2>Reading the Number and Names of Datasets</h2></a>
<P>
H5Part provides funtions to find out how many datasets are stored at a particular timestep
and what their names are if you don't know what they are a-priori.
</P>
<b>C Prototypes</b><br>
<P>
<code>int H5PartGetNumDatasets(H5PartFile *fileID);</code><br>
<DL>
<DT><i>fileID</i>: </DT><DD>A FileHandle opened by
<a href="#Opening">H5PartOpenFile()</a> or
<a href="#Opening">H5PartOpenFileParallel()</a>.</DD>
<DT><i>Returns</i>: </DT><DD>The number of datasets.</DD>
</DL>
</P>
<P>
<code>int H5PartGetDatasetName(H5PartFile *fileID,int index,char *name,int maxlen);</code><br>
<DL>
<DT><i>fileID</i>: </DT><DD>A FileHandle opened by
<a href="#Opening">H5PartOpenFile()</a> or
<a href="#Opening">H5PartOpenFileParallel()</a>.</DD>
<DT><i>index</i>:</DT><DD> integer specifying the index of the dataset. If the number of datasets is
nds, the range of index is 0 to nds-1.</DD>
<DT><i>name</i>:</DT><DD> A null-terminated string for the name of the dataset.</DD>
<DT><i>maxlen</i>:</DT><DD> An integer specifying the maximum length of the name array.</DD>
<DT><i>Returns</i>: </DT><DD>1 on success, 0 on failure.</DD>
</DL>
</P>
<br><b>Example Use</b><br>
<pre>
#include &lt H5Part.h &gt
H5PartFile *fileID;
char name[64];
int index, nds;
...
nds=H5PartGetNumDatasets(fileID);
for(index=0;index&lt nds;index++){
H5PartGetDatasetName(fileID,index,name,64);
printf("\tDataset[%u] name=[%s]\n", index,name);
}
...
</pre>
<hr>
<a name="AttributesInfo">
<h2>Attributes Interface</h2></a>
<P>
In the current H5Part implemtation there are two types of attributes: file attributes which are bound to the file
and step attributes which are bound to the current timestep. You
must set the timestep explicitly before writing the attributes (just
as you must do when you write a new dataset. Currently there are no
attributes that are bound to a particular data array, but this could
easily be done if required.
</P>
<P>H5PartGetNumStepAttribs and H5PartGetNumFileAttribs return the number of attributes bound to a step and to a file respectively. H5PartGetStepAttribInfo and H5PartGetFileAttribInfo return the name, type and number of elements of type "type" bound to a step and a file respectively.
</P>
<b>C Prototypes:</b><br>
<code>int H5PartGetNumStepAttribs(H5PartFile *fileID);
</code><br>
<DL>
<DT><i>fileID</i>: </DT><DD>A FileHandle opened by
<a href="#Opening">H5PartOpenFile()</a> or
<a href="#Opening">H5PartOpenFileParallel()</a>.</DD>
<DT><i>Returns</i> </DT><DD> The number of step attributes for the current step.</DD>
</DL>
<code>int H5PartGetNumFileAttribs(H5PartFile *fileID);
</code><br>
<DL>
<DT><i>fileID</i>: </DT><DD>A FileHandle opened by
<a href="#Opening">H5PartOpenFile()</a> or
<a href="#Opening">H5PartOpenFileParallel()</a>.</DD>
<DT><i>Returns</i> </DT><DD> The number of file attributes.</DD>
</DL>
<code>void H5PartGetStepAttribInfo(H5PartFile *fileID,int idx, char *name,size_t maxnamelen,hid_t *type,int *nelem);
</code><br>
<DL>
<DT><i>fileID</i>: </DT><DD>A FileHandle opened by
<a href="#Opening">H5PartOpenFile()</a> or
<a href="#Opening">H5PartOpenFileParallel()</a>.</DD>
<DT><i>idx</i>: </DT><DD>Index of the attribute.</DD>
<DT><i>name</i>: </DT><DD>A null-terminated string with the name of the attribute.</DD>
<DT><i>maxnamelen</i></DT><DD>the length of the name of the attribute.</DD>
<DT><i>type</i>: </DT><DD>One of the following: H5T_NATIVE_DOUBLE H5T_NATIVE_INT64 H5T_NATIVE_CHAR.</DD>
<DT><i>nelem</i>: </DT><DD>Number of elements of type "type".</DD>
<DT><i>Returns</i> </DT><DD> void.</DD>
</DL>
<code>void H5PartGetFileAttribInfo(H5PartFile *fileID,int idx, char *name,size_t maxnamelen, hid_t *type,int *nelem);
</code><br>
<DL>
<DT><i>fileID</i>: </DT><DD>A FileHandle opened by
<a href="#Opening">H5PartOpenFile()</a> or
<a href="#Opening">H5PartOpenFileParallel()</a>.</DD>
<DT><i>idx</i>: </DT><DD>Index of the attribute.</DD>
<DT><i>name</i>: </DT><DD>A null-terminated string with the name of the attribute.</DD>
<DT><i>maxnamelen</i></DT><DD>the length of the name of the attribute.</DD>
<DT><i>type</i>: </DT><DD>One of the following: H5T_NATIVE_DOUBLE H5T_NATIVE_INT64 H5T_NATIVE_CHAR.</DD>
<DT><i>nelem</i>: </DT><DD>Number of elements of type "type".</DD>
<DT><i>Returns</i> </DT><DD> void.</DD>
</DL>
<a name="WriteAttribs">
<h2>Writing Attributes</h2>
</a>
<P>
An attribute can be bound to the file or after setting the time step to this time step.
</P>
<b>C Prototypes: Generic Attributes</b><br>
<P>
<code>int H5PartWriteFileAttrib(H5PartFile *fileID,char *name, hid_t type,void *value,int nelem);</code><br>
<code>int H5PartWriteStepAttrib(H5PartFile *fileID,char *name, hid_t type,void *value,int nelem);</code><br>
<DL>
<DT><i>fileID</i>: </DT><DD>A FileHandle opened by
<a href="#Opening">H5PartOpenFile()</a> or
<a href="#Opening">H5PartOpenFileParallel()</a>.</DD>
<DT><i>name</i>: </DT><DD>A null-terminated string for the
name of the array. When retrieving datasets from disk,
you ask for them by name. There are no restrictions on
naming of arrays, but it is useful to arrive at some common
naming convention when sharing data with other groups.</DD>
<DT><i>type</i>: One of H5T_NATIVE_DOUBLE, H5T_NATIVE_INT64, H5T_NATIVE_CHAR.</DD>
<DT><i>value</i>: value of the attribute.</DD>
<DT><i>nelem</i>: number of elements of type "type".</DD>
<DT><i>Returns</i>: </DT><DD>1 on success, 0 on failure.</DD>
</DL>
</P>
<br><b>Example Use</b><br>
<pre>
#include &lt H5Part.h &gt
H5PartFile *fileID;
double actPos;
...
H5PartWriteStepAttrib(file_m,"Spos",H5T_NATIVE_DOUBLE,&actPos,1);
...
</pre>
<b>C Prototypes: String Attributes</b><br>
<P>
<code>int H5PartWriteStepAttribString(H5PartFile *fileID,char *name, char *attrib);</code><br>
<code>int H5PartWriteFileAttribString(H5PartFile *fileID,char *name, char *attrib);</code><br>
<DL>
<DT><i>fileID</i>: </DT><DD>A FileHandle opened by
<a href="#Opening">H5PartOpenFile()</a> or
<a href="#Opening">H5PartOpenFileParallel()</a>.</DD>
<DT><i>name</i>: </DT><DD>A null-terminated string for the
name of the array. When retrieving datasets from disk,
you ask for them by name. There are no restrictions on
naming of arrays, but it is useful to arrive at some common
naming convention when sharing data with other groups.</DD>
<DT><i>attrib</i>: the attribute character string.</DD>
<DT><i>Returns</i>: </DT><DD>1 on success, 0 on failure.</DD>
</DL>
</P>
<br><b>Example Use</b><br>
<pre>
#include &lt H5Part.h &gt
H5PartFile *fileID;
char *newattrib;
char *newname;
...
H5PartWriteFileAttribString(fileID, newname,newattrib);
...
</pre>
<hr>
<a name="ReadAttribs">
<h2>Reading Attributes</h2>
</a>
<P>
<P>
As with the writing of attributes, there are two basic reading interfaces one that reads file bound attributes and one that reads
step bound attributes. If the step is not set the current one will be used.
</P>
</P>
<b>C Prototypes</b><br>
<P>
<code>void H5PartReadStepAttrib(H5PartFile *fileID,char *name,void *value);</code><br>
<code>void H5PartReadAttrib(H5PartFile *fileID,char *name,void *value);</code><br>
<code>int H5PartReadFileAttrib(H5PartFile *fileID,char *name,void *value);</code><br>
<DL>
<DT><i>fileID</i>: </DT><DD>A FileHandle opened by
<a href="#Opening">H5PartOpenFile()</a> or
<a href="#Opening">H5PartOpenFileParallel()</a>.</DD>
<DT><i>name</i>: </DT><DD>A null-terminated string for the
name of the array. When retrieving datasets from disk,
you ask for them by name. There are no restrictions on
naming of arrays, but it is useful to arrive at some common
naming convention when sharing data with other groups.</DD>
<DT><i>value</i>: value of the attribute.</DD>
<DT><i>Returns</i>: </DT><DD>1 on success, 0 on failure.</DD>
</DL>
</P>
<br>
NOTE: H5PartReadAttrib has been superseeded by H5PartSetStep.
<br>
<br><b>Example Use</b><br>
<pre>
#include &lt H5Part.h &gt
H5PartFile *fileID;
int step;
char name[MAXNAME];
...
H5PartSetStep(fileID, step);
if (H5PartReadStepAttrib(file, "filename", &name[0]) == 1){
printf("Read step from file: %s\n", name);
}
...
</pre>
</div>
-500
View File
@@ -1,500 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>H5part, the Fortran API</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="keywords" content="scientific visualization">
<meta name="sitemap" content="put a brief descriptive phrase here that will show up in the site map:foo">
<div id="maincenter">
<h1>The FORTRAN Application Programming Interface (API)</h1>
<P>
These references contain the information on how to access the H5Part API using FORTRAN bindings. All pointers are cast to haddr_t (a unint64_t) within the C/C++ code. In fortran, these pointers (handles) are carried as INTEGER*8
</P>
<UL>
<LI><a href="#Opening">Opening, Closing, and Validating Datafiles</a>
<LI><a href="#SetStep">Setting the Simulation Timestep</a>
<LI><a href="#SetNumParticles">Setting the Number of Particles</a>
<LI><a href="#Writing">Writing Datasets</a>
<LI><a href="#ReadingNumTimeSteps">Reading the Number of Time Steps</a>
<LI><a href="#ReadingNumTimeSteps">Reading the Number of Particles</a>
<LI><a href="#Reading">Reading Datasets</a>
<LI><a href="#DatasetsInfo">Reading the Number and the Names of Datasets</a>
<LI><a href="#AttributesInfo">Attributes Interface</a>
<LI><a href="#WriteAttribs">Writing Additional Attributes</a>
<LI><a href="#ReadAttribs">Reading Attributes</a>
</UL>
<hr>
<a name="Opening"><h2>Opening Datafiles</h2></a>
<P>
Like the familiar OPEN in FORTRAN files can be opened to read and write. Different functions are used for the serial and parallel case.
</P>
<b>FORTRAN Prototypes</b><br>
<P>
<b>Serial File</b><br>
<code>INTEGER*8 h5pt_openr</code><br>
<code>FUNCTION h5pt_openw(file)<br>
in CHARACTER file(*) : the filename to open for writing </code><br>
returns INTEGER*8 : and open filehandle for serial reads</code><br>
<br>
<code>INTEGER*8 h5pt_openw</code><br>
<code>FUNCTION h5pt_openw(file)<br>
in CHARACTER file(*) : the filename to open for writing<br>
returns INTEGER*8 : and open filehandle for serial writes</code><br>
<br>
<b>Parallel File</b><br>
<code>INTEGER*8 h5pt_openr_par</code><br>
<code>FUNCTION h5pt_openr_par(file,mpi_communicator)<br>
in CHARACTER file(*) : the filename to open for writing<br>
in INTEGER mpi_communicator : the MPI_Communicator used by the program<br>
returns INTEGER*8 : and open filehandle for parallel reads</code><br>
<br>
<code>INTEGER*8 h5pt_openw_par</code><br>
<code>FUNCTION h5pt_openw_par(file,mpi_communicator)<br>
in CHARACTER file(*) : the filename to open for writing<br>
in INTEGER mpi_communicator : the MPI_Communicator used by the program<br>
returns INTEGER*8 : and open filehandle for parallel reads</code><br>
</P>
<P>
<b>Example Use</b><br>
<pre>
include 'H5Part.inc'
INTEGER*8 file
...
file = h5pt_openw("testfilef.h5")
...
</pre>
</P>
<hr>
<h2>Closing Datafiles</h2>
<P>
To close the file, you simply use h5pt_close() for both parallel and serial files. You must call h5pt_close() on any file descriptor created by h5pt_open*() regardless of whether the file turns out to be valid or not.</P>
<b>FORTRAN Prototype</b><br>
<code>EXTERNAL h5pt_close</code><br>
<code>SUBROUTINE h5pt_close(filehandle)<br>
in INTEGER*8 filehandle : close this open filehandle</code><br>
<b>Example Use</b><br>
<pre>
include 'H5Part.inc'
INTEGER*8 file
...
call h5pt_close(file)
...
</pre>
</P>
<hr>
<h2> Validating Datafiles</h2>
<P>
You can test if the file was opened successfully using the
h5p_isvalid() function. It returns 1 if valid, 0 if invalid.
</P>
<b>FORTRAN Prototype</b><br>
<code>INTEGER h5pt_isvalid</code><br>
<code>FUNCTION h5pt_isvalid(filehandle)<br>
in INTEGER*8 filehandle: an open filehandle <br>
returns INTEGER : 1 if the file is valid, 0 if it is not</code><br>
<b>Example Use</b><br>
<pre>
include 'H5Part.inc'
INTEGER*8 file
INTEGER status
...
status = h5pt_isvalid(file)
...
</pre>
</P>
<hr>
<a name="SetStep">
<h2>Setting the Timestep</h2>
</a>
<P>
When writing data to a file the current time step must be set (even if there is only one). In a file with N time steps, the steps are numbered from 0 to N-1.
</P>
<b>FORTRAN Prototype</b><br>
<code>EXTERNAL h5pt_setstep</code><br>
<code>SUBROUTINE h5pt_setstep(filehandle,step)<br>
in INTEGER*8 filehandle : an open filehandle<br>
in INTEGER step : Set the current timestep in the file to this
</code><br>
<b>Example Use</b><br>
<pre>
include 'H5Part.inc'
INTEGER*8 file
INTEGER I
INTEGER nstep
...
do I=1,nstep
call h5pt_setstep(file,I)
... more code ...
enddo
</pre>
</P>
<hr>
<a name="SetNumParticles">
</a>
<h2>Setting the Number of Particles</h2>
<P>
This function's sole purpose is to
prevent needless creation of new HDF5 DataSpace handles if
the number of particles is invariant throughout the sim.
That's its only reason for existence. After you call this
subroutine, all subsequent operations will assume this
number of particles will be written.
</P>
<b>FORTRAN Prototype</b><br>
<code>EXTERNAL h5pt_setnpoints</code><br>
<code>SUBROUTINE h5pt_setnpoints(filehandle,npoints)<br>
in INTEGER*8 filehandle : an open filehandle<br>
in INTEGER*8 npoints : The number of particles on *this* processor</code><br>
<b>Example Use</b><br>
<pre>
include 'H5Part.inc'
INTEGER*8 file
INTEGER*8 npoints
...
call h5pt_setnpoints(file,npoints)
...
</pre>
<hr>
<a name="Writing">
<h2>Writing Datasets</h2>
</a>
<P>
After setting the number of particles with
<a href="#SetNumParticles">h5pt_setnpoints()</a>
and the current timestep using
<a href="#SetStep">h5pt_setstep()</a>, you can start
writing datasets into the file. Each dataset has a name
associated with it (chosen by the user) in order to facilitate
later retrieval. The writing routines also implicitly store
the datatype of the array so that the array can be
reconstructed properly on other systems with incompatible type
representations. The data is committed to disk before the
routine returns. All data that is written after setting the
timestep is associated with that timestep. While the number of
particles can change for each timestep, you cannot change the
number of particles in the middle of a given timestep.
</P>
<b>FORTRAN Prototypes</b><br>
<P>
The two data types supported for the moment are REAL*8 and INTEGER*8 (float64 and int64).
</P>
<code>EXTERNAL h5pt_writedata_r8</code><br>
<code>SUBROUTINE h5pt_writedata_r8(filehandle,name,data)<br>
in INTEGER*8 filehandle : an open filehandle<br>
in CHARACTER name(*) : The name of the data we are writing eg. "X" or "Y" or "PX" etc...<br>
in REAL*8 data(*) : The dataarray to write</code><br>
<br>
<code>EXTERNAL h5pt_writedata_i8</code><br>
<code>SUBROUTINE h5pt_writedata_i8(filehandle,name,data)<br>
in INTEGER*8 filehandle : an open filehandle<br>
in CHARACTER name(*) : The name of the data we are writing eg. "X" or "Y" or "PX" etc...<br>
in INTEGER*8 data(*) : The dataarray to write</code><br>
<b>Example Use</b><br>
<pre>
include 'H5Part.inc'
INTEGER*8 file
INTEGER nstep
INTEGER I
REAL*8,ALLOCATABLE:: X(:)
...
do I=1,nstep
call h5pt_setstep(file,I)
call h5pt_writedata_r8(file,"x",X)
enddo
...
</pre>
<hr>
<a name="ReadingNumTimeSteps">
<h2>Reading the Number of Time Steps</h2>
</a>
<P>
This reads the number of datasteps that are
currently stored in the datafile.
It works for both reading and writing of files, but is probably
only typically used when you are reading.
</P>
<b>FORTRAN Prototypes</b><br>
<code>INTEGER h5pt_getnsteps</code><br>
<code>FUNCTION h5pt_getnsteps(filehandle)<br>
in INTEGER*8 filehandle : an open filehandle<br>
returns INTEGER : number of timesteps stored in the file</code><br>
<b>Example Use</b><br>
<pre>
include 'H5Part.inc'
INTEGER*8 file
INTEGER nstep
file = h5pt_openr("testfilef.h5")
nstep = h5pt_getnsteps(file)
</pre>
<hr>
<a name="ReadingNumParticles">
<h2>Reading the Number of Particles</h2>
</a>
<P>
This reads the number of particles that are currently stored in the current time step. It will arbitrarily select a timestep if you haven't already set the timestep with H5PartSetStep().
</P>
<b>FORTRAN Prototypes</b><br>
<code>INTEGER h5pt_getnpointss</code><br>
<code>FUNCTION h5pt_getnpoints(filehandle)<br>
in INTEGER*8 filehandle : an open filehandle<br>
returns INTEGER : number of particles in the current time step</code><br>
<b>Example Use</b><br>
<pre>
include 'H5Part.inc'
INTEGER*8 file
INTEGER*8 npoints
INTEGET step;
file = h5pt_openr("testfilef.h5")
call h5pt_setstep(file,0)
npoints = h5pt_getnpoints(file)
...
</pre>
<hr>
<a name="Reading">
<h2>Reading Datasets</h2>
</a>
<P>
After setting the time step and getting the number of particles to allocate the data arrays, you can start to read the data.
</P>
<b>FORTRAN Prototypes</b><br>
<code>INTEGER h5pt_readdata_r8</code><br>
<code>FUNCTION h5pt_readdata_r8(filehandle,name,data)<br>
in INTEGER*8 filehandle : an open filehandle<br>
in CHARACTER name(*) : The name of the data we are writing, eg. "X" or "Y" or "PX" etc...<br>
out REAL*8 data(*) : The data array to read. The number of points to read is either the number within
the view setby h5pt_setview() or the default (the total number of particles in the file).<br>
<b>Example Use</b><br>
<pre>
include 'H5Part.inc'
INTEGER*8 file
INTEGER err
INTEGER*8,ALLOCATABLE:: ID(:)
...
call h5pt_setstep(file,step)
err=h5pt_readdata_i8(file,"id",ID)
...
</pre>
<hr>
<a name="DatasetsInfo"><h2>Reading the Number and Names of Datasets</h2></a>
<P>
H5Part provides funtions to find out how many datasets are stored at a particular timestep
and what their names are if you don't know what they are a-priori.
</P>
<b>FORTRAN Prototypes</b><br>
<code>INTEGER h5pt_getndatasets</code><br>
<code>FUNCTION h5pt_getndatasets(filehandle)<br>
in INTEGER*8 filehandle : an open filehandle<br>
returns INTEGER*8 : number of datasets stored per timestep</code><br>
<b>Example Use</b><br>
<pre>
include 'H5Part.inc'
INTEGER*8 file
INTEGER ndata
...
call h5pt_setstep(file,1)
ndata = h5pt_getndatasets(file)
...
</pre>
<b>FORTRAN Prototypes</b><br>
<code>INTEGER h5pt_getdatasetname</code><br>
<code>FUNCTION h5pt_getdatasetname(filehandle,index,name)<br>
in INTEGER*8 filehandle : an open filehandle<br>
in INTEGER index : Index for a given dataset name<br>
out CHARACTER name(*) returns the name of the dataset at that index<br>
returns INTEGER, 1 on success 0 on failure.</code><br>
<b>Example Use</b><br>
<pre>
include 'H5Part.inc'
INTEGER*8 file
INTEGER err
CHARACTER,ALLOCATABLE:: name(:)
...
err=h5pt_getdatasetname(file, 1, name)
...
</pre>
<hr>
<a name="AttributesInfo">
<h2>Attributes Interface</h2></a>
<P>
In the current H5Part implemtation there are two types of attributes: file attributes which are bound to the file
and step attributes which are bound to the current timestep. You
must set the timestep explicitly before writing the attributes (just
as you must do when you write a new dataset. Currently there are no
attributes that are bound to a particular data array, but this could
easily be done if required.
</P>
<b>FORTRAN Prototypes</b><br>
<code>INTEGER h5pt_getnstepattribs</code><br>
<code>FUNCTION h5pt_getnstepattribs(filehandle)<br>
in INTEGER*8 filehandle : an open filehandle<br>
returns INTEGER : number of attributes bound to this particular step<br>
</code>
<br>
<code>INTEGER h5pt_getnfileattribs</code><br>
<code>FUNCTION h5pt_getnfileattribs(filehandle)<br>
in INTEGER*8 filehandle : an open filehandle<br>
returns INTEGER : number of attributes bound to the file<br>
</code>
<br>
<code>INTEGER h5pt_getstepattribinfo</code><br>
<code>FUNCTION h5pt_getstepattribinfo(filehandle,idx,attribname,nelem)<br>
in INTEGER*8 filehandle : an open filehandle<br>
in INTEGER idx : index of the attribute being queried<br>
out CHARACTER name(*) : The name of the attribute<br>
out INTEGER nelem : Number of elements in the attrib array<br>
returns INTEGER, 1 on success 0 on failure.<br>
</code>
<br>
<code>INTEGER h5pt_getfileattribinfo</code><br>
<code>FUNCTION h5pt_getfileattribinfo(filehandle,idx,attribname,nelem)<br>
in INTEGER*8 filehandle : an open filehandle<br>
in INTEGER idx : index of the attribute being queried<br>
out CHARACTER name(*) : The name of the attribute<br>
out INTEGER nelem : Number of elements in the attrib array<br>
returns INTEGER, 1 on success 0 on failure.
</code>
<br>
<hr>
<a name="WriteAttribs">
<h2>Writing Attributes</h2>
</a>
<P>
An attribute can be bound to the file or after setting the time step to this time step.
</P>
<b>FORTRAN Prototypes</b><br>
<code>INTEGER h5pt_writefileattrib_r8</code><br>
<code>
FUNCTION h5pt_writefileattrib_r8(filehandle,name,attrib,nelem)<br>
in INTEGER*8 filehandle : an open filehandle<br>
in CHARACTER name(*) : The name of the attribute<br>
in REAL*8 attrib(*) : The array of data to write into the attribute<br>
in INTEGER nelem : Number of elements in the attrib array<br>
returns INTEGER, 1 on success 0 on failure<br>
</code>
<br>
<code>INTEGER h5pt_writefileattrib_i8</code><br>
<code>FUNCTION h5pt_writefileattrib_i8(filehandle,name,attrib,nelem)<br>
in INTEGER*8 filehandle : The filehandle<br>
in CHARACTER name(*) : The name of the attribute<br>
in INTEGER*8 attrib(*) : The array of data to write into the attribute<br>
in INTEGER nelem : Number of elements in the attrib array<br>
returns INTEGER, 1 on success 0 on failure<br>
</code>
<br>
<code>INTEGER h5pt_writefileattrib_string</code><br>
<code>FUNCTION h5pt_writefileattrib_string(filehandle,name,string)<br>
in INTEGER*8 filehandle : an open filehandle<br>
in CHARACTER name(*) : The name of the attribute<br>
in CHARACTER*8 attrib(*) : The array of data to write into the attribute<br>
returns INTEGER, 1 on success 0 on failure<br>
</code>
<br>
<code>INTEGER h5pt_writestepattrib_r8</code><br>
<code>FUNCTION h5pt_writestepattrib_r8(filehandle,name,attrib,nelem)<br>
in INTEGER*8 filehandle : an open filehandle<br>
in CHARACTER name(*) : The name of the attribute<br>
in REAL*8 attrib(*) : The array of data to write into the attribute<br>
in INTEGER nelem : Number of elements in the attrib array
returns INTEGER, 1 on success 0 on failure<br>
</code>
<br>
<code>INTEGER h5pt_writestepattrib_i8</code><br>
<code>FUNCTION h5pt_writestepattrib_i8(filehandle,name,attrib,nelem)<br>
in INTEGER*8 filehandle : an open filehandle<br>
in CHARACTER name(*) : The name of the attribute<br>
in INTEGER*8 attrib(*) : The array of data to write into the attribute<br>
in INTEGER nelem : Number of elements in the attrib array<br>
returns INTEGER, 1 on success 0 on failure<br>
</code>
<br>
<code>INTEGER h5pt_writestepattrib_string</code><br>
<code>FUNCTION h5pt_writestepattrib_string(filehandle,name,string)<br>
in INTEGER*8 filehandle : an open filehandle<br>
in CHARACTER name(*) : The name of the attribute<br>
in CHARACTER*8 attrib(*) : The array of data to write into the attribute<br>
returns INTEGER, 1 on success 0 on failure<br>
</code>
<b>Example Use</b><br>
<pre>
include 'H5Part.inc'
INTEGER*8 file
REAL*8 REALTIME
INTEGER err
...
err=h5pt_writefileattrib_string(file,"Annotation","Testing 1 2 3")
err=h5pt_writestepattrib_r8(file,"RealTime",REALTIME,1)
...
</pre>
<hr>
<a name="ReadAttribs">
<h2>Reading Attributes</h2>
</a>
<P>
As with the writing of attributes, there are two basic reading interfaces one that reads file bound attributes and one that reads
step bound attributes. If the step is not set the current one will be used.
</P>
<b>FORTRAN Prototypes</b><br>
<code>INTEGER h5pt_readstepattrib</code><br>
<code>FUNCTION h5pt_readstepattrib(filehandle,name,data)<br>
in INTEGER*8 filehandle : an open filehandle<br>
in CHARACTER attributename(*) : name of the attribute to read<br>
out <anytype> data(*) : the attribute data will be read into this array<br>
returns INTEGER, 1 on success 0 on failure<br>
</code>
<br>
<code>INTEGER h5pt_readfileattrib</code><br>
<code>FUNCTION h5pt_readfileattrib(filehandle,name,data)<br>
in INTEGER*8 filehandle an open filehandle<br>
in CHARACTER attributename(*) : name of the attribute to read<br>
out <anytype> data(*) : the attribute data will be read into this array<br>
returns INTEGER, 1 on success 0 on failure<br>
</code>
<b>Example Use</b><br>
<pre>
include 'H5Part.inc'
INTEGER*8 file
REAL*8 REALTIME
...
call h5pt_setstep(file,0)
err=h5pt_readstepattrib(file,"RealTime",data)
...
</pre>
</div>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 KiB

-121
View File
@@ -1,121 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>H5Part: a Portable High Performance Parallel Data Interface to HDF5</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="keywords" content="scientific visualization">
<meta name="sitemap" content="put a brief descriptive phrase here that will show up in the site map:foo">
<div id="maincenter">
<font face="arial,helvetica"><h1>H5Part: a Portable High Performance Parallel Data Interface to HDF5</h1></font>
<!--<h2><font color="red"> THESE PAGES ARE UNDER CONSTRUCTION, September 2006</h2></font>-->
<font face="arial,helvetica" color="#555588"><h2>Motivation</h2></font>
<P>
<TABLE>
<TR>
<TD>
<a href="collision_6.png"><img src="collision_6.s.png" width=300 height=300></a>
</TD
></TR>
<TR>
<TD>
Beam-beam collision simulation.
</TD>
</TR>
</TABLE>
</P>
<P>
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.<p>
</P>
<P>
H5Part is a very simple data storage schema and provides an
API that simplifies the reading/writing of the data to the HDF5
file format. An important foundation for a stable visualization and data
analysis environment is a stable and portable file storage format and
its associated APIs. The presence of a "common file storage format,"
including associated APIs, will help foster a fundamental level of
interoperability across the project's software infrastructure. It will
also help ensure that key data analysis capabilities are present
during the earliest phases of the software development effort.
</P>
<P>
H5Part is built on top of the <a href="http://hdf.ncsa.uiuc.edu/HDF5">HDF5 (Hierarchical Data Format).</a>
HDF5 offers a self-describing machine-independent
binary file format that supports scalable parallel I/O
performance for MPI codes on a variety of supercomputing
systems, and works equally well on laptop computers. The API is
available for C, C++, and Fortran codes. The H5Part file format and APIs
enable disparate research groups with different simulation
implementations to transparently share datasets and data
analysis tools. For instance, the common file format will enable
groups that depend on completely different simulation
implementations to share data analysis tools.
</P>
<font face="arial,helvetica" color="#555588"><h2>H5Part file organization and API</h2></font>
<P>
The proposed file storage format uses HDF5 for the lowlevel
file storage and a simple API to provide a high-level
interface to that file format. A programmer can either use
the H5Part API to access the data files or write directly to
the file format using some simple conventions for organizing
and naming the objects stored in the file.
</P>
<P>
In order to store Particle Data in the HDF5 file format,
we have formalized the hierarchical arrangement of the
datasets and naming conventions for the groups and associated
datasets. The sample H5Part API formally encodes
these conventions in order to provide a simple and uniform
way to access these files from C, C++, and Fortran codes.
The API makes it easier to write very portable data adaptors
for visualization tools in order to expand the number of
tools available to access the data. Even so, anyone can use
the HDF5 h5ls utility to examine the organization of the
H5Part files and even write their own HDF5-based interface
for reading and writing the file format. The standards
offered by the sample API are completely independent of
the standard for organizing data within the file.The file
format supports the storage of multiple timesteps
of datasets that contain multiple fields.
</P>
<!--
<font face="arial,helvetica" color="#555588"><h2>Requirements Specification</h2></font>
<UL>
<LI><a href="H5PartSpecs.html">H5Part API specifications
</UL>
</a>
-->
<font face="arial,helvetica" color="#555588"><h2>Downloading and Installing H5Part</h2></font>
<UL>
<LI><a href="Downloading.html">Downloading HDF5 and H5Part
<LI><a href="BuildingHDF5.html">Building the HDF5 Library</a>
<LI><a href="Building.html">Building the H5Part Library</a>
</UL>
<font face="arial,helvetica" color="#555588"><h2>Bindings</h2></font>
<UL>
<LI><a href="UsingC.html">Using the C/C++ interface</a>
<LI><a href="UsingF.html">Using the F77/F90 interface</a>
<LI><a href="InternalLayout.html">Logical Internal HDF5 File</a>
<LI><a href="H5PartTools.html">H5Part Utility Tools</a>
<LI><a href="ReferencePages/index.html">Reference Manual</a> (Note: Requires doxygen
to be run in the directory /doc)
</UL>
<font face="arial,helvetica" color="#555588"><h2>H5Part Visualization Tools</h2></font>
<UL>
<!--<LI><a href="H5PartExpress.html">H5Part Express Reader</a>-->
<LI><a href="H5PartVisIt.html">H5Part VisIt Reader</a>
<!--<LI><a href="H5PartIDL.html">H5Part IDL Reader</a>-->
<LI><a href="http://www.cscs.ch/a-display.php?id=170">H5Part sparticles Reader: developed at CSCS, Switzerland</a>
<LI><a href="http://vis.lbl.gov/Vignettes/PartView/index.html">PartView Visualization Application</a>
</UL>
</div>
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

+601 -234
View File
File diff suppressed because it is too large Load Diff
+66 -146
View File
@@ -12,25 +12,25 @@ extern "C" {
h5part_int64_t h5part_int64_t
H5BlockDefine3DFieldLayout ( H5BlockDefine3DFieldLayout (
H5PartFile *f, /*!< file handle */ H5PartFile *f,
const h5part_int64_t i_start, /*!< start index of i */ const h5part_int64_t i_start,
const h5part_int64_t i_end, /*!< end index of i */ const h5part_int64_t i_end,
const h5part_int64_t j_start, /*!< start index of j */ const h5part_int64_t j_start,
const h5part_int64_t j_end, /*!< end index of j */ const h5part_int64_t j_end,
const h5part_int64_t k_start, /*!< start index of k */ const h5part_int64_t k_start,
const h5part_int64_t k_end /*!< end index of k */ const h5part_int64_t k_end
); );
h5part_int64_t h5part_int64_t
H5Block3dGetPartitionOfProc ( H5Block3dGetPartitionOfProc (
H5PartFile *f, /*!< file handle */ H5PartFile *f,
const h5part_int64_t proc, const h5part_int64_t proc,
h5part_int64_t *i_start, /*!< start index of i */ h5part_int64_t *i_start,
h5part_int64_t *i_end, /*!< end index of i */ h5part_int64_t *i_end,
h5part_int64_t *j_start, /*!< start index of j */ h5part_int64_t *j_start,
h5part_int64_t *j_end, /*!< end index of j */ h5part_int64_t *j_end,
h5part_int64_t *k_start, /*!< start index of k */ h5part_int64_t *k_start,
h5part_int64_t *k_end /*!< end index of k */ h5part_int64_t *k_end
); );
h5part_int64_t h5part_int64_t
@@ -53,6 +53,27 @@ H5Block3dGetProcOf (
h5part_int64_t k h5part_int64_t k
); );
h5part_int64_t
H5Block3dWriteScalarFieldFloat64 (
H5PartFile *f,
const char *name,
const h5part_float64_t *data
);
h5part_int64_t
H5Block3dWriteScalarFieldFloat32 (
H5PartFile *f,
const char *name,
const h5part_float32_t *data
);
h5part_int64_t
H5Block3dWriteScalarFieldInt64 (
H5PartFile *f,
const char *name,
const h5part_int64_t *data
);
h5part_int64_t h5part_int64_t
H5Block3dWriteScalarField ( H5Block3dWriteScalarField (
H5PartFile *f, H5PartFile *f,
@@ -60,6 +81,27 @@ H5Block3dWriteScalarField (
const h5part_float64_t *data const h5part_float64_t *data
); );
h5part_int64_t
H5Block3dReadScalarFieldFloat64 (
H5PartFile *f,
const char *name,
h5part_float64_t *data
);
h5part_int64_t
H5Block3dReadScalarFieldFloat32 (
H5PartFile *f,
const char *name,
h5part_float32_t *data
);
h5part_int64_t
H5Block3dReadSclarFieldInt64 (
H5PartFile *f,
const char *name,
h5part_int64_t *data
);
h5part_int64_t h5part_int64_t
H5Block3dReadScalarField ( H5Block3dReadScalarField (
H5PartFile *f, H5PartFile *f,
@@ -132,20 +174,20 @@ H5Block3dSetFieldSpacing (
h5part_int64_t h5part_int64_t
H5Block3dWrite3dVectorField ( H5Block3dWrite3dVectorField (
H5PartFile *f, /*!< file handle */ H5PartFile *f,
const char *name, /*!< name of the data set */ const char *name,
const h5part_float64_t *xval, /*!< array of x component data */ const h5part_float64_t *xval,
const h5part_float64_t *yval, /*!< array of y component data */ const h5part_float64_t *yval,
const h5part_float64_t *zval /*!< array of z component data */ const h5part_float64_t *zval
); );
h5part_int64_t h5part_int64_t
H5Block3dRead3dVectorField ( H5Block3dRead3dVectorField (
H5PartFile *f, /*!< file handle */ H5PartFile *f,
const char *name, /*!< name of the data set */ const char *name,
h5part_float64_t *xval, /*!< array of x component data */ h5part_float64_t *xval,
h5part_float64_t *yval, /*!< array of y component data */ h5part_float64_t *yval,
h5part_float64_t *zval /*!< array of z component data */ h5part_float64_t *zval
); );
h5part_int64_t h5part_int64_t
@@ -196,128 +238,6 @@ H5BlockHasFieldData (
H5PartFile *f H5PartFile *f
); );
/*!
Checks if the block of the actual time step is refined i.e. if we
have a patch
\return \c 1 if we have a patch, otherwise \c 0
*/
h5part_int64_t
H5BlockIsPatch (
H5PartFile *f, /*!< file handle */
const char *name /*!< name of the data set */
);
/*!
return the maximum level refinement of refinement at the current
time step
\return number or error code
*/
h5part_int64_t
H5BlockGetMaxRefinementLevel (
H5PartFile *f, /*!< file handle */
const char *name /*!< name of the data set */
);
/*!
Write the mesh spacing for the active (current) block
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5BlockSetMeshSpacing (
H5PartFile *f, /*!< file handle */
char *name, /*!< name of the data set */
h5part_float64_t dx, /*!< mesh spacing in x */
h5part_float64_t dy, /*!< mesh spacing in y */
h5part_float64_t dz /*!< mesh spacing in z */
);
/*==========================================================================*/
/*
The following reflects the fact that we have fields which are decomposed
into modes.
Augment the field name with the mode number and use this name to store
the field. For the mode freqency use the same procedure.
*/
/*!
Read the number of stored modes at actual timestep
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5BlockGetNumberOfModes (
H5PartFile *f, /*!< file handle */
char *name /*!< name of the data set */
);
/*!
Set the number of stored modes at actual timestep
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5BlockSetNumberOfModes (
H5PartFile *f, /*!< file handle */
char *name, /*!< name of the data set */
int modes /*!< the number of modes */
);
/*!
Write the quality factor for a given mode
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5BlockSetQFactor (
H5PartFile *f, /*!< file handle */
char *name, /*!< name of the data set */
int mode, /*!< the mode number of the field */
h5part_float64_t Q /*!< the quality factor */
);
/*!
Write the S-parameters for a given mode
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5BlockSetSParams (
H5PartFile *f, /*!< file handle */
char *name, /*!< name of the data set */
int mode, /*!< the mode number of the field */
h5part_float64_t **s /*!< S-parameters */
);
/*!
Read the quality factor for a given mode
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5BlockGetQFactor (
H5PartFile *f, /*!< file handle */
char *name, /*!< name of the data set */
int mode, /*!< the mode number of the field */
h5part_float64_t *Q /*!< the quality factor */
);
/*!
Read the S-parameters for a given mode
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5BlockGetSParams (
H5PartFile *f, /*!< file handle */
char *name, /*!< name of the data set */
int mode, /*!< the mode number of the field */
h5part_float64_t **s /*!< S-parameters */
);
#ifdef __cplusplus #ifdef __cplusplus
} }
+96
View File
@@ -71,6 +71,18 @@
#define h5bl_has_fielddata F77NAME ( \ #define h5bl_has_fielddata F77NAME ( \
h5bl_has_fielddata_, \ h5bl_has_fielddata_, \
H5BL_HAS_FIELDDATA ) H5BL_HAS_FIELDDATA )
#define h5bl_3d_set_field_spacing F77NAME ( \
h5bl_3d_set_field_spacing_, \
H5BL_3D_SET_FIELD_SPACING )
#define h5bl_3d_get_field_spacing F77NAME ( \
h5bl_3d_get_field_spacing_, \
H5BL_3D_GET_FIELD_SPACING )
#define h5bl_3d_set_field_origin F77NAME ( \
h5bl_3d_set_field_origin_, \
H5BL_3D_SET_FIELD_ORIGIN )
#define h5bl_3d_get_field_origin F77NAME ( \
h5bl_3d_get_field_origin_, \
H5BL_3D_GET_FIELD_origin )
#endif #endif
h5part_int64_t h5part_int64_t
@@ -483,3 +495,87 @@ h5bl_has_fielddata (
return H5BlockHasFieldData ( filehandle ); return H5BlockHasFieldData ( filehandle );
} }
h5part_int64_t
h5b_3d_get_field_spacing (
h5part_int64_t *f,
const char *field_name,
h5part_float64_t *x,
h5part_float64_t *y,
h5part_float64_t *z,
const int l_field_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
h5part_int64_t herr = H5Block3dGetFieldSpacing (
filehandle, field_name2, x, y, z );
free ( field_name2 );
return herr;
}
h5part_int64_t
h5b_3d_set_field_spacing (
h5part_int64_t *f,
const char *field_name,
const h5part_float64_t *x,
const h5part_float64_t *y,
const h5part_float64_t *z,
const int l_field_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
h5part_int64_t herr = H5Block3dSetFieldSpacing (
filehandle, field_name2, *x, *y, *z );
free ( field_name2 );
return herr;
}
h5part_int64_t
h5b_3d_get_field_origin (
h5part_int64_t *f,
const char *field_name,
h5part_float64_t *x,
h5part_float64_t *y,
h5part_float64_t *z,
const int l_field_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
h5part_int64_t herr = H5Block3dGetFieldOrigin (
filehandle, field_name2, x, y, z );
free ( field_name2 );
return herr;
}
h5part_int64_t
h5b_3d_set_field_origin (
h5part_int64_t *f,
const char *field_name,
const h5part_float64_t *x,
const h5part_float64_t *y,
const h5part_float64_t *z,
const int l_field_name
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name );
h5part_int64_t herr = H5Block3dSetFieldOrigin (
filehandle, field_name2, *x, *y, *z );
free ( field_name2 );
return herr;
}
+32
View File
@@ -141,4 +141,36 @@
INTEGER*8, INTENT(IN) :: filehandle INTEGER*8, INTENT(IN) :: filehandle
END FUNCTION END FUNCTION
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
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
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
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
END INTERFACE END INTERFACE
+1
View File
@@ -18,6 +18,7 @@ struct H5BlockStruct {
struct H5BlockPartition *user_layout; struct H5BlockPartition *user_layout;
struct H5BlockPartition *write_layout; struct H5BlockPartition *write_layout;
int have_layout; int have_layout;
hsize_t chunk[3];
hid_t shape; hid_t shape;
hid_t memshape; hid_t memshape;
+290 -57
View File
@@ -78,11 +78,18 @@ Last modified on April 19, 2007.
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> /* va_arg - System dependent ?! */ #include <stdarg.h> /* va_arg - System dependent ?! */
#include <string.h> #include <string.h>
#include <unistd.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <hdf5.h> #include <hdf5.h>
#ifndef WIN32
#include <unistd.h>
#else /* WIN32 */
#include <io.h>
#define open _open
#define close _close
#endif /* WIN32 */
#include "H5PartTypes.h" #include "H5PartTypes.h"
#include "H5Part.h" #include "H5Part.h"
#include "H5PartPrivate.h" #include "H5PartPrivate.h"
@@ -91,7 +98,7 @@ Last modified on April 19, 2007.
/********* Private Variable Declarations *************/ /********* Private Variable Declarations *************/
static unsigned _debug = 0; static unsigned _debug = 0;
static h5part_int64_t _errno = H5PART_SUCCESS; static h5part_int64_t _h5part_errno = H5PART_SUCCESS;
static h5part_error_handler _err_handler = H5PartReportErrorHandler; static h5part_error_handler _err_handler = H5PartReportErrorHandler;
static char *__funcname = "NONE"; static char *__funcname = "NONE";
@@ -107,8 +114,14 @@ _file_is_valid (
const H5PartFile *f const H5PartFile *f
); );
/*
error handler for hdf5
*/
static herr_t static herr_t
_h5_error_handler ( _h5_error_handler (
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
hid_t,
#endif
void * void *
); );
@@ -125,7 +138,7 @@ _H5Part_open_file (
HANDLE_H5PART_INIT_ERR; HANDLE_H5PART_INIT_ERR;
return NULL; return NULL;
} }
_errno = H5PART_SUCCESS; _h5part_errno = H5PART_SUCCESS;
H5PartFile *f = NULL; H5PartFile *f = NULL;
f = (H5PartFile*) malloc( sizeof (H5PartFile) ); f = (H5PartFile*) malloc( sizeof (H5PartFile) );
@@ -144,11 +157,15 @@ _H5Part_open_file (
f->xfer_prop = f->create_prop = f->access_prop = H5P_DEFAULT; f->xfer_prop = f->create_prop = f->access_prop = H5P_DEFAULT;
#ifdef PARALLEL_IO
if ( f_parallel ) { if ( f_parallel ) {
#ifdef PARALLEL_IO
/* for the SP2... perhaps different for linux */ /* for the SP2... perhaps different for linux */
MPI_Info info = MPI_INFO_NULL; MPI_Info info = MPI_INFO_NULL;
/* ks: IBM_large_block_io */
MPI_Info_create(&info);
MPI_Info_set(info, "IBM_largeblock_io", "true" );
if (MPI_Comm_size (comm, &f->nprocs) != MPI_SUCCESS) { if (MPI_Comm_size (comm, &f->nprocs) != MPI_SUCCESS) {
HANDLE_MPI_COMM_SIZE_ERR; HANDLE_MPI_COMM_SIZE_ERR;
goto error_cleanup; goto error_cleanup;
@@ -158,7 +175,8 @@ _H5Part_open_file (
goto error_cleanup; goto error_cleanup;
} }
f->pnparticles = malloc (f->nprocs * sizeof (h5part_int64_t)); f->pnparticles =
(h5part_int64_t*) malloc (f->nprocs * sizeof (h5part_int64_t));
if (f->pnparticles == NULL) { if (f->pnparticles == NULL) {
HANDLE_H5PART_NOMEM_ERR; HANDLE_H5PART_NOMEM_ERR;
goto error_cleanup; goto error_cleanup;
@@ -170,8 +188,17 @@ _H5Part_open_file (
goto error_cleanup; goto error_cleanup;
} }
if (f->myproc == 0) {
#ifdef H5PART_MPIPOSIX
_H5Part_print_info ( "Activating MPI-POSIX VFD" );
}
if (H5Pset_fapl_mpiposix (f->access_prop, comm, 0) < 0) {
#else
_H5Part_print_info ( "Activating MPI-IO VFD" );
}
if (H5Pset_fapl_mpio (f->access_prop, comm, info) < 0) { if (H5Pset_fapl_mpio (f->access_prop, comm, info) < 0) {
HANDLE_H5P_SET_FAPL_MPIO_ERR; #endif
HANDLE_H5P_SET_FAPL_ERR;
goto error_cleanup; goto error_cleanup;
} }
@@ -193,13 +220,16 @@ _H5Part_open_file (
} }
f->comm = comm; f->comm = comm;
MPI_Info_free(&info);
#endif
} else { } else {
f->pnparticles = 0; f->comm = 0;
f->comm = MPI_COMM_WORLD;
f->nprocs = 1; f->nprocs = 1;
f->myproc = 0; f->myproc = 0;
f->pnparticles =
(h5part_int64_t*) malloc (f->nprocs * sizeof (h5part_int64_t));
} }
#endif
if ( flags == H5PART_READ ) { if ( flags == H5PART_READ ) {
f->file = H5Fopen (filename, H5F_ACC_RDONLY, f->access_prop); f->file = H5Fopen (filename, H5F_ACC_RDONLY, f->access_prop);
} }
@@ -366,7 +396,7 @@ H5PartCloseFile (
SET_FNAME ( "H5PartCloseFile" ); SET_FNAME ( "H5PartCloseFile" );
herr_t r = 0; herr_t r = 0;
_errno = H5PART_SUCCESS; _h5part_errno = H5PART_SUCCESS;
CHECK_FILEHANDLE ( f ); CHECK_FILEHANDLE ( f );
@@ -419,7 +449,7 @@ H5PartCloseFile (
} }
free( f ); free( f );
return _errno; return _h5part_errno;
} }
/*============== File Writing Functions ==================== */ /*============== File Writing Functions ==================== */
@@ -434,7 +464,7 @@ H5PartDefineStepName (
if( f->groupname_step == NULL ) { if( f->groupname_step == NULL ) {
return HANDLE_H5PART_NOMEM_ERR; return HANDLE_H5PART_NOMEM_ERR;
} }
f->stepno_width = width; f->stepno_width = (int)width;
return H5PART_SUCCESS; return H5PART_SUCCESS;
} }
@@ -524,6 +554,7 @@ H5PartSetNumParticles (
/* /*
acquire the number of particles to be written from each MPI process acquire the number of particles to be written from each MPI process
*/ */
r = MPI_Allgather ( r = MPI_Allgather (
&nparticles, 1, MPI_LONG_LONG, &nparticles, 1, MPI_LONG_LONG,
f->pnparticles, 1, MPI_LONG_LONG, f->pnparticles, 1, MPI_LONG_LONG,
@@ -546,9 +577,7 @@ H5PartSetNumParticles (
start[0] += f->pnparticles[i]; start[0] += f->pnparticles[i];
} }
/* compute total nparticles */
/* compute total nparticles */
total = 0; total = 0;
for (i=0; i < f->nprocs; i++) { for (i=0; i < f->nprocs; i++) {
total += f->pnparticles[i]; total += f->pnparticles[i];
@@ -600,15 +629,35 @@ _write_data (
"timestep %lld", "timestep %lld",
name, (long long)f->timestep ); name, (long long)f->timestep );
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
dataset_id = H5Dcreate2 (
f->timegroup,
name,
type,
f->shape,
H5P_DEFAULT,
H5P_DEFAULT,
H5P_DEFAULT );
#else
dataset_id = H5Dcreate ( dataset_id = H5Dcreate (
f->timegroup, f->timegroup,
name, name,
type, type,
f->shape, f->shape,
H5P_DEFAULT ); H5P_DEFAULT );
#endif
if ( dataset_id < 0 ) if ( dataset_id < 0 )
return HANDLE_H5D_CREATE_ERR ( name, f->timestep ); return HANDLE_H5D_CREATE_ERR ( name, f->timestep );
#ifdef COLLECTIVE_IO
herr = H5Dwrite (
dataset_id,
type,
f->memshape,
f->diskshape,
f->xfer_prop,
array );
#else
herr = H5Dwrite ( herr = H5Dwrite (
dataset_id, dataset_id,
type, type,
@@ -616,6 +665,8 @@ _write_data (
f->diskshape, f->diskshape,
H5P_DEFAULT, H5P_DEFAULT,
array ); array );
#endif
if ( herr < 0 ) return HANDLE_H5D_WRITE_ERR ( name, f->timestep ); if ( herr < 0 ) return HANDLE_H5D_WRITE_ERR ( name, f->timestep );
herr = H5Dclose ( dataset_id ); herr = H5Dclose ( dataset_id );
@@ -660,7 +711,7 @@ H5PartWriteDataFloat64 (
) { ) {
SET_FNAME ( "H5PartWriteDataFloat64" ); SET_FNAME ( "H5PartWriteDataFloat64" );
herr_t herr; h5part_int64_t herr;
CHECK_FILEHANDLE ( f ); CHECK_FILEHANDLE ( f );
CHECK_WRITABLE_MODE( f ); CHECK_WRITABLE_MODE( f );
@@ -672,6 +723,52 @@ H5PartWriteDataFloat64 (
return H5PART_SUCCESS; return H5PART_SUCCESS;
} }
/*!
\ingroup h5part_write
Write array of 32 bit floating point data to file.
After setting the number of particles with \c H5PartSetNumParticles() and
the current timestep using \c H5PartSetStep(), you can start writing datasets
into the file. Each dataset has a name associated with it (chosen by the
user) in order to facilitate later retrieval. The name of the dataset is
specified in the parameter \c name, which must be a null-terminated string.
There are no restrictions on naming of datasets, but it is useful to arrive
at some common naming convention when sharing data with other groups.
The writing routines also implicitly store the datatype of the array so that
the array can be reconstructed properly on other systems with incompatible
type representations.
All data that is written after setting the timestep is associated with that
timestep. While the number of particles can change for each timestep, you
cannot change the number of particles in the middle of a given timestep.
The data is committed to disk before the routine returns.
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5PartWriteDataFloat32 (
H5PartFile *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate array with */
const h5part_float32_t *array /*!< [in] Array to commit to disk */
) {
SET_FNAME ( "H5PartWriteDataFloat32" );
h5part_int64_t herr;
CHECK_FILEHANDLE ( f );
CHECK_WRITABLE_MODE( f );
CHECK_TIMEGROUP( f );
herr = _write_data ( f, name, (void*)array, H5T_NATIVE_FLOAT );
if ( herr < 0 ) return herr;
return H5PART_SUCCESS;
}
/*! /*!
\ingroup h5part_write \ingroup h5part_write
@@ -707,7 +804,7 @@ H5PartWriteDataInt64 (
SET_FNAME ( "H5PartOpenWriteDataInt64" ); SET_FNAME ( "H5PartOpenWriteDataInt64" );
herr_t herr; h5part_int64_t herr;
CHECK_FILEHANDLE ( f ); CHECK_FILEHANDLE ( f );
CHECK_WRITABLE_MODE( f ); CHECK_WRITABLE_MODE( f );
@@ -771,7 +868,11 @@ _H5Part_read_attrib (
hid_t mytype; hid_t mytype;
hsize_t nelem; hsize_t nelem;
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
attrib_id = H5Aopen ( id, attrib_name, H5P_DEFAULT );
#else
attrib_id = H5Aopen_name ( id, attrib_name ); attrib_id = H5Aopen_name ( id, attrib_name );
#endif
if ( attrib_id <= 0 ) return HANDLE_H5A_OPEN_NAME_ERR( attrib_name ); if ( attrib_id <= 0 ) return HANDLE_H5A_OPEN_NAME_ERR( attrib_name );
mytype = H5Aget_type ( attrib_id ); mytype = H5Aget_type ( attrib_id );
@@ -817,12 +918,22 @@ _H5Part_write_attrib (
if ( space_id < 0 ) if ( space_id < 0 )
return HANDLE_H5S_CREATE_SIMPLE_ERR ( attrib_nelem ); return HANDLE_H5S_CREATE_SIMPLE_ERR ( attrib_nelem );
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
attrib_id = H5Acreate2 (
id,
attrib_name,
attrib_type,
space_id,
H5P_DEFAULT,
H5P_DEFAULT );
#else
attrib_id = H5Acreate ( attrib_id = H5Acreate (
id, id,
attrib_name, attrib_name,
attrib_type, attrib_type,
space_id, space_id,
H5P_DEFAULT ); H5P_DEFAULT );
#endif
if ( attrib_id < 0 ) return HANDLE_H5A_CREATE_ERR ( attrib_name ); if ( attrib_id < 0 ) return HANDLE_H5A_CREATE_ERR ( attrib_name );
herr = H5Awrite ( attrib_id, attrib_type, attrib_value); herr = H5Awrite ( attrib_id, attrib_type, attrib_value);
@@ -852,7 +963,7 @@ _H5Part_get_attrib_info (
hid_t mytype; hid_t mytype;
hid_t space_id; hid_t space_id;
attrib_id = H5Aopen_idx ( id, attrib_idx ); attrib_id = H5Aopen_idx ( id, (unsigned int)attrib_idx );
if ( attrib_id < 0 ) return HANDLE_H5A_OPEN_IDX_ERR ( attrib_idx ); if ( attrib_id < 0 ) return HANDLE_H5A_OPEN_IDX_ERR ( attrib_idx );
if ( attrib_nelem ) { if ( attrib_nelem ) {
@@ -869,7 +980,7 @@ _H5Part_get_attrib_info (
if ( attrib_name ) { if ( attrib_name ) {
herr = H5Aget_name ( herr = H5Aget_name (
attrib_id, attrib_id,
len_attrib_name, (size_t)len_attrib_name,
attrib_name ); attrib_name );
if ( herr < 0 ) return HANDLE_H5A_GET_NAME_ERR; if ( herr < 0 ) return HANDLE_H5A_GET_NAME_ERR;
} }
@@ -916,7 +1027,11 @@ H5PartWriteFileAttribString (
CHECK_FILEHANDLE ( f ); CHECK_FILEHANDLE ( f );
CHECK_WRITABLE_MODE( f ); CHECK_WRITABLE_MODE( f );
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
hid_t group_id = H5Gopen2(f->file,"/",H5P_DEFAULT);
#else
hid_t group_id = H5Gopen(f->file,"/"); hid_t group_id = H5Gopen(f->file,"/");
#endif
if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" ); if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" );
h5part_int64_t herr = _H5Part_write_attrib ( h5part_int64_t herr = _H5Part_write_attrib (
@@ -1002,7 +1117,7 @@ H5PartWriteStepAttrib (
SET_FNAME ( "H5PartWriteStepAttrib" ); SET_FNAME ( "H5PartWriteStepAttrib" );
herr_t herr; h5part_int64_t herr;
CHECK_FILEHANDLE ( f ); CHECK_FILEHANDLE ( f );
CHECK_WRITABLE_MODE( f ); CHECK_WRITABLE_MODE( f );
@@ -1011,7 +1126,7 @@ H5PartWriteStepAttrib (
herr = _H5Part_write_attrib ( herr = _H5Part_write_attrib (
f->timegroup, f->timegroup,
attrib_name, attrib_name,
attrib_type, (const hid_t)attrib_type,
attrib_value, attrib_value,
attrib_nelem ); attrib_nelem );
if ( herr < 0 ) return herr; if ( herr < 0 ) return herr;
@@ -1049,19 +1164,23 @@ H5PartWriteFileAttrib (
SET_FNAME ( "H5PartWriteFileAttrib" ); SET_FNAME ( "H5PartWriteFileAttrib" );
herr_t herr; h5part_int64_t herr;
hid_t group_id; hid_t group_id;
CHECK_FILEHANDLE ( f ); CHECK_FILEHANDLE ( f );
CHECK_WRITABLE_MODE ( f ); CHECK_WRITABLE_MODE ( f );
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
group_id = H5Gopen2(f->file,"/",H5P_DEFAULT);
#else
group_id = H5Gopen(f->file,"/"); group_id = H5Gopen(f->file,"/");
#endif
if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" ); if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" );
herr = _H5Part_write_attrib ( herr = _H5Part_write_attrib (
group_id, group_id,
attrib_name, attrib_name,
attrib_type, (const hid_t)attrib_type,
attrib_value, attrib_value,
attrib_nelem ); attrib_nelem );
if ( herr < 0 ) return herr; if ( herr < 0 ) return herr;
@@ -1113,7 +1232,11 @@ H5PartGetNumFileAttribs (
CHECK_FILEHANDLE ( f ); CHECK_FILEHANDLE ( f );
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
hid_t group_id = H5Gopen2 ( f->file, "/", H5P_DEFAULT );
#else
hid_t group_id = H5Gopen ( f->file, "/" ); hid_t group_id = H5Gopen ( f->file, "/" );
#endif
if ( group_id < 0 ) HANDLE_H5G_OPEN_ERR ( "/" ); if ( group_id < 0 ) HANDLE_H5G_OPEN_ERR ( "/" );
nattribs = H5Aget_num_attrs ( group_id ); nattribs = H5Aget_num_attrs ( group_id );
@@ -1142,7 +1265,7 @@ h5part_int64_t
H5PartGetStepAttribInfo ( H5PartGetStepAttribInfo (
H5PartFile *f, /*!< [in] Handle to open file */ H5PartFile *f, /*!< [in] Handle to open file */
const h5part_int64_t attrib_idx,/*!< [in] Index of attribute to const h5part_int64_t attrib_idx,/*!< [in] Index of attribute to
get infos about */ get infos about */
char *attrib_name, /*!< [out] Name of attribute */ char *attrib_name, /*!< [out] Name of attribute */
const h5part_int64_t len_of_attrib_name, const h5part_int64_t len_of_attrib_name,
/*!< [in] length of buffer \c name */ /*!< [in] length of buffer \c name */
@@ -1151,7 +1274,7 @@ H5PartGetStepAttribInfo (
) { ) {
SET_FNAME ( "H5PartGetStepAttribInfo" ); SET_FNAME ( "H5PartGetStepAttribInfo" );
hid_t herr; h5part_int64_t herr;
CHECK_FILEHANDLE( f ); CHECK_FILEHANDLE( f );
@@ -1185,7 +1308,7 @@ h5part_int64_t
H5PartGetFileAttribInfo ( H5PartGetFileAttribInfo (
H5PartFile *f, /*!< [in] Handle to open file */ H5PartFile *f, /*!< [in] Handle to open file */
const h5part_int64_t attrib_idx,/*!< [in] Index of attribute to get const h5part_int64_t attrib_idx,/*!< [in] Index of attribute to get
infos about */ infos about */
char *attrib_name, /*!< [out] Name of attribute */ char *attrib_name, /*!< [out] Name of attribute */
const h5part_int64_t len_of_attrib_name, const h5part_int64_t len_of_attrib_name,
/*!< [in] length of buffer \c name */ /*!< [in] length of buffer \c name */
@@ -1195,11 +1318,15 @@ H5PartGetFileAttribInfo (
SET_FNAME ( "H5PartGetFileAttribInfo" ); SET_FNAME ( "H5PartGetFileAttribInfo" );
hid_t group_id; hid_t group_id;
herr_t herr; h5part_int64_t herr;
CHECK_FILEHANDLE( f ); CHECK_FILEHANDLE( f );
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
group_id = H5Gopen2(f->file,"/",H5P_DEFAULT);
#else
group_id = H5Gopen(f->file,"/"); group_id = H5Gopen(f->file,"/");
#endif
if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" ); if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" );
herr = _H5Part_get_attrib_info ( herr = _H5Part_get_attrib_info (
@@ -1233,7 +1360,7 @@ H5PartReadStepAttrib (
SET_FNAME ( "H5PartReadStepAttrib" ); SET_FNAME ( "H5PartReadStepAttrib" );
hid_t herr; h5part_int64_t herr;
CHECK_FILEHANDLE( f ); CHECK_FILEHANDLE( f );
@@ -1260,11 +1387,15 @@ H5PartReadFileAttrib (
SET_FNAME ( "H5PartReadFileAttrib" ); SET_FNAME ( "H5PartReadFileAttrib" );
hid_t group_id; hid_t group_id;
hid_t herr; h5part_int64_t herr;
CHECK_FILEHANDLE( f ); CHECK_FILEHANDLE( f );
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
group_id = H5Gopen2(f->file,"/",H5P_DEFAULT);
#else
group_id = H5Gopen(f->file,"/"); group_id = H5Gopen(f->file,"/");
#endif
if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" ); if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" );
herr = _H5Part_read_attrib ( group_id, attrib_name, attrib_value ); herr = _H5Part_read_attrib ( group_id, attrib_name, attrib_value );
@@ -1320,7 +1451,11 @@ _H5Part_set_step (
(long long)step, (long long)step,
(long long)(size_t) f ); (long long)(size_t) f );
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
f->timegroup = H5Gopen2 ( f->file, name, H5P_DEFAULT );
#else
f->timegroup = H5Gopen ( f->file, name ); f->timegroup = H5Gopen ( f->file, name );
#endif
if ( f->timegroup < 0 ) return HANDLE_H5G_OPEN_ERR( name ); if ( f->timegroup < 0 ) return HANDLE_H5G_OPEN_ERR( name );
} }
else { else {
@@ -1330,7 +1465,16 @@ _H5Part_set_step (
(long long)step, (long long)step,
(long long)(size_t) f ); (long long)(size_t) f );
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
f->timegroup = H5Gcreate2 (
f->file,
name,
0,
H5P_DEFAULT,
H5P_DEFAULT );
#else
f->timegroup = H5Gcreate ( f->file, name, 0 ); f->timegroup = H5Gcreate ( f->file, name, 0 );
#endif
if ( f->timegroup < 0 ) return HANDLE_H5G_CREATE_ERR ( name ); if ( f->timegroup < 0 ) return HANDLE_H5G_CREATE_ERR ( name );
} }
@@ -1380,13 +1524,13 @@ _H5Part_iteration_operator (
void *operator_data /*!< [in,out] data passed to the iterator */ void *operator_data /*!< [in,out] data passed to the iterator */
) { ) {
struct _iter_op_data *data = operator_data; struct _iter_op_data *data = (struct _iter_op_data*)operator_data;
herr_t herr; herr_t herr;
H5G_stat_t objinfo; H5G_stat_t objinfo;
if ( data->type != H5G_UNKNOWN ) { if ( data->type != H5G_UNKNOWN ) {
herr = H5Gget_objinfo ( group_id, member_name, 1, &objinfo ); herr = H5Gget_objinfo ( group_id, member_name, 1, &objinfo );
if ( herr < 0 ) return HANDLE_H5G_GET_OBJINFO_ERR ( member_name ); if ( herr < 0 ) return (herr_t)HANDLE_H5G_GET_OBJINFO_ERR ( member_name );
if ( objinfo.type != data->type ) if ( objinfo.type != data->type )
return 0;/* don't count, continue iteration */ return 0;/* don't count, continue iteration */
@@ -1476,10 +1620,10 @@ _H5Part_get_object_name (
int iterator_idx = 0; int iterator_idx = 0;
memset ( &data, 0, sizeof ( data ) ); memset ( &data, 0, sizeof ( data ) );
data.stop_idx = idx; data.stop_idx = (hid_t)idx;
data.type = type; data.type = type;
data.name = obj_name; data.name = obj_name;
data.len = len_obj_name; data.len = (size_t)len_obj_name;
herr = H5Giterate ( group_id, group_name, &iterator_idx, herr = H5Giterate ( group_id, group_name, &iterator_idx,
_H5Part_iteration_operator, _H5Part_iteration_operator,
@@ -1492,6 +1636,34 @@ _H5Part_get_object_name (
return H5PART_SUCCESS; return H5PART_SUCCESS;
} }
/*!
\ingroup h5part_read
Query whether a particular step already exists in the file
\c f.
It works for both reading and writing of files
\return true or false
*/
h5part_int64_t
H5PartHasStep (
H5PartFile *f, /*!< [in] Handle to open file */
h5part_int64_t step /*!< [in] Step number to query */
) {
SET_FNAME ( "H5PartHasStep" );
CHECK_FILEHANDLE( f );
char name[128];
sprintf ( name, "%s#%0*lld", f->groupname_step, f->stepno_width, (long long) step );
herr_t herr = H5Gget_objinfo( f->file, name, 1, NULL );
return ( herr >= 0 );
}
/*! /*!
\ingroup h5part_read \ingroup h5part_read
@@ -1608,7 +1780,7 @@ H5PartGetDatasetInfo (
SET_FNAME ( "H5PartGetDatasetInfo" ); SET_FNAME ( "H5PartGetDatasetInfo" );
herr_t herr; h5part_int64_t herr;
hid_t dataset_id; hid_t dataset_id;
hid_t mytype; hid_t mytype;
char step_name[128]; char step_name[128];
@@ -1622,7 +1794,6 @@ H5PartGetDatasetInfo (
f->groupname_step, f->stepno_width, (long long) f->timestep ); f->groupname_step, f->stepno_width, (long long) f->timestep );
herr = _H5Part_get_object_name ( herr = _H5Part_get_object_name (
//f->timegroup,
f->file, f->file,
step_name, step_name,
H5G_DATASET, H5G_DATASET,
@@ -1634,7 +1805,11 @@ H5PartGetDatasetInfo (
*nelem = _H5Part_get_num_particles ( f ); *nelem = _H5Part_get_num_particles ( f );
if ( *nelem < 0 ) return *nelem; if ( *nelem < 0 ) return *nelem;
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
dataset_id = H5Dopen2 ( f->timegroup, dataset_name, H5P_DEFAULT );
#else
dataset_id = H5Dopen ( f->timegroup, dataset_name ); dataset_id = H5Dopen ( f->timegroup, dataset_name );
#endif
if ( dataset_id < 0 ) HANDLE_H5D_OPEN_ERR ( dataset_name ); if ( dataset_id < 0 ) HANDLE_H5D_OPEN_ERR ( dataset_name );
mytype = H5Dget_type ( dataset_id ); mytype = H5Dget_type ( dataset_id );
@@ -1660,10 +1835,8 @@ _get_diskshape_for_reading (
herr_t r; herr_t r;
CHECK_FILEHANDLE( f );
hid_t space = H5Dget_space(dataset); hid_t space = H5Dget_space(dataset);
if ( space < 0 ) return HANDLE_H5D_GET_SPACE_ERR; if ( space < 0 ) return (hid_t)HANDLE_H5D_GET_SPACE_ERR;
if ( H5PartHasView(f) ){ if ( H5PartHasView(f) ){
hsize_t stride; hsize_t stride;
@@ -1685,13 +1858,13 @@ _get_diskshape_for_reading (
r = H5Sselect_hyperslab ( r = H5Sselect_hyperslab (
f->diskshape, H5S_SELECT_SET, f->diskshape, H5S_SELECT_SET,
&start, &stride, &count, NULL); &start, &stride, &count, NULL);
if ( r < 0 ) return HANDLE_H5S_SELECT_HYPERSLAB_ERR; if ( r < 0 ) return (hid_t)HANDLE_H5S_SELECT_HYPERSLAB_ERR;
} }
/* now we select a subset */ /* now we select a subset */
r = H5Sselect_hyperslab ( r = H5Sselect_hyperslab (
space,H5S_SELECT_SET, space,H5S_SELECT_SET,
&start, &stride, &count, NULL ); &start, &stride, &count, NULL );
if ( r < 0 ) return HANDLE_H5S_SELECT_HYPERSLAB_ERR; if ( r < 0 ) return (hid_t)HANDLE_H5S_SELECT_HYPERSLAB_ERR;
_H5Part_print_debug ( _H5Part_print_debug (
"Selection: range=%d:%d, npoints=%d s=%d", "Selection: range=%d:%d, npoints=%d s=%d",
@@ -1710,15 +1883,11 @@ _get_memshape_for_reading (
hid_t dataset hid_t dataset
) { ) {
hid_t r;
CHECK_FILEHANDLE( f );
if(H5PartHasView(f)) { if(H5PartHasView(f)) {
hsize_t dmax=H5S_UNLIMITED; hsize_t dmax=H5S_UNLIMITED;
hsize_t len = f->viewend - f->viewstart; hsize_t len = f->viewend - f->viewstart;
r = H5Screate_simple(1,&len,&dmax); hid_t r = H5Screate_simple(1,&len,&dmax);
if ( r < 0 ) return HANDLE_H5S_CREATE_SIMPLE_ERR ( len ); if ( r < 0 ) return (hid_t)HANDLE_H5S_CREATE_SIMPLE_ERR ( len );
return r; return r;
} }
else { else {
@@ -1752,7 +1921,11 @@ _H5Part_get_num_particles (
dataset_name, sizeof (dataset_name) ); dataset_name, sizeof (dataset_name) );
if ( herr < 0 ) return herr; if ( herr < 0 ) return herr;
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
dataset_id = H5Dopen2 ( f->timegroup, dataset_name, H5P_DEFAULT );
#else
dataset_id = H5Dopen ( f->timegroup, dataset_name ); dataset_id = H5Dopen ( f->timegroup, dataset_name );
#endif
if ( dataset_id < 0 ) if ( dataset_id < 0 )
return HANDLE_H5D_OPEN_ERR ( dataset_name ); return HANDLE_H5D_OPEN_ERR ( dataset_name );
@@ -2114,10 +2287,14 @@ _read_data (
hid_t memspace_id; hid_t memspace_id;
if ( f->timegroup < 0 ) { if ( f->timegroup < 0 ) {
herr = _H5Part_set_step ( f, f->timestep ); h5part_int64_t h5err = _H5Part_set_step ( f, f->timestep );
if ( herr < 0 ) return herr; if ( h5err < 0 ) return h5err;
} }
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
dataset_id = H5Dopen2 ( f->timegroup, name, H5P_DEFAULT );
#else
dataset_id = H5Dopen ( f->timegroup, name ); dataset_id = H5Dopen ( f->timegroup, name );
#endif
if ( dataset_id < 0 ) return HANDLE_H5D_OPEN_ERR ( name ); if ( dataset_id < 0 ) return HANDLE_H5D_OPEN_ERR ( name );
space_id = _get_diskshape_for_reading ( f, dataset_id ); space_id = _get_diskshape_for_reading ( f, dataset_id );
@@ -2126,6 +2303,7 @@ _read_data (
memspace_id = _get_memshape_for_reading ( f, dataset_id ); memspace_id = _get_memshape_for_reading ( f, dataset_id );
if ( memspace_id < 0 ) return (h5part_int64_t)memspace_id; if ( memspace_id < 0 ) return (h5part_int64_t)memspace_id;
#ifdef INDEPENDENT_IO
herr = H5Dread ( herr = H5Dread (
dataset_id, dataset_id,
type, type,
@@ -2135,6 +2313,18 @@ _read_data (
(get hyperslab if needed) */ (get hyperslab if needed) */
H5P_DEFAULT, /* ignore... its for parallel reads */ H5P_DEFAULT, /* ignore... its for parallel reads */
array ); array );
#else
herr = H5Dread (
dataset_id,
type,
memspace_id, /* shape/size of data in memory (the
complement to disk hyperslab) */
space_id, /* shape/size of data on disk
(get hyperslab if needed) */
f->xfer_prop, /* ignore... its for parallel reads */
array );
#endif
if ( herr < 0 ) return HANDLE_H5D_READ_ERR ( name, f->timestep ); if ( herr < 0 ) return HANDLE_H5D_READ_ERR ( name, f->timestep );
if ( space_id != H5S_ALL ) { if ( space_id != H5S_ALL ) {
@@ -2183,6 +2373,37 @@ H5PartReadDataFloat64 (
return H5PART_SUCCESS; return H5PART_SUCCESS;
} }
/*!
\ingroup h5part_read
Read array of 32 bit floating point data from file.
When retrieving datasets from disk, you ask for them
by name. There are no restrictions on naming of arrays,
but it is useful to arrive at some common naming
convention when sharing data with other groups.
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5PartReadDataFloat32 (
H5PartFile *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate dataset with */
h5part_float32_t *array /*!< [out] Array of data */
) {
SET_FNAME ( "H5PartReadDataFloat32" );
h5part_int64_t herr;
CHECK_FILEHANDLE( f );
herr = _read_data ( f, name, array, H5T_NATIVE_FLOAT );
if ( herr < 0 ) return herr;
return H5PART_SUCCESS;
}
/*! /*!
\ingroup h5part_read \ingroup h5part_read
@@ -2287,7 +2508,7 @@ H5PartSetVerbosityLevel (
h5part_int64_t level h5part_int64_t level
) { ) {
_debug = level; _debug = (unsigned int)level;
return H5PART_SUCCESS; return H5PART_SUCCESS;
} }
@@ -2331,7 +2552,7 @@ h5part_int64_t
H5PartGetErrno ( H5PartGetErrno (
void void
) { ) {
return _errno; return _h5part_errno;
} }
/*! /*!
@@ -2350,14 +2571,14 @@ H5PartReportErrorHandler (
... ...
) { ) {
_errno = eno; _h5part_errno = eno;
if ( _debug > 0 ) { if ( _debug > 0 ) {
va_list ap; va_list ap;
va_start ( ap, fmt ); va_start ( ap, fmt );
_H5Part_vprint_error ( fmt, ap ); _H5Part_vprint_error ( fmt, ap );
va_end ( ap ); va_end ( ap );
} }
return _errno; return _h5part_errno;
} }
/*! /*!
@@ -2374,7 +2595,7 @@ H5PartAbortErrorHandler (
... ...
) { ) {
_errno = eno; _h5part_errno = eno;
if ( _debug > 0 ) { if ( _debug > 0 ) {
va_list ap; va_list ap;
va_start ( ap, fmt ); va_start ( ap, fmt );
@@ -2382,7 +2603,7 @@ H5PartAbortErrorHandler (
vfprintf ( stderr, fmt, ap ); vfprintf ( stderr, fmt, ap );
fprintf ( stderr, "\n" ); fprintf ( stderr, "\n" );
} }
exit (-_errno); exit (-(int)_h5part_errno);
} }
/*! /*!
@@ -2394,7 +2615,11 @@ _init ( void ) {
herr_t r5; herr_t r5;
if ( ! __init ) { if ( ! __init ) {
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
r5 = H5Eset_auto2 ( H5E_DEFAULT, _h5_error_handler, NULL );
#else
r5 = H5Eset_auto ( _h5_error_handler, NULL ); r5 = H5Eset_auto ( _h5_error_handler, NULL );
#endif
if ( r5 < 0 ) return H5PART_ERR_INIT; if ( r5 < 0 ) return H5PART_ERR_INIT;
} }
__init = 1; __init = 1;
@@ -2403,10 +2628,18 @@ _init ( void ) {
/*! @} */ /*! @} */
static herr_t static herr_t
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
_h5_error_handler ( hid_t estack, void* unused ) {
#else
_h5_error_handler ( void* unused ) { _h5_error_handler ( void* unused ) {
#endif
if ( _debug >= 5 ) { if ( _debug >= 5 ) {
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
H5Eprint2 (H5E_DEFAULT,stderr);
#else
H5Eprint (stderr); H5Eprint (stderr);
#endif
} }
return 0; return 0;
} }
@@ -2418,7 +2651,7 @@ _vprint (
const char *fmt, const char *fmt,
va_list ap va_list ap
) { ) {
char *fmt2 = malloc( strlen ( prefix ) +strlen ( fmt ) + strlen ( __funcname ) + 16 ); char *fmt2 = (char*)malloc( strlen ( prefix ) +strlen ( fmt ) + strlen ( __funcname ) + 16 );
if ( fmt2 == NULL ) return; if ( fmt2 == NULL ) return;
sprintf ( fmt2, "%s: %s: %s\n", prefix, __funcname, fmt ); sprintf ( fmt2, "%s: %s: %s\n", prefix, __funcname, fmt );
vfprintf ( stderr, fmt2, ap ); vfprintf ( stderr, fmt2, ap );
@@ -2515,9 +2748,9 @@ _H5Part_print_debug (
void void
_H5Part_set_funcname ( _H5Part_set_funcname (
char * const fname const char * const fname
) { ) {
__funcname = fname; __funcname = (char* const) fname;
} }
const char * const char *
+26 -4
View File
@@ -1,16 +1,17 @@
#ifndef _H5Part_H_ #ifndef _H5Part_H_
#define _H5Part_H_ #define _H5Part_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <hdf5.h> #include <hdf5.h>
#ifdef PARALLEL_IO #ifdef PARALLEL_IO
#include <mpi.h> #include <mpi.h>
#endif #endif
#ifdef __cplusplus
extern "C" {
#endif
#include "H5PartTypes.h" #include "H5PartTypes.h"
@@ -81,6 +82,14 @@ H5PartWriteDataFloat64 (
const h5part_float64_t *array const h5part_float64_t *array
); );
h5part_int64_t
H5PartWriteDataFloat32 (
H5PartFile *f,
const char *name,
const h5part_float32_t *array
);
h5part_int64_t h5part_int64_t
H5PartWriteDataInt64 ( H5PartWriteDataInt64 (
H5PartFile *f, H5PartFile *f,
@@ -95,6 +104,12 @@ H5PartSetStep (
const h5part_int64_t step const h5part_int64_t step
); );
h5part_int64_t
H5PartHasStep (
H5PartFile *f,
const h5part_int64_t step
);
h5part_int64_t h5part_int64_t
H5PartGetNumSteps ( H5PartGetNumSteps (
H5PartFile *f H5PartFile *f
@@ -165,6 +180,13 @@ H5PartReadDataFloat64(
h5part_float64_t *array h5part_float64_t *array
); );
h5part_int64_t
H5PartReadDataFloat32(
H5PartFile *f,
const char *name,
h5part_float32_t *array
);
h5part_int64_t h5part_int64_t
H5PartReadDataInt64 ( H5PartReadDataInt64 (
H5PartFile *f, H5PartFile *f,
+8 -2
View File
@@ -38,7 +38,7 @@
"Called with bad filehandle." ); "Called with bad filehandle." );
#define HANDLE_H5PART_INIT_ERR \ #define HANDLE_H5PART_INIT_ERR \
(*_err_handler) ( \ (*_err_handler) ( \
_H5Part_get_funcname(), \ _H5Part_get_funcname(), \
H5PART_ERR_INIT, \ H5PART_ERR_INIT, \
"Cannot initialize H5Part." ); "Cannot initialize H5Part." );
@@ -258,13 +258,19 @@
"MPI: Cannot set data transfer mode." ); "MPI: Cannot set data transfer mode." );
#define HANDLE_H5P_SET_FAPL_MPIO_ERR \ #define HANDLE_H5P_SET_FAPL_ERR \
(*_err_handler) ( \ (*_err_handler) ( \
_H5Part_get_funcname(), \ _H5Part_get_funcname(), \
H5PART_ERR_HDF5, \ H5PART_ERR_HDF5, \
"Cannot store IO communicator information to the " \ "Cannot store IO communicator information to the " \
"file access property list."); "file access property list.");
#define HANDLE_H5P_SET_CHUNK_ERR \
(*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_HDF5, \
"Cannot set chunk dimensions." );
/* H5S: dataspace */ /* H5S: dataspace */
#define HANDLE_H5S_CREATE_SIMPLE_ERR( n ) \ #define HANDLE_H5S_CREATE_SIMPLE_ERR( n ) \
(*_err_handler) ( \ (*_err_handler) ( \
+37 -1
View File
@@ -20,12 +20,18 @@
#define h5pt_openw F77NAME ( \ #define h5pt_openw F77NAME ( \
h5pt_openw_, \ h5pt_openw_, \
H5PT_OPENW ) H5PT_OPENW )
#define h5pt_opena F77NAME ( \
h5pt_opena_, \
H5PT_OPENA )
#define h5pt_openr_par F77NAME ( \ #define h5pt_openr_par F77NAME ( \
h5pt_openr_par_, \ h5pt_openr_par_, \
H5PT_OPENR_PAR ) H5PT_OPENR_PAR )
#define h5pt_openw_par F77NAME ( \ #define h5pt_openw_par F77NAME ( \
h5pt_openw_par_, \ h5pt_openw_par_, \
H5PT_OPENW_PAR ) H5PT_OPENW_PAR )
#define h5pt_opena_par F77NAME ( \
h5pt_opena_par_, \
H5PT_OPENA_PAR )
#define h5pt_close F77NAME ( \ #define h5pt_close F77NAME ( \
h5pt_close_, \ h5pt_close_, \
H5PT_CLOSE) H5PT_CLOSE)
@@ -207,6 +213,20 @@ h5pt_openw (
return (h5part_int64_t)(size_t)f; return (h5part_int64_t)(size_t)f;
} }
h5part_int64_t
h5pt_opena (
const char *file_name,
const int l_file_name
) {
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
H5PartFile* f = H5PartOpenFile ( file_name2, H5PART_APPEND );
free ( file_name2 );
return (h5part_int64_t)(size_t)f;
}
#ifdef PARALLEL_IO #ifdef PARALLEL_IO
h5part_int64_t h5part_int64_t
h5pt_openr_par ( h5pt_openr_par (
@@ -224,7 +244,7 @@ h5pt_openr_par (
return (h5part_int64_t)(size_t)f; return (h5part_int64_t)(size_t)f;
} }
haddr_t h5part_int64_t
h5pt_openw_par ( h5pt_openw_par (
const char *file_name, const char *file_name,
MPI_Comm *comm, MPI_Comm *comm,
@@ -239,6 +259,22 @@ h5pt_openw_par (
free ( file_name2 ); free ( file_name2 );
return (h5part_int64_t)(size_t)f; return (h5part_int64_t)(size_t)f;
} }
h5part_int64_t
h5pt_opena_par (
const char *file_name,
MPI_Comm *comm,
const int l_file_name
) {
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
H5PartFile* f = H5PartOpenFileParallel (
file_name2, H5PART_APPEND, *comm );
free ( file_name2 );
return (h5part_int64_t)(size_t)f;
}
#endif #endif
h5part_int64_t h5part_int64_t
+11 -1
View File
@@ -10,8 +10,12 @@
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for writing CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for writing
END FUNCTION END FUNCTION
INTEGER*8 FUNCTION h5pt_opena ( filename )
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for appending
END FUNCTION
INTEGER*8 FUNCTION h5pt_openr_par ( filename, mpi_communicator ) INTEGER*8 FUNCTION h5pt_openr_par ( filename, mpi_communicator )
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for writing CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for reading
INTEGER, INTENT(IN) :: mpi_communicator ! the MPI_Communicator used by the program INTEGER, INTENT(IN) :: mpi_communicator ! the MPI_Communicator used by the program
END FUNCTION END FUNCTION
@@ -20,6 +24,12 @@
INTEGER, INTENT(IN) :: mpi_communicator ! the MPI_Communicator used by the program INTEGER, INTENT(IN) :: mpi_communicator ! the MPI_Communicator used by the program
END FUNCTION END FUNCTION
INTEGER*8 FUNCTION h5pt_opena_par ( filename, mpi_communicator )
CHARACTER(LEN=*), INTENT(IN) :: filename ! the filename to open for appending
INTEGER, INTENT(IN) :: mpi_communicator ! the MPI_Communicator used by the program
END FUNCTION
INTEGER*8 FUNCTION h5pt_close ( filehandle ) INTEGER*8 FUNCTION h5pt_close ( filehandle )
INTEGER*8, INTENT(IN) :: filehandle ! close this open filehandle INTEGER*8, INTENT(IN) :: filehandle ! close this open filehandle
END FUNCTION END FUNCTION
+1 -1
View File
@@ -42,7 +42,7 @@ _H5Part_iteration_operator (
void void
_H5Part_set_funcname ( _H5Part_set_funcname (
char * const fname const char * const fname
); );
const char * const char *
+4
View File
@@ -5,9 +5,13 @@
#ifndef _H5PARTTYPES_H_ #ifndef _H5PARTTYPES_H_
#define _H5PARTTYPES_H_ #define _H5PARTTYPES_H_
#ifdef WIN32
typedef __int64 int64_t;
#endif /* WIN32 */
typedef int64_t h5part_int64_t; typedef int64_t h5part_int64_t;
typedef double h5part_float64_t; typedef double h5part_float64_t;
typedef float h5part_float32_t;
typedef h5part_int64_t (*h5part_error_handler)( const char*, const h5part_int64_t, const char*,...) typedef h5part_int64_t (*h5part_error_handler)( const char*, const h5part_int64_t, const char*,...)
#ifdef __GNUC__ #ifdef __GNUC__
__attribute__ ((format (printf, 3, 4))) __attribute__ ((format (printf, 3, 4)))
+48 -29
View File
@@ -15,21 +15,29 @@
#define FILENAME "testio" #define FILENAME "testio"
/* normally 64 steps for real benchmark */ /* normally 64 steps for real benchmark */
#define NSTEPS 5 /* #define NSTEPS 5 */
/* normally 51e6 for real benchmark */ /* normally 51e6 for real benchmark */
#define NPARTICLES 51e4 #define NPARTICLES 51e4
#define NTRIALS 3 #define NTRIALS 3
/* /*
bench <nParticles> bench <nParticles> <nSteps>
*/ */
int main(int argc,char *argv[]){ int main(int argc,char *argv[]){
printf("Start benchmarks...\n");
if (argc < 3) {
printf("Usage: bench <nParticles> <nSteps> \n");
exit(-1);
}
else {
printf("nparticles: %d, nsteps: %d \n", atoi(argv[1]), atoi(argv[2]));
}
MPI_Info info; MPI_Info info;
int nprocs,rank; int nprocs,rank;
int trial; int trial;
@@ -37,6 +45,7 @@ int main(int argc,char *argv[]){
double starttime,curtime, endtime; double starttime,curtime, endtime;
int nparticles = atoi(argv[1]); int nparticles = atoi(argv[1]);
int nsteps = atoi(argv[2]);
double *x,*y,*z,*px,*py,*pz; double *x,*y,*z,*px,*py,*pz;
typedef double *ddouble; typedef double *ddouble;
@@ -49,7 +58,6 @@ int main(int argc,char *argv[]){
H5PartFile *f; H5PartFile *f;
#endif #endif
char newfilename[128]; char newfilename[128];
char lastfilename[128];
FILE *fd; FILE *fd;
MPI_File file; MPI_File file;
MPI_Offset foffset; MPI_Offset foffset;
@@ -73,8 +81,6 @@ int main(int argc,char *argv[]){
data[5]=pz=(double*)malloc(sizeof(double)*(size_t)localnp); data[5]=pz=(double*)malloc(sizeof(double)*(size_t)localnp);
/* printf("about to call create subarray with nparticles=%u localnp=%u offset=%u\n", /* printf("about to call create subarray with nparticles=%u localnp=%u offset=%u\n",
nparticles,localnp,offset); */ nparticles,localnp,offset); */
MPI_Type_create_subarray(1, /* rank */ MPI_Type_create_subarray(1, /* rank */
@@ -86,9 +92,10 @@ int main(int argc,char *argv[]){
&chunktype); &chunktype);
MPI_Type_commit(&chunktype); MPI_Type_commit(&chunktype);
MPI_Info_create(&info); MPI_Info_create(&info);
MPI_Info_set(info, "IBM_largeblock_io", "true" );
if(rank==0) printf("Nprocs=%u Particles=%u*6attribs*sizeof(double) Particles/proc=%u Nsteps=%u Ntrials=%u\n", if(rank==0) printf("Nprocs=%u Particles=%u*6attribs*sizeof(double) Particles/proc=%u Nsteps=%u Ntrials=%u\n",
nprocs,nparticles,localnp,NSTEPS,NTRIALS); nprocs,nparticles,localnp,nsteps,NTRIALS);
for(trial=0;trial<NTRIALS;trial++){ for(trial=0;trial<NTRIALS;trial++){
@@ -97,7 +104,6 @@ int main(int argc,char *argv[]){
MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */ MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */
sprintf(filename,"%s.%u.mpio.dat",FILENAME,nprocs); sprintf(filename,"%s.%u.mpio.dat",FILENAME,nprocs);
sprintf(lastfilename,"%s.%u.mpio.dat",FILENAME,nprocs);
if(rank==0) unlink(filename); if(rank==0) unlink(filename);
MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */ MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */
@@ -117,7 +123,7 @@ int main(int argc,char *argv[]){
foffset=0; foffset=0;
i=0; i=0;
curtime=starttime; curtime=starttime;
for(i=0;i<NSTEPS;i++){ for(i=0;i<nsteps;i++){
int n; int n;
MPI_Status status; MPI_Status status;
for(j=0;j<6;j++){ for(j=0;j<6;j++){
@@ -126,20 +132,33 @@ int main(int argc,char *argv[]){
(data[j])[n]=(double)rank; (data[j])[n]=(double)rank;
/* write to that file */ /* write to that file */
/* MPI_File_set_view(file,foffset,MPI_DOUBLE,chunktype,"native",info);*/ /* MPI_File_set_view(file,foffset,MPI_DOUBLE,chunktype,"native",info);*/
#ifdef COLLECTIVE_IO
MPI_File_write_at_all(file, MPI_File_write_at_all(file,
foffset, foffset,
data[j], data[j],
localnp, localnp,
MPI_DOUBLE,&status); MPI_DOUBLE,&status);
#else
MPI_File_write_at(file,
foffset,
data[j],
localnp,
MPI_DOUBLE,&status);
#endif
foffset+=nparticles/nprocs; foffset+=nparticles/nprocs;
} }
curtime=MPI_Wtime(); /* ensure no race condition by broadcasting time */ curtime=MPI_Wtime(); /* ensure no race condition by broadcasting time */
MPI_Bcast(&curtime,1,MPI_DOUBLE,0,MPI_COMM_WORLD); MPI_Bcast(&curtime,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
} }
MPI_File_close(&file); MPI_File_close(&file);
MPI_Barrier(MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD);
endtime=MPI_Wtime(); endtime=MPI_Wtime();
sprintf(filename,"%s.%u.h5.dat",FILENAME,nprocs);
/* foffset*=nprocs; if we want total megabytes written */ /* foffset*=nprocs; if we want total megabytes written */
if(rank==0){ if(rank==0){
puts("*"); puts("*");
@@ -148,20 +167,21 @@ int main(int argc,char *argv[]){
printf("Raw MPI-IO Total Duration %lf seconds, iterations=%u %lf Megabytes written per processor Nprocs= %u \n", printf("Raw MPI-IO Total Duration %lf seconds, iterations=%u %lf Megabytes written per processor Nprocs= %u \n",
(endtime-starttime),i,((double)foffset)/(1024.0*1024.0),nprocs); (endtime-starttime),i,((double)foffset)/(1024.0*1024.0),nprocs);
printf("Raw MPI-IO Effective Data Rate = %lf Megabytes/sec global and %lf Megabytes/sec per task Nprocs= %u \n", printf("Raw MPI-IO Effective Data Rate = %lf Megabytes/sec global and %lf Megabytes/sec per task Nprocs= %u \n",
(double)(nprocs*localnp*sizeof(double))*((double)NSTEPS)*6.0/((endtime-starttime)*1024.0*1024.0), (double)(nprocs*localnp*sizeof(double))*((double)nsteps)*6.0/((endtime-starttime)*1024.0*1024.0),
(double)(localnp*sizeof(double))*((double)NSTEPS)*6.0/((endtime-starttime)*1024.0*1024.0),nprocs); (double)(localnp*sizeof(double))*((double)nsteps)*6.0/((endtime-starttime)*1024.0*1024.0),nprocs);
puts("======================================================"); puts("======================================================");
} }
MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */ MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */
/* OK, now we do this using H5Part */
/* OK, now we do this using POSIX IO */
sprintf(newfilename,"testio%u.%u.dat",rank,nprocs); sprintf(newfilename,"testio%u.%u.dat",rank,nprocs);
unlink(newfilename); unlink(newfilename);
MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */ MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */
fd = fopen(newfilename,"w"); fd = fopen(newfilename,"w");
/* start the timer */ /* start the timer */
starttime=endtime=MPI_Wtime(); starttime=endtime=MPI_Wtime();
for(i=0;i<NSTEPS;i++){ for(i=0;i<nsteps;i++){
for(j=0;j<6;j++){ for(j=0;j<6;j++){
/* touch data */ /* touch data */
for(n=0;n<localnp;n++) for(n=0;n<localnp;n++)
@@ -181,23 +201,28 @@ int main(int argc,char *argv[]){
if(rank==0){ if(rank==0){
puts("======================================================"); puts("======================================================");
printf("Raw 1-file-per-proc Total Duration %lf seconds, iterations=%u %lf Megabytes written Nprocs= %u \n", printf("Raw 1-file-per-proc Total Duration %lf seconds, iterations=%u %lf Megabytes written Nprocs= %u \n",
(endtime-starttime),NSTEPS,((double)foffset)/(1024.0*1024.0),nprocs); (endtime-starttime),nsteps,((double)foffset)/(1024.0*1024.0),nprocs);
printf("Raw 1-file-per-proc Effective Data Rate = %lf Megabytes/sec global and %lf Megabytes/sec per task Nprocs= %u \n", printf("Raw 1-file-per-proc Effective Data Rate = %lf Megabytes/sec global and %lf Megabytes/sec per task Nprocs= %u \n",
(double)(nprocs*localnp*sizeof(double))*((double)NSTEPS)*6.0/((endtime-starttime)*1024.0*1024.0), (double)(nprocs*localnp*sizeof(double))*((double)nsteps)*6.0/((endtime-starttime)*1024.0*1024.0),
(double)(localnp*sizeof(double))*((double)NSTEPS)*6.0/((endtime-starttime)*1024.0*1024.0),nprocs); (double)(localnp*sizeof(double))*((double)nsteps)*6.0/((endtime-starttime)*1024.0*1024.0),nprocs);
puts("======================================================"); puts("======================================================");
} }
#ifndef DISABLE_H5PART #ifndef DISABLE_H5PART
//printf("H5Part benchmark...");
MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */ MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */
/* OK, now we do this using H5Part */ /* OK, now we do this using H5Part */
sprintf(filename,"%s.%u.h5.dat",FILENAME,nprocs);
if(rank==0) unlink(filename);
MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */
f = H5PartOpenFileParallel(filename,H5PART_WRITE,MPI_COMM_WORLD); f = H5PartOpenFileParallel(filename,H5PART_WRITE,MPI_COMM_WORLD);
MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */ MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */
/* start the timer */ /* start the timer */
starttime=endtime=MPI_Wtime(); starttime=endtime=MPI_Wtime();
H5PartSetNumParticles(f,localnp); H5PartSetNumParticles(f,localnp);
for(i=0;i<NSTEPS;i++){ for(i=0;i<nsteps;i++){
for(j=0;j<6;j++){ for(j=0;j<6;j++){
/* touch data */ /* touch data */
for(n=0;n<localnp;n++) for(n=0;n<localnp;n++)
@@ -222,23 +247,17 @@ int main(int argc,char *argv[]){
unlink(filename); unlink(filename);
puts("======================================================"); puts("======================================================");
printf("H5Part Total Duration %lf seconds, iterations=%u %lf Megabytes written Nprocs= %u \n", printf("H5Part Total Duration %lf seconds, iterations=%u %lf Megabytes written Nprocs= %u \n",
(endtime-starttime),NSTEPS,((double)foffset)/(1024.0*1024.0),nprocs); (endtime-starttime),nsteps,((double)foffset)/(1024.0*1024.0),nprocs);
printf("H5Part Effective Data Rate = %lf Megabytes/sec global and %lf Megabytes/sec per task Nprocs= %u \n", printf("H5Part Effective Data Rate = %lf Megabytes/sec global and %lf Megabytes/sec per task Nprocs= %u \n",
(double)(nprocs*localnp*sizeof(double))*((double)NSTEPS)*6.0/((endtime-starttime)*1024.0*1024.0), (double)(nprocs*localnp*sizeof(double))*((double)nsteps)*6.0/((endtime-starttime)*1024.0*1024.0),
(double)(localnp*sizeof(double))*((double)NSTEPS)*6.0/((endtime-starttime)*1024.0*1024.0),nprocs); (double)(localnp*sizeof(double))*((double)nsteps)*6.0/((endtime-starttime)*1024.0*1024.0),nprocs);
puts("======================================================"); puts("======================================================");
} }
MPI_Barrier(MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD);
#endif #endif
} /* trials */ } /* trials */
if (rank==0) {
printf("lastfilename: %s \n", lastfilename);
unlink(lastfilename);
}
MPI_Finalize(); MPI_Finalize();
return 0; return 0;
} }
+4 -7
View File
@@ -4,10 +4,7 @@
#include "H5Part.h" #include "H5Part.h"
#include "H5Block.h" #include "H5Block.h"
#include "H5BlockTypes.h" #include "H5BlockTypes.h"
#ifdef PARALLEL_IO #ifndef PARALLEL_IO
#include <mpi.h>
#else
typedef int MPI_Comm;
#ifndef MPI_COMM_WORLD #ifndef MPI_COMM_WORLD
#define MPI_COMM_WORLD 0 #define MPI_COMM_WORLD 0
#endif #endif
@@ -36,7 +33,7 @@ _write_data (
printf ( "Writing Step #%lld\n", (long long)f->timestep ); printf ( "Writing Step #%lld\n", (long long)f->timestep );
data = malloc ( i_dims * j_dims * k_dims * sizeof ( *data ) ); data = (h5part_float64_t *) malloc ( i_dims * j_dims * k_dims * sizeof ( *data ) );
for ( i = 0; i < i_dims; i++ ) { for ( i = 0; i < i_dims; i++ ) {
for ( j = 0; j < j_dims; j++ ) { for ( j = 0; j < j_dims; j++ ) {
for ( k = 0; k < k_dims; k++ ) { for ( k = 0; k < k_dims; k++ ) {
@@ -173,7 +170,7 @@ _read_data (
printf ( "Reading Step #%lld\n", (long long)f->timestep ); printf ( "Reading Step #%lld\n", (long long)f->timestep );
data = malloc ( i_dims * j_dims * k_dims * sizeof ( *data ) ); data = (h5part_float64_t *) malloc ( i_dims * j_dims * k_dims * sizeof ( *data ) );
herr = H5BlockDefine3DFieldLayout ( herr = H5BlockDefine3DFieldLayout (
f, f,
@@ -182,7 +179,7 @@ _read_data (
layout->k_start, layout->k_end ); layout->k_start, layout->k_end );
if ( herr < 0 ) return herr; if ( herr < 0 ) return herr;
herr = H5Block3dReadScalarField ( f, "TestField", data ); herr = H5Block3dReadScalarField ( f, "TestField", data );
if ( herr < 0 ) return herr; if ( herr < 0 ) return herr;
for ( i = 0; i < i_dims; i++ ) { for ( i = 0; i < i_dims; i++ ) {
+235 -249
View File
@@ -8,258 +8,244 @@
A simple regression test that shows how you use this API A simple regression test that shows how you use this API
to write and read multi-timestep files of particle data. to write and read multi-timestep files of particle data.
*/ */
int main(int argc,char *argv[]){
int sz=5;
double *x,*y,*z;
h5part_int64_t *id;
H5PartFile *file;
int i,t,nt,nds, np;
int nprocs = 1;
int myproc = 0;
#ifdef PARALLEL_IO #ifdef PARALLEL_IO
MPI_Comm comm=MPI_COMM_WORLD;
int main(int argc,char *argv[]){ MPI_Init(&argc,&argv);
int sz=5; MPI_Comm_size(comm,&nprocs);
double *x,*y,*z; MPI_Comm_rank(comm,&myproc);
h5part_int64_t *id;
H5PartFile *file;
int i,t,nt,nds;
int nprocs,myproc;
MPI_Comm comm=MPI_COMM_WORLD;
MPI_Init(&argc,&argv);
MPI_Comm_size(comm,&nprocs);
MPI_Comm_rank(comm,&myproc);
x=(double*)malloc(sz*nprocs*sizeof(double));
y=(double*)malloc(sz*nprocs*sizeof(double));
z=(double*)malloc(sz*nprocs*sizeof(double));
id=(h5part_int64_t*)malloc(sz*nprocs*sizeof(h5part_int64_t));
/* parallel file creation */
file=H5PartOpenFileParallel("parttest.h5",H5PART_WRITE,comm);
if(!file) {
perror("File open failed: exiting!");
exit(0);
}
for(t=0;t<5;t++){
MPI_Barrier(comm);
for(i=0;i<sz;i++) {
x[i]=(double)(i+t)+10.0*(double)myproc;
y[i]=0.1 + (double)(i+t);
z[i]=0.2 + (double)(i+t*10);
id[i]=i+sz*myproc;
}
printf("Proc[%u] Writing timestep %u file=%u\n",myproc,t,file->file);
H5PartSetStep(file,t); /* must set the current timestep in file */
H5PartSetNumParticles(file,sz); /* then set number of particles to store */
/* now write different tuples of data into this timestep of the file */
H5PartWriteDataFloat64(file,"x",x);
H5PartWriteDataFloat64(file,"y",y);
H5PartWriteDataFloat64(file,"z",z);
H5PartWriteDataFloat64(file,"px",x);
H5PartWriteDataFloat64(file,"py",y);
H5PartWriteDataFloat64(file,"pz",z);
H5PartWriteDataInt64(file,"id",id);
}
unsigned int idStart = 0+sz*myproc;
unsigned int idEnd = (sz-1)+sz*myproc;
printf("AllDone p[%u]\n",myproc);
H5PartCloseFile(file);
fprintf(stderr,"Closed files p[%u]\n",myproc);
MPI_Barrier(comm);
fprintf(stderr,"p[%u:%u] : OK, close file and reopen for reading idStart %u idEnd %u \n",myproc,nprocs,idStart,idEnd);
file=H5PartOpenFileParallel("parttest.h5",H5PART_READ,comm);
H5PartSetStep(file,0);
// unsigned int np = 0;
unsigned int np = (int)H5PartGetNumParticles(file);
nt=H5PartGetNumSteps(file); /* get number of steps in file */
nds=H5PartGetNumDatasets(file); /* get number of datasets in timestep 0 */
MPI_Barrier(comm);
H5PartSetView(file,idStart,idEnd);
np = (int)H5PartGetNumParticles(file);
printf("After SetView(%d,%d): steps= %u datasets= %u particles= %u\n",
(int)idStart,(int)idEnd,
nt,nds,np);
if(x)
free(x);
if(y)
free(y);
if(z)
free(z);
if(id)
free(id);
H5PartCloseFile(file);
MPI_Barrier(comm);
fprintf(stderr,"proc[%u]: done\n",myproc);
return MPI_Finalize();
}
#else
int main(int argc,char *argv[]){
int sz=10;
double *x,*y,*z;
h5part_int64_t *id;
H5PartFile *file;
int i,t,nt,nds,np;
h5part_int64_t idStart = 0;
h5part_int64_t idEnd = 0;
x=(double*)malloc(sz*sizeof(double));
y=(double*)malloc(sz*sizeof(double));
z=(double*)malloc(sz*sizeof(double));
id=(h5part_int64_t*)malloc(sz*sizeof(h5part_int64_t));
/* parallel file creation */
file=H5PartOpenFile("parttest.h5",H5PART_WRITE);
if(!file) {
perror("File open failed: exiting!");
exit(0);
}
H5PartWriteFileAttribString(file,"File Description", "This file is created by H5PartTest.cc. Simple H5Part file for testing purpose...");
char* FileAttrib = "Created by H5PartTest.cc";
H5PartWriteFileAttrib(file, "Origin", H5T_NATIVE_CHAR, FileAttrib ,strlen(FileAttrib));
for(t=0;t<5;t++){
fprintf(stdout,"Writing timestep %u\n",t);
for(i=0;i<sz;i++) {
x[i]=(double)(i+t);
y[i]=0.1 + (double)(i+t);
z[i]=0.2 + (double)(i+t*10);
id[i]=i;
fprintf(stdout,"\tp[%u] x=%f y=%f z=%f id=%d\n",
i,x[i],y[i],z[i],(int)id[i]);
}
H5PartSetStep(file,t); /* must set the current timestep in file */
H5PartSetNumParticles(file,sz); /* then set number of particles to store */
/* now write different tuples of data into this timestep of the file */
H5PartWriteDataFloat64(file,"x",x);
H5PartWriteDataFloat64(file,"y",y);
H5PartWriteDataFloat64(file,"z",z);
H5PartWriteDataFloat64(file,"px",x);
H5PartWriteDataFloat64(file,"py",y);
H5PartWriteDataFloat64(file,"pz",z);
H5PartWriteDataInt64(file,"id",id);
H5PartWriteStepAttribString(file,"Step Description", "STEP STEP STEP");
char* StepAttrib = "STEP";
H5PartWriteStepAttrib(file, "Step", H5T_NATIVE_CHAR, StepAttrib ,strlen(StepAttrib));
}
printf("AllDone writing\n");
H5PartCloseFile(file);
/*+++++++++++++ Reopen File for Reading +++++++++++*/
file=H5PartOpenFile("parttest.h5",H5PART_READ);
/********************************************/
H5PartSetStep(file,0);
nt=H5PartGetNumSteps(file); /* get number of steps in file */
nds=H5PartGetNumDatasets(file); /* get number of datasets in timestep 0 */
np=H5PartGetNumParticles(file);
fprintf(stdout,"OK, close file and reopen for reading\n");
fprintf(stdout,"steps= %u\tdatasets=%u\tparticles= %u\n",
nt,nds,np);
// clear the particles
for(i=0;i<np;i++){
x[i]=y[i]=z[i]=0.0;
id[i]=0;
}
H5PartReadDataFloat64(file,"x",x);
H5PartReadDataFloat64(file,"y",y);
H5PartReadDataFloat64(file,"z",z);
H5PartReadDataInt64(file,"id",id);
for(i=0;i<np;i++){
fprintf(stdout,
"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
i,x[i],y[i],z[i],(long long)(id[i]));
}
/********************************************/
printf("Set to last step and reload data\n");
H5PartSetStep(file,nt-1);
H5PartReadDataFloat64(file,"x",x);
H5PartReadDataFloat64(file,"y",y);
H5PartReadDataFloat64(file,"z",z);
H5PartReadDataInt64(file,"id",id);
for(i=0;i<np;i++){
fprintf(stdout,"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
i,x[i],y[i],z[i],(long long) (id[i]));
}
/********************************************/
idEnd=np;
printf("Old View is %d:%d\n",(int)idStart,(int)idEnd);
H5PartSetView(file,idStart,idEnd>>1);
printf("Set new view = %d:%d\n",(int)idStart,(int)(idEnd>>1));
H5PartGetView(file,&idStart,&idEnd);
np=H5PartGetNumParticles(file);
printf("steps= %u datasets= %u particles= %d with view %d:%d\n",
nt,nds,(int)np,(int)idStart,(int)idEnd);
H5PartSetStep(file,nt-1); // set to last step
printf("Setting to last step = %u\n",nt-1);
for(i=0;i<10;i++){ x[i]=y[i]=z[i]=0.0; id[i]=0; } /* clear the arrays */
H5PartReadDataFloat64(file,"x",x);
H5PartReadDataFloat64(file,"y",y);
H5PartReadDataFloat64(file,"z",z);
H5PartReadDataInt64(file,"id",id);
for(i=0;i<np;i++){
fprintf(stdout,
"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
i,x[i],y[i],z[i],(long long)id[i]);
}
/********************************************/
printf("Now set the view to the latter half of the data in step #%u\n",nt-1);
H5PartResetView(file);
H5PartGetView(file,&idStart,&idEnd);
printf("Reset view = %d:%d\nSetting to %u:%u\n",
(int)idStart,(int)idEnd,
(int)idEnd>>1,(int)idEnd);
H5PartSetView(file,(idEnd>>1),idEnd);
np=H5PartGetNumParticles(file);
printf("Now particles in selection are %d\n",np);
printf("doubleCheck=%lld\n", (long long)H5PartGetView(file,0,0));
for(i=0;i<10;i++){ x[i]=y[i]=z[i]=0.0; id[i]=0; } /* clear the arrays */
H5PartReadDataFloat64(file,"x",x);
H5PartReadDataFloat64(file,"y",y);
H5PartReadDataFloat64(file,"z",z);
H5PartReadDataInt64(file,"id",id);
for(i=0;i<np;i++){
fprintf(stdout,
"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
i,x[i],y[i],z[i],(long long)id[i]);
}
if(x)
free(x);
if(y)
free(y);
if(z)
free(z);
if(id)
free(id);
H5PartCloseFile(file);
fprintf(stderr,"done\n");
}
#endif #endif
x=(double*)malloc(sz*nprocs*sizeof(double));
y=(double*)malloc(sz*nprocs*sizeof(double));
z=(double*)malloc(sz*nprocs*sizeof(double));
id=(h5part_int64_t*)malloc(sz*nprocs*sizeof(h5part_int64_t));
#ifdef PARALLEL_IO
file=H5PartOpenFileParallel("parttest.h5",H5PART_WRITE,comm);
#else
file=H5PartOpenFile("parttest.h5",H5PART_WRITE);
#endif
if(!file) {
perror("File open failed: exiting!");
exit(0);
}
if ( myproc == 0 ) {
H5PartWriteFileAttribString (
file,
"File Description",
"Simple H5Part file for testing purpose...");
char* FileAttrib = "Created by H5PartTest.cc";
H5PartWriteFileAttrib (
file,
"Origin",
H5T_NATIVE_CHAR,
FileAttrib,
strlen(FileAttrib));
}
for(t=0;t<5;t++){
#ifdef PARALLEL_IO
MPI_Barrier(comm);
#endif
fprintf(stdout,"Writing timestep %u\n",t);
for(i=0;i<sz;i++) {
x[i]=(double)(i+t)+10.0*(double)myproc;
y[i]=0.1 + (double)(i+t);
z[i]=0.2 + (double)(i+t*10);
id[i]=i+sz*myproc;
}
printf("Proc[%u] Writing timestep %u file=%u\n",myproc,t,file->file);
H5PartSetStep(file,t); /* must set the current timestep in file */
H5PartSetNumParticles(file,sz); /* then set number of particles to store */
/* now write different tuples of data into this timestep of the file */
H5PartWriteDataFloat64(file,"x",x);
H5PartWriteDataFloat64(file,"y",y);
H5PartWriteDataFloat64(file,"z",z);
H5PartWriteDataFloat64(file,"px",x);
H5PartWriteDataFloat64(file,"py",y);
H5PartWriteDataFloat64(file,"pz",z);
H5PartWriteDataInt64(file,"id",id);
if ( myproc == 0 ) {
H5PartWriteStepAttribString (
file,
"Step Description",
"STEP STEP STEP"
);
}
}
h5part_int64_t idStart = 0+sz*myproc;
h5part_int64_t idEnd = (sz-1)+sz*myproc;
printf("AllDone p[%u]\n",myproc);
H5PartCloseFile(file);
fprintf(stderr,"Closed files p[%u]\n",myproc);
#ifdef PARALLEL_IO
MPI_Barrier(comm);
#endif
fprintf (
stderr,
"p[%u:%u] : OK, close file and reopen for reading idStart %lld idEnd %lld \n",
myproc, nprocs, (long long)idStart,
(long long)idEnd );
#ifdef PARALLEL_IO
file = H5PartOpenFileParallel ( "parttest.h5", H5PART_READ, comm );
#else
file = H5PartOpenFile ( "parttest.h5", H5PART_READ );
#endif
H5PartSetStep(file,0);
nt = H5PartGetNumSteps(file); /* get number of steps in file */
nds = H5PartGetNumDatasets(file); /* get number of datasets in timestep 0 */
np = H5PartGetNumParticles(file);
H5PartSetView(file,idStart,idEnd);
np = (int)H5PartGetNumParticles(file);
printf("After SetView(%d,%d): steps= %u datasets= %u particles= %u\n",
(int)idStart,(int)idEnd,
nt,nds,np);
#ifdef PARALLEL_IO
MPI_Barrier(comm);
#endif
// clear the particles
for(i=0;i<np;i++){
x[i]=y[i]=z[i]=0.0;
id[i]=0;
}
H5PartReadDataFloat64(file,"x",x);
H5PartReadDataFloat64(file,"y",y);
H5PartReadDataFloat64(file,"z",z);
H5PartReadDataInt64(file,"id",id);
for(i=0;i<np;i++){
fprintf(stdout,
"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
i,x[i],y[i],z[i],(long long)(id[i]));
}
printf("Set to last step and reload data\n");
H5PartSetStep(file,nt-1);
H5PartReadDataFloat64(file,"x",x);
H5PartReadDataFloat64(file,"y",y);
H5PartReadDataFloat64(file,"z",z);
H5PartReadDataInt64(file,"id",id);
for(i=0;i<np;i++){
fprintf(stdout,"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
i,x[i],y[i],z[i],(long long) (id[i]));
}
/********************************************/
idEnd=np;
printf("Old View is %d:%d\n",(int)idStart,(int)idEnd);
H5PartSetView(file,idStart,idEnd>>1);
printf("Set new view = %d:%d\n",(int)idStart,(int)(idEnd>>1));
H5PartGetView(file,&idStart,&idEnd);
np=H5PartGetNumParticles(file);
printf("steps= %u datasets= %u particles= %d with view %d:%d\n",
nt,nds,(int)np,(int)idStart,(int)idEnd);
H5PartSetStep(file,nt-1); // set to last step
printf("Setting to last step = %u\n",nt-1);
for(i=0;i<10;i++){ x[i]=y[i]=z[i]=0.0; id[i]=0; } /* clear the arrays */
H5PartReadDataFloat64(file,"x",x);
H5PartReadDataFloat64(file,"y",y);
H5PartReadDataFloat64(file,"z",z);
H5PartReadDataInt64(file,"id",id);
for(i=0;i<np;i++){
fprintf(stdout,
"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
i,x[i],y[i],z[i],(long long)id[i]);
}
/********************************************/
printf("Now set the view to the latter half of the data in step #%u\n",nt-1);
H5PartResetView(file);
H5PartGetView(file,&idStart,&idEnd);
printf("Reset view = %d:%d\nSetting to %u:%u\n",
(int)idStart,(int)idEnd,
(int)idEnd>>1,(int)idEnd);
H5PartSetView(file,(idEnd>>1),idEnd);
np=H5PartGetNumParticles(file);
printf("Now particles in selection are %d\n",np);
printf("doubleCheck=%lld\n", (long long)H5PartGetView(file,0,0));
for(i=0;i<10;i++){ x[i]=y[i]=z[i]=0.0; id[i]=0; } /* clear the arrays */
H5PartReadDataFloat64(file,"x",x);
H5PartReadDataFloat64(file,"y",y);
H5PartReadDataFloat64(file,"z",z);
H5PartReadDataInt64(file,"id",id);
for(i=0;i<np;i++){
fprintf(stdout,
"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
i,x[i],y[i],z[i],(long long)id[i]);
}
// read dataset names
h5part_int64_t status = H5PART_SUCCESS;
H5PartSetStep ( file, 0 );
for (h5part_int64_t i=0; i < nds; i++) {
const h5part_int64_t lenName = 64;
char datasetName[lenName];
h5part_int64_t datasetType;
h5part_int64_t datasetNElems;
status = H5PartGetDatasetInfo(file, i, datasetName, lenName,
&datasetType, &datasetNElems);
if (status != H5PART_SUCCESS) {
perror("Could not retrieve dataset names!");
} else {
printf("datasetName: %s, type: %lld, nElements: %lld ",
datasetName, datasetType, datasetNElems);
if (datasetType == H5PART_INT64) {
printf("H5PPART_INT64 \n");
}
else {
printf("H5PPART_FLOAT64 \n");
}
}
}
if(x)
free(x);
if(y)
free(y);
if(z)
free(z);
if(id)
free(id);
H5PartCloseFile(file);
fprintf(stderr,"proc[%u]: done\n",myproc);
#ifdef PARALLEL_IO
MPI_Barrier(comm);
return MPI_Finalize();
#else
return 0;
#endif
}
+3 -3
View File
@@ -2,7 +2,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <hdf5.h> #include <hdf5.h>
#include "H5Part.hh" #include "H5Part.h"
#ifdef PARALLEL_IO #ifdef PARALLEL_IO
@@ -84,8 +84,8 @@ int main(int argc,char *argv[]){
/* now lets compute the appropriate idStart and idEnd /* now lets compute the appropriate idStart and idEnd
for this particular processor */ for this particular processor */
unsigned h5part_int64_t idStart = sz*myproc; h5part_int64_t idStart = sz*myproc;
unsigned h5part_int64_t idEnd = (sz-1)+sz*myproc; h5part_int64_t idEnd = (sz-1)+sz*myproc;
H5PartSetView(file,idStart,idEnd); H5PartSetView(file,idStart,idEnd);
np=H5PartGetNumParticles(file); np=H5PartGetNumParticles(file);
printf("Proc[%u]: View=%u:%u : particles= %u\n", printf("Proc[%u]: View=%u:%u : particles= %u\n",
+7
View File
@@ -48,6 +48,13 @@ h5pToGNUplot_SOURCES = h5pToGNUplot.cc
# Specific building instruction (What compilers to use...) # Specific building instruction (What compilers to use...)
# ------------ Build Tools ------------ # ------------ Build Tools ------------
h5ToVtk.o: h5ToVtk.cc
$(TOOLS_CXX) $(CFLAGS) $(INC) -g -c h5ToVtk.cc
h5ToVtk: h5ToVtk.o
$(TOOLS_CXX) -o h5ToVtk h5ToVtk.o $(H5PLIB) $(LIBS)
h5pAttrib: h5pAttrib.o h5pAttrib: h5pAttrib.o
$(TOOLS_CXX) -o h5pAttrib h5pAttrib.o $(H5PLIB) $(LIBS) $(TOOLS_CXX) -o h5pAttrib h5pAttrib.o $(H5PLIB) $(LIBS)
+532
View File
@@ -0,0 +1,532 @@
/* h5ToVtk.cc
Andreas Adelmann
*/
#include <stdio.h>
#include <stdlib.h>
#include <cctype>
#include <string.h>
#include <hdf5.h>
#include "H5Part.h"
#include <set>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
#include <iomanip>
#include <cassert>
using namespace std;
#define MAX_LEN 100
/* Function headers */
int get_option(int argc, const char **argv, const char *opts, const struct long_options *l_opts);
static void print_help();
static void variable_assign(int argc, const char *argv[]);
/* Global variables */
static char* input_name = NULL;
static char* output_name = NULL;
static bool flg_alive = false;
static double z_pos = 0.0;
static int print_all = 0;
/* `get_option' variables */
int opt_err = 1; /*get_option prints errors if this is on */
int opt_ind = 1; /*token pointer */
const char *opt_arg = NULL; /*flag argument (or value) */
/* indication whether the flag (option) requires an argument or not */
enum {
no_arg = 0, /* doesn't take an argument */
require_arg, /* requires an argument */
};
/* struct for flags (options) */
typedef struct long_options
{
const char *name; /* name of the long option */
int has_arg; /* whether we should look for an arg */
char shortval; /* the shortname equivalent of long arg
* this gets returned from get_option */
} long_options;
/* List of options in single characters */
static const char *s_opts = "h1:2:i:o:a:";
/* List of options in full words */
static struct long_options l_opts[] =
{
{ "help", no_arg, 'h' }, // Print help page
{ "input", require_arg, 'i' }, // Takes input file name
{ "output", require_arg, 'o' }, // Takes output file name (without this flag, the program will print to stdout)
{ "alive ", no_arg , 'a' }, // also generate the alive dark current to display the dark current source
{ NULL, 0, '\0' }
};
/************************************************************************************
*********************************** FUNCTIONS *************************************
*************************************************************************************/
string convert2Int(int number) {
stringstream ss;
ss << setw(5) << setfill('0') << number;
return ss.str();
}
/* get_option is the parsing function that was majorly ported from h5dump utility */
int get_option(int argc, const char **argv, const char *opts, const struct long_options *l_opts) {
static int sp = 1; /* character index in current token */
int opt_opt = '?'; /* option character passed back to user */
if (sp == 1)
{
/* check for more flag-like tokens */
if (opt_ind >= argc || argv[opt_ind][0] != '-' || argv[opt_ind][1] == '\0')
{
return EOF;
}
else if (strcmp(argv[opt_ind], "--") == 0)
{
opt_ind++;
return EOF;
}
}
if (sp == 1 && argv[opt_ind][0] == '-' && argv[opt_ind][1] == '-')
{
/* long command line option */
const char *arg = &argv[opt_ind][2];
int i;
for (i = 0; l_opts && l_opts[i].name; i++)
{
size_t len = strlen(l_opts[i].name);
if (strncmp(arg, l_opts[i].name, len) == 0)
{
/* we've found a matching long command line flag */
opt_opt = l_opts[i].shortval;
if (l_opts[i].has_arg != no_arg)
{
if (arg[len] == '=')
{
opt_arg = &arg[len + 1];
}
else if (opt_ind < (argc - 1) && argv[opt_ind + 1][0] != '-')
{
opt_arg = argv[++opt_ind];
}
else if (l_opts[i].has_arg == require_arg)
{
if (opt_err)
fprintf(stderr, "%s: option required for \"--%s\" flag\n", argv[0], arg);
opt_opt = '?';
}
}
else
{
if (arg[len] == '=')
{
if (opt_err)
fprintf(stderr, "%s: no option required for \"%s\" flag\n", argv[0], arg);
opt_opt = '?';
}
opt_arg = NULL;
}
break;
}
}
if (l_opts[i].name == NULL)
{
/* exhausted all of the l_opts we have and still didn't match */
if (opt_err)
fprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg);
opt_opt = '?';
}
opt_ind++;
sp = 1;
}
else
{
register char *cp; /* pointer into current token */
/* short command line option */
opt_opt = argv[opt_ind][sp];
if (opt_opt == ':' || (cp = strchr(opts, opt_opt)) == 0)
{
if (opt_err)
fprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], opt_opt);
/* if no chars left in this token, move to next token */
if (argv[opt_ind][++sp] == '\0')
{
opt_ind++;
sp = 1;
}
return '?';
}
if (*++cp == ':')
{
/* if a value is expected, get it */
if (argv[opt_ind][sp + 1] != '\0')
{
/* flag value is rest of current token */
opt_arg = &argv[opt_ind++][sp + 1];
}
else if (++opt_ind >= argc)
{
if (opt_err)
{
fprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], opt_opt);
}
opt_opt = '?';
}
else
{
/* flag value is next token */
opt_arg = argv[opt_ind++];
}
sp = 1;
}
else
{
/* set up to look at next char in token, next time */
if (argv[opt_ind][++sp] == '\0')
{
/* no more in current token, so setup next token */
opt_ind++;
sp = 1;
}
opt_arg = NULL;
}
}
/* return the current flag character found */
return opt_opt;
}
/* Assigns functions according to the parsed result */
static void variable_assign(int argc, const char *argv[])
{
int option;
/* set options according to the command line */
while ((option = get_option(argc, argv, s_opts, l_opts)) != EOF)
{
switch ((char)option)
{
case 'h': // Print help page
print_help();
exit(1);
case 'o': // Print number of steps
output_name = strdup(opt_arg);
break;
case 'i': // Print shorter version without the values
input_name = strdup(opt_arg);
break;
case 'a': //
{ flg_alive = true;
z_pos = atof(strdup(opt_arg));
}
break;
default:
print_help();
exit(1);
}
}
}
/* For printing help page */
static void print_help()
{
fflush(stdout);
fprintf(stdout, "\nusage: h5ToVtk -i INPUTFILE -o OUTPUTFILE [OPTIONAL_FLAGS] -a ZVALUE\n");
fprintf(stdout, "\n");
fprintf(stdout, " FLAGS\n");
fprintf(stdout, " -h, --help Print help page\n");
fprintf(stdout, " -i file, --input file (REQUIRED) Takes input base file name to \"file\" (extension h5 is assumed \n");
fprintf(stdout, " -o file, --output file (REQUIRED) Takes output base file name to \"file\" (extension vtk is added)\n");
fprintf(stdout, " -a zvalue Only display particles which have servived and reached z value \n");
fprintf(stdout, "\n");
fprintf(stdout, " Examples:\n");
fprintf(stdout, "\n");
fprintf(stdout, " /h5ToVtk -i ctf3-injector-darkcurrent-1 -o ctf3-injector-darkcurrent-1- \n");
fprintf(stdout, "\n");
fprintf(stdout, " /h5ToVtk -i ctf3-injector-darkcurrent-1 -o ctf3-injector-darkcurrent-1- -a 0.19 \n");
fprintf(stdout, "\n");
}
int main(int argc, const char *argv[])
{
H5PartFile *h5file = NULL;
std::ofstream of, ofalive;
int j;
int num_dataset;
int ntime_step = 0;
variable_assign(argc, argv);
if(input_name == NULL) {
fprintf(stdout, "missing input file name\n");
print_help();
exit(1);
}
if(output_name == NULL) {
fprintf(stdout, "missing output file name\n");
print_help();
exit(1);
}
string ifn = string(input_name) + string(".h5");
h5file = H5PartOpenFile(ifn.c_str(), H5PART_READ);
if( h5file == NULL ) {
fprintf(stdout, "unable to open file %s\n", input_name);
print_help();
exit(1);
}
ntime_step = H5PartGetNumSteps(h5file);
if (flg_alive) {
set<h5part_int64_t> idSet;
H5PartSetStep(h5file, ntime_step-1);
num_dataset = H5PartGetNumDatasets(h5file);
h5part_int64_t nparticles = H5PartGetNumParticles(h5file);
h5part_int64_t* larray = (h5part_int64_t*)malloc(sizeof(h5part_int64_t)*nparticles);
H5PartReadDataInt64(h5file, "id", larray);
h5part_float64_t* z = (h5part_float64_t*)malloc(sizeof(h5part_float64_t)*nparticles);
H5PartReadDataFloat64(h5file, "z", z);
for(unsigned long int n = 0; n < nparticles; ++n) {
if (z[n] >= z_pos)
idSet.insert(larray[n]);
}
cout << "Last timestep contains " << nparticles << " particles" << endl;
for (size_t j = 0; j<ntime_step ; j ++) {
H5PartSetStep(h5file,j);
num_dataset = H5PartGetNumDatasets(h5file);
h5part_int64_t nparticles = H5PartGetNumParticles(h5file);
h5part_int64_t* larray = (h5part_int64_t*)malloc(sizeof(h5part_int64_t)*nparticles);
H5PartReadDataInt64(h5file, "id", larray);
h5part_float64_t* x = (h5part_float64_t*)malloc(sizeof(h5part_float64_t)*nparticles);
H5PartReadDataFloat64(h5file, "x", x);
vector<h5part_float64_t> x_alive;
h5part_float64_t* y = (h5part_float64_t*)malloc(sizeof(h5part_float64_t)*nparticles);
H5PartReadDataFloat64(h5file, "y", y);
vector<h5part_float64_t> y_alive;
h5part_float64_t* z = (h5part_float64_t*)malloc(sizeof(h5part_float64_t)*nparticles);
H5PartReadDataFloat64(h5file, "z", z);
vector<h5part_float64_t> z_alive;
h5part_int64_t* ptype = (h5part_int64_t*)malloc(sizeof(h5part_int64_t)*nparticles);
H5PartReadDataInt64(h5file, "ptype", ptype);
vector<h5part_int64_t> ptype_alive;
for (size_t i = 0; i < nparticles ; i ++) {
if ( idSet.find(larray[i]) != idSet.end() ) {
x_alive.push_back(x[i]);
y_alive.push_back(y[i]);
z_alive.push_back(z[i]);
ptype_alive.push_back(ptype[i]);
}
}
string ffnlive = string("vtk/") + string(output_name) + string("-alive-") + convert2Int(j) + string(".vtk");
ofalive.open(ffnlive.c_str());
assert(ofalive.is_open());
ofalive.precision(6);
size_t alive_num = x_alive.size();
ofalive << setprecision(5)
<< "# vtk DataFile Version 2.0" << endl
<< "unstructured grid and vector field on the nodes" << endl
<< "ASCII" << endl
<< "DATASET UNSTRUCTURED_GRID" << endl
<< "POINTS " << alive_num << " float" << endl;
// Particle positions
for(size_t i = 0; i < alive_num; i++)
ofalive << x_alive[i] << " " << y_alive[i] << " " << z_alive[i] << endl;
ofalive << endl; // defining VTK_poly_vertex
ofalive << "CELLS " << alive_num << " " << 2 * alive_num << endl;
for(size_t i = 0; i < alive_num; i++)
ofalive << "1 " << i << endl;
ofalive << endl;
// defining Cell_types
ofalive << "CELL_TYPES " << alive_num << endl;
for(size_t i = 0; i < alive_num; i++)
ofalive << "2" << endl;
// defining Cell_types
ofalive << "POINT_DATA " << alive_num << endl;
ofalive << "SCALARS " << "Pointtype" << " float " << "1" << endl;
ofalive << "LOOKUP_TABLE " << "mytable" << endl ;
for(size_t i = 0; i < alive_num ; i ++) {
if (ptype_alive[i] == 0) {
ofalive << 0.0 << endl;
}
else if (ptype_alive[i] == 1) {
ofalive << 0.5 << endl;
}
else if (ptype_alive[i] == 2) {
ofalive << 1.0 << endl;
}
}
ofalive << "LOOKUP_TABLE " << "mytable " << 3 << endl ;
ofalive << 1.0 <<" "<< 0.0 <<" "<< 0.0 <<" "<< 1.0 << endl;
ofalive << 0.0 <<" "<< 1.0 <<" "<< 0.0 <<" "<< 1.0 << endl;
ofalive << 0.0 <<" "<< 0.0 <<" "<< 1.0 <<" "<< 1.0 << endl;
ofalive << endl;
ofalive.close();
free(x);
free(y);
free(z);
free(ptype);
x_alive.clear();
y_alive.clear();
z_alive.clear();
ptype_alive.clear();
cout <<"Done time step "<< j << endl;
}
}
else {
for (size_t j=0; j<ntime_step; j++) {
H5PartSetStep(h5file,j);
num_dataset = H5PartGetNumDatasets(h5file);
h5part_int64_t nparticles = H5PartGetNumParticles(h5file);
cout << "Working on timestep " << j << " expecting " << nparticles << " particles " << endl;
h5part_float64_t* x = (h5part_float64_t*)malloc(sizeof(h5part_float64_t)*nparticles);
H5PartReadDataFloat64(h5file, "x", x);
h5part_float64_t* y = (h5part_float64_t*)malloc(sizeof(h5part_float64_t)*nparticles);
H5PartReadDataFloat64(h5file, "y", y);
h5part_float64_t* z = (h5part_float64_t*)malloc(sizeof(h5part_float64_t)*nparticles);
H5PartReadDataFloat64(h5file, "z", z);
h5part_int64_t* ptype = (h5part_int64_t*)malloc(sizeof(h5part_int64_t)*nparticles);
H5PartReadDataInt64(h5file, "ptype", ptype);
string ffn = string("vtk/") + string(output_name) + convert2Int(j) + string(".vtk");
of.open(ffn.c_str());
assert(of.is_open());
of.precision(6);
of << setprecision(5)
<< "# vtk DataFile Version 2.0" << endl
<< "unstructured grid and vector field on the nodes" << endl
<< "ASCII" << endl
<< "DATASET UNSTRUCTURED_GRID" << endl
<< "POINTS " << nparticles << " float" << endl;
// Particle positions
for(size_t i = 0; i < nparticles; i++)
of << x[i] << " " << y[i] << " " << z[i] << endl;
of << endl; // defining VTK_poly_vertex
of << "CELLS " << nparticles << " " << 2 * nparticles << endl;
for(size_t i = 0; i < nparticles; i++)
of << "1 " << i << endl;
of << endl;
// defining Cell_types
of << "CELL_TYPES " << nparticles << endl;
for(size_t i = 0; i < nparticles; i++)
of << "2" << endl;
// defining Cell_types
of << "POINT_DATA " << nparticles << endl;
of << "SCALARS " << "Pointtype" << " float " << "1" << endl;
of << "LOOKUP_TABLE " << "mytable" << endl ;
for(size_t i = 0; i < nparticles ; i ++) {
if (ptype[i] == 0) {
of << 0.0 << endl;
}
else if (ptype[i] == 1) {
of << 0.5 << endl;
}
else if (ptype[i] == 2) {
of << 1.0 << endl;
}
}
of << "LOOKUP_TABLE " << "mytable " << 3 << endl ;
of << 1.0 <<" "<< 0.0 <<" "<< 0.0 <<" "<< 1.0 << endl;
of << 0.0 <<" "<< 1.0 <<" "<< 0.0 <<" "<< 1.0 << endl;
of << 0.0 <<" "<< 0.0 <<" "<< 1.0 <<" "<< 1.0 << endl;
of << endl;
of.close();
free(x);
free(y);
free(z);
free(ptype);
}
}
H5PartCloseFile(h5file);
return 0;
}