Compare commits

...

24 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
21 changed files with 1999 additions and 829 deletions
+3 -2
View File
@@ -1,15 +1,15 @@
* text=auto !eol
/AUTHORS -text
/COPYRIGHT -text
/COPYING -text
/ChangeLog -text
/GNUmakefile.orig -text
/INSTALL -text
/Makefile.am -text
/Makefile.orig -text
/NEWS -text
/README -text
/autogen.sh -text
/config.guess -text
/config.h.in -text
/config.sub -text
/configure.ac -text
/depcomp -text
@@ -56,6 +56,7 @@ test/H5testFpar.f90 -text
test/Makefile.am -text
tools/Makefile.am -text
tools/README -text
tools/h5ToVtk.cc -text
tools/h5pAttrib.cc -text
tools/h5pToGNUplot.cc -text
tools/homdynToH5p.cc -text
+1
View File
@@ -6,5 +6,6 @@ Benedikt Oswald (PSI)
Wes Bethel (NERSC/LBNL)
John Shalf (NERSC/LBNL)
Cristina Siegerist (NERSC/LBNL)
Mark Howison (NERSC/LBNL)
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
--------------
Now all functions, in which an error could occure, are returning a
+56 -417
View File
@@ -1,418 +1,57 @@
==============================================================================
README file for H5Part configure
==============================================================================
+ 0. HDF5 library
-----------------
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
library download the sources from http://hdf.ncsa.uiuc.edu/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
----------------------------
(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. See below for descriptions of some of the useful variables.
Compiler environment variables:
CC C compiler command
CXX C++ compiler command
FC Fortran compiler command
(3) Setting prefix for installation manually
--prefix=PREFIX install files in PREFIX
For more information, type:
./configure --help
==============================================================================
+ 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.
For more information on using the H5Part API, see the H5Part website:
http://www-vis.lbl.gov/Research/AcceleratorSAPP/
Motivation
----------
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.
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.
H5Part is built on top of the HDF5 (Hierarchical Data Format) library. 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.
File Organization and API
-------------------------
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.
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.
-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
+283 -283
View File
@@ -1,6 +1,6 @@
# Every configure script must call AC_INIT before doing anything else.
# AC_INIT (package, version, [bug-report], [tarname])
AC_INIT([H5Part], [1.4.0], [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.
@@ -26,27 +26,27 @@ AC_ARG_ENABLE(
AC_ARG_ENABLE(
[fortran],
[AC_HELP_STRING([--enable-fortran],
[AC_HELP_STRING([--enable-fortran],
[Compile the Fortran interface [default=no]])],
[USE_FORTRAN=$enableval])
[USE_FORTRAN=$enableval])
AC_ARG_ENABLE(
[parallel],
[AC_HELP_STRING([--enable-parallel],
[AC_HELP_STRING([--enable-parallel],
[Compile the MPI/IO interface [default=no]])],
[USE_PARALLEL=$enableval])
[USE_PARALLEL=$enableval])
AC_ARG_ENABLE(
[tools],
[AC_HELP_STRING([--enable-tools],
[AC_HELP_STRING([--enable-tools],
[Compile h5part tools [default=no]])],
[USE_TOOLS=$enableval])
[USE_TOOLS=$enableval])
AC_ARG_WITH(
[mpipath],
[AC_HELP_STRING([--with-mpipath],
[path to MPI installation [default=""]])],
[MPIPATH=$withval], [MPIPATH=""])
[MPIPATH=$withval], [MPIPATH=""])
AC_ARG_WITH(
[hdf5path],
@@ -54,6 +54,13 @@ AC_ARG_WITH(
[path to HDF5 installation [default=""]])],
[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 #######################
###############################################################################
@@ -85,35 +92,26 @@ SAVE_LDFLAGS=$LDFLAGS
# @enddesc
#@@*/
PATH_Search()
{
eval $1=""
if test $# -lt 4 ; then
h5part_basedir=""
else
h5part_basedir="$4/"
fi
for h5part_place in $2
do
echo -n "looking in $h5part_place ... $ac_c" #1>&6
if test -r "$h5part_basedir$h5part_place/$3" ; then
echo "$ac_t"" found" #1>&6
eval $1="$h5part_place"
break
fi
if test -d "$h5part_basedir$h5part_place/$3" ; then
echo "$ac_t"" found" #1>&6
eval $1="$h5part_place"
break
fi
echo "$ac_t"" no" #1>&6
done
return
PATH_Search() {
eval $1=""
if test $# -lt 4 ; then
h5part_basedir=""
else
h5part_basedir="$4/"
fi
for h5part_place in $2; do
AC_MSG_CHECKING([looking in $h5part_place ... ])
if test -r "$h5part_basedir$h5part_place/$3" ; then
AC_MSG_RESULT([found])
eval $1="$h5part_place"
break
fi
AC_MSG_RESULT([no])
done
return
}
###############################################################################
############# MISC SETTINGS INCLUDING C & C++ COMPILER SETTING ################
###############################################################################
@@ -124,32 +122,12 @@ AC_CANONICAL_HOST
uname=`uname -s`
if test $uname = "AIX"; then
AC_MSG_CHECKING([if system is AIX])
AC_MSG_RESULT([OK])
AC_MSG_CHECKING([if system is AIX])
AC_MSG_RESULT([OK])
# If on AIX, define _ALL_SOURCE. Allows the use of some BSD functions.
# Should be called before any macros that run the C compiler.
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
# If on AIX, define _ALL_SOURCE. Allows the use of some BSD functions.
# Should be called before any macros that run the C compiler.
AC_AIX
fi
@@ -165,9 +143,9 @@ AC_PATH_PROGS([BAS_CC], [cc_r], [], [$PATH])
# if BAS_CC not empty
if test -n "$BAS_CC"; then
echo "CC setting for Bassi ..."
CC=$BAS_CC
echo "CC = $CC ..."
AC_MSG_CHECKING([CC setting for Bassi])
CC=$BAS_CC
AC_MSG_RESULT([CC = $CC])
fi
@@ -181,6 +159,16 @@ fi
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,
# if one is found in the current PATH.
# 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 test "X$USE_64" = "Xyes"; then
AC_MSG_RESULT([yes])
if test $uname = "AIX"; then
CFLAGS="$CFLAGS -q64"
FFLAGS="$FFLAGS -q64"
fi
AC_MSG_RESULT([yes])
if test $uname = "AIX"; then
CFLAGS="$CFLAGS -q64"
FFLAGS="$FFLAGS -q64"
fi
if test $uname = "IRIX64"; then
CFLAGS="$CFLAGS -64"
FFLAGS="$FFLAGS -64 -fPIC -fno-second-underscore"
fi
if test $uname = "IRIX64"; then
CFLAGS="$CFLAGS -64"
FFLAGS="$FFLAGS -64 -fPIC -fno-second-underscore"
fi
else
AC_MSG_RESULT([no])
AC_MSG_RESULT([no])
fi
############################ fortran enabled ##################################
AC_MSG_CHECKING([if fortran interface enabled])
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)
if test -z "$FC" ; then
AC_MSG_ERROR([Cannot find a fortran compiler!!!])
exit 1
fi
AC_PROG_FC(ifort xlf_r pathf90 g95 g90 ftn gfortran)
if test -z "$FC" ; then
AC_MSG_ERROR([Cannot find a fortran compiler!!!])
exit 1
fi
if test ! $uname = "AIX"; then
FFLAGS="${FFLAGS} -fPIC -fno-second-underscore"
fi
if test ! $uname = "AIX"; then
FFLAGS="${FFLAGS} -fPIC"
fi
if test $FC = "g90"; then
FFLAGS="${FFLAGS} -fno-second-underscore"
fi
AC_MSG_CHECKING([symbol convention in object files])
`cd src && rm -f TestUnderscore.o TestUnderscoreC.o TestUnderscore`
`cd src && ${FC} ${FFLAGS} -c TestUnderscore.f`
`cd src && ${CC} ${CFLAGS} -c TestUnderscoreC.c`
`cd src && ${FC} ${FFLAGS} -o TestUnderscore TestUnderscore.o TestUnderscoreC.o -lc`
if test $FC = "g95"; then
FFLAGS="${FFLAGS} -fno-second-underscore"
fi
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
AC_MSG_CHECKING([symbol convention in object files])
`cd src && rm -f TestUnderscore.o TestUnderscoreC.o TestUnderscore`
`cd src && ${FC} ${FFLAGS} -c TestUnderscore.f`
`cd src && ${CC} ${CFLAGS} -c TestUnderscoreC.c`
# `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
AC_MSG_RESULT([no])
AC_MSG_RESULT([no])
fi
######################## parallel interface enabled ###########################
AC_MSG_CHECKING([if parallel interface enabled])
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_TRY_LINK([#include "mpi.h"], [
MPI_Comm comm;
int n;
MPI_Comm_size( comm, &n ); ],
[echo 'yes'; r='yes'], [echo "no"; r='no'] )
AC_MSG_CHECKING([if we can compile MPI code without setting flags])
AC_TRY_LINK([#include "mpi.h"], [
MPI_Comm comm;
int n;
MPI_Comm_size( comm, &n ); ],
[AC_MSG_RESULT([yes]); r='yes'], [AC_MSG_RESULT([no]); r='no'] )
if test "X$r" = "Xno"; then
AC_PATH_PROGS([MPICC], [mpicc mpcc_r], [], [$PATH])
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
if test "X$USE_MPIPOSIX" = "Xyes"; then
CFLAGS="${CFLAGS} -DH5PART_MPIPOSIX"
fi
if test "X$r" = "Xno"; then
AC_PATH_PROGS([MPICC], [mpicc mpcc_r], [], [$PATH])
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 -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 -e "${MPIROOT}/bin/mpicc"; then
MPICC=${MPIROOT}/bin/mpicc
fi
if test -n "$MPICC"; then
CC=${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
MTARGET="libpH5Part.a"
TTARGET="H5PartTestP H5PartAndreasTest Bench"
TTARGET="${TTARGET} H5BlockTestAttributes"
TTARGET="${TTARGET} H5BlockParTestScalarField"
# parallel + fortran
if test "X$USE_FORTRAN" = "Xyes"; then
AC_PATH_PROGS([MPIFC], [mpxlf_r mpif90], [], [$PATH])
if test -z "${MPIFC}" ; then
if test -e "${MPIROOT}/bin/mpif90"; then
MPIFC=${MPIROOT}/bin/mpif90
fi
if test -n "$MPICXX"; then
CXX=${MPICXX}
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="libpH5Part.a"
TTARGET="H5PartTestP H5PartAndreasTest Bench"
TTARGET="${TTARGET} H5BlockTestAttributes"
TTARGET="${TTARGET} H5BlockParTestScalarField"
# parallel + fortran
if test "X$USE_FORTRAN" = "Xyes"; then
AC_PATH_PROGS([MPIFC], [mpxlf_r mpif90], [], [$PATH])
if test -z "${MPIFC}" ; then
if test -e "${MPIROOT}/bin/mpif90"; then
MPIFC=${MPIROOT}/bin/mpif90
fi
fi
MTARGET="${MTARGET} libpH5PartF.a"
TTARGET="${TTARGET} H5testFpar"
TTARGET="${TTARGET} H5BlockParTestScalarFieldF"
fi
# if MPIFC empty
if test ! -n "$MPIFC"; then
AC_MSG_CHECKING([ No MPIFC detected. Setting MPIFC to FC.])
MPIFC=$FC
AC_MSG_RESULT([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
AC_MSG_RESULT([no])
AC_MSG_RESULT([no])
MTARGET="libH5Part.a"
TTARGET="H5PartTest H5test"
TTARGET="${TTARGET} H5BlockTestAttributes"
MTARGET="libH5Part.a"
TTARGET="H5PartTest H5test"
TTARGET="${TTARGET} H5BlockTestAttributes"
if test "X$USE_FORTRAN" = "Xyes"; then
MTARGET="${MTARGET} libH5PartF.a"
TTARGET="${TTARGET} H5testF"
TTARGET="${TTARGET} H5BlockTestAttributesF"
fi
if test "X$USE_FORTRAN" = "Xyes"; then
MTARGET="${MTARGET} libH5PartF.a"
TTARGET="${TTARGET} H5testF"
TTARGET="${TTARGET} H5BlockTestAttributesF"
fi
fi
AC_MSG_CHECKING([wheter tools are enabled])
if test "X$USE_TOOLS" = "Xyes"; then
AC_MSG_RESULT([yes])
BUILD_TOOLS="h5pAttrib h5pToGNUplot # homdynToH5p"
AC_MSG_RESULT([yes])
BUILD_TOOLS="h5pAttrib h5pToGNUplot h5ToVtk# homdynToH5p"
else
AC_MSG_RESULT([no])
AC_MSG_RESULT([no])
fi
###############################################################################
@@ -407,58 +408,58 @@ fi
AC_MSG_CHECKING([for HDF5 root ])
AC_MSG_RESULT([])
if test -n "${HDF5ROOT}"; then
P=${HDF5ROOT}
P=${HDF5ROOT}
elif test -n "${HDF5HOME}" ; then
P=${HDF5HOME}
P=${HDF5HOME}
elif test -n "${HDF5PATH}" ; then
P=${HDF5PATH}
P=${HDF5PATH}
else
P=''
P="$P /usr"
P="$P /usr/local"
P="$P /usr/local/hdf5"
P="$P /usr/local/packages/hdf5"
P="$P /apps/hdf5"
P=''
P="$P /usr"
P="$P /usr/local"
P="$P /usr/local/hdf5"
P="$P /usr/local/packages/hdf5"
P="$P /apps/hdf5"
if test "X$USE_PARALLEL" = "Xyes"; then
P="$P /usr/local/phdf5"
P="$P /usr/local/hdf5/hdf5_par"
if test "X$USE_64" = "Xyes"; then
P="$P /usr/common/usg/hdf5/64/default/parallel"
else
P="$P /usr/common/usg/hdf5/32/default/parallel"
fi
else
P="$P /usr/local/hdf5/hdf5_serial"
if test "X$USE_64" = "Xyes"; then
P="$P /usr/common/usg/hdf5/64/default/serial"
else
P="$P /usr/common/usg/hdf5/32/default/serial"
fi
fi
if test "X$USE_PARALLEL" = "Xyes"; then
P="$P /usr/local/phdf5"
P="$P /usr/local/hdf5/hdf5_par"
if test "X$USE_64" = "Xyes"; then
P="$P /usr/common/usg/hdf5/64/default/parallel"
else
P="$P /usr/common/usg/hdf5/32/default/parallel"
fi
else
P="$P /usr/local/hdf5/hdf5_serial"
if test "X$USE_64" = "Xyes"; then
P="$P /usr/common/usg/hdf5/64/default/serial"
else
P="$P /usr/common/usg/hdf5/32/default/serial"
fi
fi
fi
PATH_Search HDF5ROOT "$P" include/hdf5.h
if test -z "$HDF5ROOT"; then
AC_MSG_ERROR([Cannot determine HDF5 root!!!])
exit 1
AC_MSG_ERROR([Cannot determine HDF5 root!!!])
exit 1
fi
AC_MSG_CHECKING([if we need to link to libsz ])
if test -n "$HDF5ROOT"; then
if test -f $HDF5ROOT/lib/libsz.a; then
AC_MSG_RESULT([yes])
SZLIB="-L$HDF5ROOT/lib/ -lsz"
else
AC_MSG_RESULT([no])
SZLIB=""
fi
if test -f $HDF5ROOT/lib/libsz.a; then
AC_MSG_RESULT([yes])
SZLIB="-L$HDF5ROOT/lib/ -lsz"
else
AC_MSG_RESULT([no])
SZLIB=""
fi
fi
AC_MSG_CHECKING([for static zlib root ])
echo
AC_MSG_RESULT([ ])
PATH_Search ZLIBROOT '/apps/zlib' lib/libz.a
if test -n "$ZLIBROOT"; then
LDFLAGS="$LDFLAGS -L$ZLIBROOT/lib"
LDFLAGS="$LDFLAGS -L$ZLIBROOT/lib"
fi
@@ -474,65 +475,65 @@ H5P_LIB_LOC=`pwd`/src
#if there was an external input for the variable...
if test -n "$SAVE_CC"; then
CC=$SAVE_CC
CC=$SAVE_CC
fi
if test -n "$SAVE_CXX"; then
CXX=$SAVE_CXX
CXX=$SAVE_CXX
fi
if test -n "$SAVE_FC"; then
FC=$SAVE_FC
FC=$SAVE_FC
fi
if test -n "$SAVE_MPICC"; then
MPICC=$SAVE_MPICC
MPICC=$SAVE_MPICC
fi
if test -n "$SAVE_MPICXX"; then
MPICXX=$SAVE_MPICXX
MPICXX=$SAVE_MPICXX
fi
if test -n "$SAVE_MPIFC"; then
MPIFC=$SAVE_MPIFC
MPIFC=$SAVE_MPIFC
fi
if test -n "$SAVE_MPILIB"; then
MPILIB=$SAVE_MPILIB
MPILIB=$SAVE_MPILIB
fi
if test -n "$SAVE_MPIINC"; then
MPIINC=$SAVE_MPIINC
MPIINC=$SAVE_MPIINC
fi
if test -n "$SAVE_CFLAGS"; then
CFLAGS="$SAVE_CFLAGS ${CFLAGS}"
CFLAGS="$SAVE_CFLAGS ${CFLAGS}"
fi
if test -n "$SAVE_FFLAGS"; then
FFLAGS=$SAVE_FFLAGS
FFLAGS=$SAVE_FFLAGS
fi
if test -n "$SAVE_MPIROOT"; then
MPIROOT=$SAVE_MPIROOT
MPIROOT=$SAVE_MPIROOT
fi
if test -n "$SAVE_HDF5ROOT"; then
HDF5ROOT=$SAVE_HDF5ROOT
HDF5ROOT=$SAVE_HDF5ROOT
fi
if test -n "$SAVE_LDFLAGS"; then
LDFLAGS=$SAVE_LDFLAGS
LDFLAGS=$SAVE_LDFLAGS
fi
if test -n "$MPICXX"; then
TOOLS_CXX=$MPICXX
TOOLS_H5PART_LIB="-lpH5Part"
TOOLS_HDFLIB="-L$HDF5ROOT/lib -lhdf5"
TOOLS_CXX=$MPICXX
TOOLS_H5PART_LIB="-lpH5Part"
TOOLS_HDFLIB="-L$HDF5ROOT/lib -lhdf5"
else
TOOLS_CXX=$CXX
TOOLS_H5PART_LIB="-lH5Part"
TOOLS_HDFLIB="-L$HDF5ROOT/lib -lhdf5"
TOOLS_CXX=$CXX
TOOLS_H5PART_LIB="-lH5Part"
TOOLS_HDFLIB="-L$HDF5ROOT/lib -lhdf5"
fi
###############################################################################
@@ -581,27 +582,26 @@ AC_OUTPUT
###############################################################################
########################## PRINTING SUMMARY ###################################
###############################################################################
echo
echo
echo "Summary for `(hostname || uname -n) 2>/dev/null | sed 1q`:"
echo
echo "Host OS: $host_os"
echo "Host CPU: $host_cpu"
echo "Host vendor: $host_vendor"
echo "Build libraries: $MTARGET"
echo "Build test programs: $TTARGET"
echo "Build tools: $BUILD_TOOLS"
echo "CC = $CC"
echo "CXX = $CXX"
echo "FC = $FC"
echo "MPICC = $MPICC"
echo "MPICXX = $MPICXX"
echo "MPIFC = $MPIFC"
echo "CFLAGS = $CFLAGS"
echo "FFLAGS = $FFLAGS"
echo "MPILIB = $MPILIB"
echo "MPIINC = $MPIINC"
echo "MPIROOT = $MPIROOT"
echo "HDF5ROOT = $HDF5ROOT"
echo "LDFLAGS = $LDFLAGS"
echo
AC_MSG_RESULT([ ])
AC_MSG_RESULT([Summary:])
AC_MSG_RESULT([ ])
AC_MSG_RESULT([Host OS: $host_os])
AC_MSG_RESULT([Host CPU: $host_cpu])
AC_MSG_RESULT([Host vendor: $host_vendor])
AC_MSG_RESULT([Build libraries: $MTARGET])
AC_MSG_RESULT([Build test programs: $TTARGET])
AC_MSG_RESULT([Build tools: $BUILD_TOOLS])
AC_MSG_RESULT([CC = $CC])
AC_MSG_RESULT([CXX = $CXX])
AC_MSG_RESULT([FC = $FC])
AC_MSG_RESULT([MPICC = $MPICC])
AC_MSG_RESULT([MPICXX = $MPICXX])
AC_MSG_RESULT([MPIFC = $MPIFC])
AC_MSG_RESULT([CFLAGS = $CFLAGS])
AC_MSG_RESULT([FFLAGS = $FFLAGS])
AC_MSG_RESULT([MPILIB = $MPILIB])
AC_MSG_RESULT([MPIINC = $MPIINC])
AC_MSG_RESULT([MPIROOT = $MPIROOT])
AC_MSG_RESULT([HDF5ROOT = $HDF5ROOT])
AC_MSG_RESULT([LDFLAGS = $LDFLAGS])
AC_MSG_RESULT([ ])
+319 -64
View File
@@ -142,6 +142,9 @@ _init (
b->memshape = -1;
b->field_group_id = -1;
b->have_layout = 0;
b->chunk[0] = 0;
b->chunk[1] = 0;
b->chunk[2] = 0;
f->close_block = _close;
@@ -260,7 +263,7 @@ _allgather (
size_t n = sizeof (struct H5BlockPartition) / sizeof (h5part_int64_t);
MPI_Type_contiguous ( n, MPI_LONG_LONG, &partition_m );
MPI_Type_commit ( &partition_m );
MPI_Type_commit ( &partition_m );
MPI_Allgather ( partition, 1, partition_m, layout, 1, partition_m,
f->comm );
@@ -305,8 +308,8 @@ _get_dimension_sizes (
}
#define _NO_GHOSTZONE(p,q) ( (p->i_end < q->i_start) \
|| (p->j_end < q->j_start) \
|| (p->k_end < q->k_start) )
|| (p->j_end < q->j_start) \
|| (p->k_end < q->k_start) )
/*!
@@ -577,11 +580,11 @@ _dissolve_ghostzones (
memset ( p_begin, 0, sizeof ( *p_begin ) );
for ( proc_p = 0, p = b->write_layout;
proc_p < f->nprocs-1;
proc_p++, p++ ) {
proc_p < f->nprocs-1;
proc_p++, p++ ) {
for ( proc_q = proc_p+1, q = &b->write_layout[proc_q];
proc_q < f->nprocs;
proc_q++, q++ ) {
proc_q < f->nprocs;
proc_q++, q++ ) {
if ( _have_ghostzone ( p, q ) ) {
p_el = (struct list*) malloc ( sizeof ( *p_el ) );
@@ -632,8 +635,8 @@ _dissolve_ghostzones (
_H5Part_print_debug ("Layout defined by user:");
for ( proc_p = 0, p = b->user_layout;
proc_p < f->nprocs;
proc_p++, p++ ) {
proc_p < f->nprocs;
proc_p++, p++ ) {
_H5Part_print_debug (
"PROC[%d]: proc[%d]: %lld:%lld, %lld:%lld, %lld:%lld ",
f->myproc, proc_p,
@@ -644,8 +647,8 @@ _dissolve_ghostzones (
_H5Part_print_debug ("Layout after dissolving ghost-zones:");
for ( proc_p = 0, p = b->write_layout;
proc_p < f->nprocs;
proc_p++, p++ ) {
proc_p < f->nprocs;
proc_p++, p++ ) {
_H5Part_print_debug (
"PROC[%d]: proc[%d]: %lld:%lld, %lld:%lld, %lld:%lld ",
f->myproc, proc_p,
@@ -692,9 +695,11 @@ _release_hyperslab (
Define the field layout given the dense index space at the actual
time step.
\return \c H5PART_SUCCESS on success<br>
\c H5PART_ERR_MPI<br>
\c H5PART_ERR_HDF5
\par Errors
\c H5PART_ERR_MPI on MPI errors
\c H5PART_ERR_HDF5 on HDF5 errors
\return \c H5PART_SUCCESS on success or error code
*/
h5part_int64_t
H5BlockDefine3DFieldLayout(
@@ -737,14 +742,43 @@ H5BlockDefine3DFieldLayout(
return H5PART_SUCCESS;
}
/*!
\ingroup h5block_c_api
Define the chunk dimensions and enable chunking in the underlying
HDF5 dataset.
\return \c H5PART_SUCCESS
*/
h5part_int64_t
H5BlockDefine3DChunk(
H5PartFile *f, /*!< IN: File handle */
const h5part_int64_t *dims /*!< IN: array containing
the chunk dimensions */
) {
SET_FNAME ( "H5BlockDefine3DChunk" );
INIT( f );
struct H5BlockStruct *b = f->block;
b->chunk[0] = (hsize_t)dims[2];
b->chunk[1] = (hsize_t)dims[1];
b->chunk[2] = (hsize_t)dims[0];
return H5PART_SUCCESS;
}
/*!
\ingroup h5block_c_api
Return partition of processor \c proc as specified with
\c H5BlockDefine3dLayout().
\return \c H5PART_SUCCESS on success.<br>
\c H5PART_ERR_INVAL if proc is invalid.
\par Errors
\c H5PART_ERR_INVAL if proc is invalid.
\return \c H5PART_SUCCESS on success or error code
*/
h5part_int64_t
H5Block3dGetPartitionOfProc (
@@ -783,8 +817,11 @@ H5Block3dGetPartitionOfProc (
Return reduced (ghost-zone free) partition of processor \c proc
as specified with \c H5BlockDefine3dLayout().
\return \c H5PART_SUCCESS on success.<br>
\c H5PART_ERR_INVAL if proc is invalid.
\par Errors
\c H5PART_ERR_LAYOUT if no partitioning defined
\c H5PART_ERR_INVAL if proc is invalid.
\return \c H5PART_SUCCESS on success or error code
*/
h5part_int64_t
H5Block3dGetReducedPartitionOfProc (
@@ -824,7 +861,11 @@ H5Block3dGetReducedPartitionOfProc (
Returns the processor computing the reduced (ghostzone-free)
partition given by the coordinates \c i, \c j and \c k.
\return \c H5PART_SUCCESS or error code
\par Errors
\c H5PART_ERR_LAYOUT if no partitioning defined.
\c H5PART_ERR_INVAL if given point is not in a partition.
\return \c processor id or error code
*/
h5part_int64_t
H5Block3dGetProcOf (
@@ -848,7 +889,7 @@ H5Block3dGetProcOf (
return (h5part_int64_t)proc;
}
return -1;
return H5PART_ERR_INVAL;
}
/********************** helper functions for reading and writing *************/
@@ -874,7 +915,14 @@ _open_block_group (
}
if ( b->blockgroup < 0 ) {
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
hid_t herr = H5Gopen2 (
f->timegroup,
H5BLOCK_GROUPNAME_BLOCK,
H5P_DEFAULT );
#else
hid_t herr = H5Gopen ( f->timegroup, H5BLOCK_GROUPNAME_BLOCK );
#endif
if ( herr < 0 ) return HANDLE_H5G_OPEN_ERR ( H5BLOCK_GROUPNAME_BLOCK );
b->blockgroup = herr;
}
@@ -920,7 +968,11 @@ _open_field_group (
if ( ! _have_object ( b->blockgroup, name ) )
return HANDLE_H5PART_NOENT_ERR ( name );
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
herr_t herr = H5Gopen2 ( b->blockgroup, name, H5P_DEFAULT );
#else
herr_t herr = H5Gopen ( b->blockgroup, name );
#endif
if ( herr < 0 ) return HANDLE_H5G_OPEN_ERR ( name );
b->field_group_id = herr;
@@ -1045,12 +1097,17 @@ h5part_int64_t
_read_data (
H5PartFile *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to read */
h5part_float64_t *data /*!< OUT: ptr to read buffer */
void *data, /*!< OUT: ptr to read buffer */
hid_t type /*!< IN: data type */
) {
struct H5BlockStruct *b = f->block;
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
hid_t dataset_id = H5Dopen2 ( b->field_group_id, name, H5P_DEFAULT );
#else
hid_t dataset_id = H5Dopen ( b->field_group_id, name );
#endif
if ( dataset_id < 0 ) return HANDLE_H5D_OPEN_ERR ( name );
h5part_int64_t herr = _select_hyperslab_for_reading ( f, dataset_id );
@@ -1058,7 +1115,7 @@ _read_data (
herr = H5Dread (
dataset_id,
H5T_NATIVE_DOUBLE,
type,
f->block->memshape,
f->block->diskshape,
H5P_DEFAULT,
@@ -1071,18 +1128,101 @@ _read_data (
return H5PART_SUCCESS;
}
h5part_int64_t
h5b_read_scalar_field (
H5PartFile *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *dataset_name, /*!< IN: name of dataset to write */
void *data, /*!< OUT: ptr to read buffer */
const hid_t type /*!< IN: data type */
) {
INIT ( f );
CHECK_TIMEGROUP ( f );
CHECK_LAYOUT ( f );
h5part_int64_t herr = _open_field_group ( f, field_name );
if ( herr < 0 ) return herr;
herr = _read_data ( f, dataset_name, data, type );
if ( herr < 0 ) return herr;
herr = _close_field_group ( f );
if ( herr < 0 ) return herr;
return H5PART_SUCCESS;
}
/*!
\ingroup h5block_c_api
Read a 3-dimensional field \c name into the buffer starting at \c data from
the current time-step using the defined field layout. Values are real valued
scalars.
scalars (64-bit).
You must use the FORTRAN indexing scheme to access items in \c data.
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5Block3dReadScalarFieldFloat64 (
H5PartFile *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to read */
h5part_float64_t *data /*!< OUT: ptr to read buffer */
) {
SET_FNAME ( __func__ );
return h5b_read_scalar_field ( f, name, "0", data, H5T_NATIVE_DOUBLE );
}
/*!
\ingroup h5block_c_api
Read a 3-dimensional field \c name into the buffer starting at \c data from
the current time-step using the defined field layout. Values are real valued
scalars (32-bit).
You must use the FORTRAN indexing scheme to access items in \c data.
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5Block3dReadScalarFieldFloat32 (
H5PartFile *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to read */
h5part_float32_t *data /*!< OUT: ptr to read buffer */
) {
SET_FNAME ( __func__ );
return h5b_read_scalar_field ( f, name, "0", data, H5T_NATIVE_FLOAT );
}
/*!
\ingroup h5block_c_api
Read a 3-dimensional field \c name into the buffer starting at \c data from
the current time-step using the defined field layout. Values are integer
valued scalars (64-bit).
You must use the FORTRAN indexing scheme to access items in \c data.
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5Block3dReadScalarFieldInt64 (
H5PartFile *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to read */
h5part_int64_t *data /*!< OUT: ptr to read buffer */
) {
SET_FNAME ( __func__ );
return h5b_read_scalar_field ( f, name, "0", data, H5T_NATIVE_INT64 );
}
/*!
\ingroup h5block_c_api
This funciton is deprecated in favor of \c H5BlockReadFieldFloat64.
*/
h5part_int64_t
H5Block3dReadScalarField (
H5PartFile *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to read */
@@ -1090,20 +1230,7 @@ H5Block3dReadScalarField (
) {
SET_FNAME ( "H5Block3dReadScalarField" );
INIT ( f );
CHECK_TIMEGROUP ( f );
CHECK_LAYOUT ( f );
h5part_int64_t herr = _open_field_group ( f, name );
if ( herr < 0 ) return herr;
herr = _read_data ( f, "0", data );
if ( herr < 0 ) return herr;
herr = _close_field_group ( f );
if ( herr < 0 ) return herr;
return H5PART_SUCCESS;
return h5b_read_scalar_field ( f, name, "0", data, H5T_NATIVE_DOUBLE );
}
/*!
@@ -1135,11 +1262,11 @@ H5Block3dRead3dVectorField (
h5part_int64_t herr = _open_field_group ( f, name );
if ( herr < 0 ) return herr;
herr = _read_data ( f, "0", x_data );
herr = _read_data ( f, "0", x_data, H5T_NATIVE_DOUBLE );
if ( herr < 0 ) return herr;
herr = _read_data ( f, "1", y_data );
herr = _read_data ( f, "1", y_data, H5T_NATIVE_DOUBLE );
if ( herr < 0 ) return herr;
herr = _read_data ( f, "2", z_data );
herr = _read_data ( f, "2", z_data, H5T_NATIVE_DOUBLE );
if ( herr < 0 ) return herr;
herr = _close_field_group ( f );
@@ -1287,7 +1414,16 @@ _create_block_group (
f->block->blockgroup = -1;
}
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
herr = H5Gcreate2 (
f->timegroup,
H5BLOCK_GROUPNAME_BLOCK,
H5P_DEFAULT,
H5P_DEFAULT,
H5P_DEFAULT );
#else
herr = H5Gcreate ( f->timegroup, H5BLOCK_GROUPNAME_BLOCK, 0 );
#endif
if ( herr < 0 ) return HANDLE_H5G_CREATE_ERR ( H5BLOCK_GROUPNAME_BLOCK );
f->block->blockgroup = herr;
@@ -1324,7 +1460,16 @@ _create_field_group (
if ( _have_object ( b->blockgroup, name ) )
return HANDLE_H5PART_GROUP_EXISTS_ERR ( name );
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
herr_t herr = H5Gcreate2 (
b->blockgroup,
name,
H5P_DEFAULT,
H5P_DEFAULT,
H5P_DEFAULT );
#else
herr_t herr = H5Gcreate ( b->blockgroup, name, 0 );
#endif
if ( herr < 0 ) return HANDLE_H5G_CREATE_ERR ( name );
b->field_group_id = herr;
@@ -1342,24 +1487,47 @@ h5part_int64_t
_write_data (
H5PartFile *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5part_float64_t *data /*!< IN: data to write */
const void *data, /*!< IN: data to write */
const hid_t type /*!< IN: data type */
) {
herr_t herr;
hid_t dataset;
hid_t create_prop = H5P_DEFAULT;
struct H5BlockStruct *b = f->block;
if ( b->chunk[0] > 0 &&
b->chunk[1] > 0 &&
b->chunk[2] > 0)
{
create_prop = H5Pcreate( H5P_DATASET_CREATE );
herr = H5Pset_chunk ( create_prop, 3, b->chunk );
if ( herr < 0 ) return HANDLE_H5P_SET_CHUNK_ERR;
}
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
dataset = H5Dcreate2 (
b->field_group_id,
name,
type,
b->shape,
H5P_DEFAULT,
create_prop,
H5P_DEFAULT );
#else
dataset = H5Dcreate (
b->field_group_id,
name,
H5T_NATIVE_DOUBLE,
type,
b->shape,
H5P_DEFAULT );
create_prop );
#endif
if ( dataset < 0 ) return HANDLE_H5D_CREATE_ERR ( name, f->timestep );
herr = H5Dwrite (
dataset,
H5T_NATIVE_DOUBLE,
type,
b->memshape,
b->diskshape,
H5P_DEFAULT,
@@ -1369,6 +1537,36 @@ _write_data (
herr = H5Dclose ( dataset );
if ( herr < 0 ) return HANDLE_H5D_CLOSE_ERR;
if ( create_prop != H5P_DEFAULT ) {
herr = H5Pclose ( create_prop );
if ( herr < 0 ) return HANDLE_H5P_CLOSE_ERR ( "create_prop" );
}
return H5PART_SUCCESS;
}
h5part_int64_t
h5b_write_scalar_field (
H5PartFile *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *dataset_name, /*!< IN: name of dataset to write */
const void *data, /*!< IN: scalar data to write */
const hid_t type /*!< IN: data type */
) {
INIT ( f );
CHECK_WRITABLE_MODE ( f );
CHECK_TIMEGROUP ( f );
CHECK_LAYOUT ( f );
h5part_int64_t herr = _create_field_group ( f, field_name );
if ( herr < 0 ) return herr;
herr = _write_data ( f, dataset_name, data, type );
if ( herr < 0 ) return herr;
herr = _close_field_group ( f );
if ( herr < 0 ) return herr;
return H5PART_SUCCESS;
}
@@ -1377,35 +1575,81 @@ _write_data (
Write a 3-dimensional field \c name from the buffer starting at \c data
to the current time-step using the defined field layout. Values are real
valued scalars.
valued scalars (64-bit).
You must use the FORTRAN indexing scheme to access items in \c data.
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5Block3dWriteScalarFieldFloat64 (
H5PartFile *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5part_float64_t *data /*!< IN: scalar data to write */
) {
SET_FNAME ( __func__ );
return h5b_write_scalar_field ( f, name, "0", data, H5T_NATIVE_DOUBLE );
}
/*!
\ingroup h5block_c_api
Write a 3-dimensional field \c name from the buffer starting at \c data
to the current time-step using the defined field layout. Values are real
valued scalars (32-bit).
You must use the FORTRAN indexing scheme to access items in \c data.
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5Block3dWriteScalarFieldFloat32 (
H5PartFile *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5part_float32_t *data /*!< IN: scalar data to write */
) {
SET_FNAME ( __func__ );
return h5b_write_scalar_field ( f, name, "0", data, H5T_NATIVE_FLOAT );
}
/*!
\ingroup h5block_c_api
Write a 3-dimensional field \c name from the buffer starting at \c data
to the current time-step using the defined field layout. Values are integer
valued scalars (64-bit).
You must use the FORTRAN indexing scheme to access items in \c data.
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5Block3dWriteScalarFieldInt64 (
H5PartFile *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5part_int64_t *data /*!< IN: scalar data to write */
) {
SET_FNAME ( __func__ );
return h5b_write_scalar_field ( f, name, "0", data, H5T_NATIVE_INT64 );
}
/*!
\ingroup h5block_c_api
This function is deprecated in favor of \c H5BlockWriteFieldFloat64.
*/
h5part_int64_t
H5Block3dWriteScalarField (
H5PartFile *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5part_float64_t *data /*!< IN: scalar data to write */
) {
SET_FNAME ( "H5Block3dWriteScalarField" );
INIT ( f );
CHECK_WRITABLE_MODE ( f );
CHECK_TIMEGROUP ( f );
CHECK_LAYOUT ( f );
h5part_int64_t herr = _create_field_group ( f, name );
if ( herr < 0 ) return herr;
herr = _write_data ( f, "0", data );
if ( herr < 0 ) return herr;
herr = _close_field_group ( f );
if ( herr < 0 ) return herr;
return H5PART_SUCCESS;
SET_FNAME ( __func__ );
return h5b_write_scalar_field ( f, name, "0", data, H5T_NATIVE_DOUBLE );
}
/*!
@@ -1439,11 +1683,11 @@ H5Block3dWrite3dVectorField (
h5part_int64_t herr = _create_field_group ( f, name );
if ( herr < 0 ) return herr;
herr = _write_data ( f, "0", x_data );
herr = _write_data ( f, "0", x_data, H5T_NATIVE_DOUBLE );
if ( herr < 0 ) return herr;
herr = _write_data ( f, "1", y_data );
herr = _write_data ( f, "1", y_data, H5T_NATIVE_DOUBLE );
if ( herr < 0 ) return herr;
herr = _write_data ( f, "2", z_data );
herr = _write_data ( f, "2", z_data, H5T_NATIVE_DOUBLE );
if ( herr < 0 ) return herr;
herr = _close_field_group ( f );
@@ -1498,10 +1742,21 @@ _get_field_info (
h5part_int64_t herr = _open_block_group ( f );
if ( herr < 0 ) return herr;
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
hid_t group_id = H5Gopen2 (
f->block->blockgroup,
field_name,
H5P_DEFAULT );
#else
hid_t group_id = H5Gopen ( f->block->blockgroup, field_name );
#endif
if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR ( field_name );
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
hid_t dataset_id = H5Dopen2 ( group_id, "0", H5P_DEFAULT );
#else
hid_t dataset_id = H5Dopen ( group_id, "0" );
#endif
if ( dataset_id < 0 ) return HANDLE_H5D_OPEN_ERR ( "0" );
hid_t dataspace_id = H5Dget_space ( dataset_id );
+42
View File
@@ -53,6 +53,27 @@ H5Block3dGetProcOf (
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
H5Block3dWriteScalarField (
H5PartFile *f,
@@ -60,6 +81,27 @@ H5Block3dWriteScalarField (
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
H5Block3dReadScalarField (
H5PartFile *f,
+1
View File
@@ -18,6 +18,7 @@ struct H5BlockStruct {
struct H5BlockPartition *user_layout;
struct H5BlockPartition *write_layout;
int have_layout;
hsize_t chunk[3];
hid_t shape;
hid_t memshape;
+177 -6
View File
@@ -119,6 +119,9 @@ _file_is_valid (
*/
static herr_t
_h5_error_handler (
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
hid_t,
#endif
void *
);
@@ -185,8 +188,17 @@ _H5Part_open_file (
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) {
HANDLE_H5P_SET_FAPL_MPIO_ERR;
#endif
HANDLE_H5P_SET_FAPL_ERR;
goto error_cleanup;
}
@@ -565,7 +577,7 @@ H5PartSetNumParticles (
start[0] += f->pnparticles[i];
}
/* compute total nparticles */
/* compute total nparticles */
total = 0;
for (i=0; i < f->nprocs; i++) {
total += f->pnparticles[i];
@@ -617,12 +629,23 @@ _write_data (
"timestep %lld",
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 (
f->timegroup,
name,
type,
f->shape,
H5P_DEFAULT );
#endif
if ( dataset_id < 0 )
return HANDLE_H5D_CREATE_ERR ( name, f->timestep );
@@ -700,6 +723,52 @@ H5PartWriteDataFloat64 (
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
@@ -799,7 +868,11 @@ _H5Part_read_attrib (
hid_t mytype;
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 );
#endif
if ( attrib_id <= 0 ) return HANDLE_H5A_OPEN_NAME_ERR( attrib_name );
mytype = H5Aget_type ( attrib_id );
@@ -845,12 +918,22 @@ _H5Part_write_attrib (
if ( space_id < 0 )
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 (
id,
attrib_name,
attrib_type,
space_id,
H5P_DEFAULT );
#endif
if ( attrib_id < 0 ) return HANDLE_H5A_CREATE_ERR ( attrib_name );
herr = H5Awrite ( attrib_id, attrib_type, attrib_value);
@@ -944,7 +1027,11 @@ H5PartWriteFileAttribString (
CHECK_FILEHANDLE ( 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,"/");
#endif
if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" );
h5part_int64_t herr = _H5Part_write_attrib (
@@ -1083,7 +1170,11 @@ H5PartWriteFileAttrib (
CHECK_FILEHANDLE ( 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,"/");
#endif
if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" );
herr = _H5Part_write_attrib (
@@ -1141,7 +1232,11 @@ H5PartGetNumFileAttribs (
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, "/" );
#endif
if ( group_id < 0 ) HANDLE_H5G_OPEN_ERR ( "/" );
nattribs = H5Aget_num_attrs ( group_id );
@@ -1170,7 +1265,7 @@ h5part_int64_t
H5PartGetStepAttribInfo (
H5PartFile *f, /*!< [in] Handle to open file */
const h5part_int64_t attrib_idx,/*!< [in] Index of attribute to
get infos about */
get infos about */
char *attrib_name, /*!< [out] Name of attribute */
const h5part_int64_t len_of_attrib_name,
/*!< [in] length of buffer \c name */
@@ -1213,7 +1308,7 @@ h5part_int64_t
H5PartGetFileAttribInfo (
H5PartFile *f, /*!< [in] Handle to open file */
const h5part_int64_t attrib_idx,/*!< [in] Index of attribute to get
infos about */
infos about */
char *attrib_name, /*!< [out] Name of attribute */
const h5part_int64_t len_of_attrib_name,
/*!< [in] length of buffer \c name */
@@ -1227,7 +1322,11 @@ H5PartGetFileAttribInfo (
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,"/");
#endif
if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" );
herr = _H5Part_get_attrib_info (
@@ -1292,7 +1391,11 @@ H5PartReadFileAttrib (
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,"/");
#endif
if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" );
herr = _H5Part_read_attrib ( group_id, attrib_name, attrib_value );
@@ -1348,7 +1451,11 @@ _H5Part_set_step (
(long long)step,
(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 );
#endif
if ( f->timegroup < 0 ) return HANDLE_H5G_OPEN_ERR( name );
}
else {
@@ -1358,7 +1465,16 @@ _H5Part_set_step (
(long long)step,
(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 );
#endif
if ( f->timegroup < 0 ) return HANDLE_H5G_CREATE_ERR ( name );
}
@@ -1689,7 +1805,11 @@ H5PartGetDatasetInfo (
*nelem = _H5Part_get_num_particles ( f );
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 );
#endif
if ( dataset_id < 0 ) HANDLE_H5D_OPEN_ERR ( dataset_name );
mytype = H5Dget_type ( dataset_id );
@@ -1801,7 +1921,11 @@ _H5Part_get_num_particles (
dataset_name, sizeof (dataset_name) );
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 );
#endif
if ( dataset_id < 0 )
return HANDLE_H5D_OPEN_ERR ( dataset_name );
@@ -2166,7 +2290,11 @@ _read_data (
h5part_int64_t h5err = _H5Part_set_step ( f, f->timestep );
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 );
#endif
if ( dataset_id < 0 ) return HANDLE_H5D_OPEN_ERR ( name );
space_id = _get_diskshape_for_reading ( f, dataset_id );
@@ -2245,6 +2373,37 @@ H5PartReadDataFloat64 (
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
@@ -2456,7 +2615,11 @@ _init ( void ) {
herr_t r5;
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 );
#endif
if ( r5 < 0 ) return H5PART_ERR_INIT;
}
__init = 1;
@@ -2465,10 +2628,18 @@ _init ( void ) {
/*! @} */
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 ) {
#endif
if ( _debug >= 5 ) {
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
H5Eprint2 (H5E_DEFAULT,stderr);
#else
H5Eprint (stderr);
#endif
}
return 0;
}
@@ -2577,9 +2748,9 @@ _H5Part_print_debug (
void
_H5Part_set_funcname (
char * const fname
const char * const fname
) {
__funcname = fname;
__funcname = (char* const) fname;
}
const char *
+15
View File
@@ -82,6 +82,14 @@ H5PartWriteDataFloat64 (
const h5part_float64_t *array
);
h5part_int64_t
H5PartWriteDataFloat32 (
H5PartFile *f,
const char *name,
const h5part_float32_t *array
);
h5part_int64_t
H5PartWriteDataInt64 (
H5PartFile *f,
@@ -172,6 +180,13 @@ H5PartReadDataFloat64(
h5part_float64_t *array
);
h5part_int64_t
H5PartReadDataFloat32(
H5PartFile *f,
const char *name,
h5part_float32_t *array
);
h5part_int64_t
H5PartReadDataInt64 (
H5PartFile *f,
+8 -2
View File
@@ -38,7 +38,7 @@
"Called with bad filehandle." );
#define HANDLE_H5PART_INIT_ERR \
(*_err_handler) ( \
(*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_INIT, \
"Cannot initialize H5Part." );
@@ -258,13 +258,19 @@
"MPI: Cannot set data transfer mode." );
#define HANDLE_H5P_SET_FAPL_MPIO_ERR \
#define HANDLE_H5P_SET_FAPL_ERR \
(*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_HDF5, \
"Cannot store IO communicator information to the " \
"file access property list.");
#define HANDLE_H5P_SET_CHUNK_ERR \
(*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_HDF5, \
"Cannot set chunk dimensions." );
/* H5S: dataspace */
#define HANDLE_H5S_CREATE_SIMPLE_ERR( n ) \
(*_err_handler) ( \
+1 -1
View File
@@ -42,7 +42,7 @@ _H5Part_iteration_operator (
void
_H5Part_set_funcname (
char * const fname
const char * const fname
);
const char *
+1
View File
@@ -11,6 +11,7 @@ typedef __int64 int64_t;
typedef int64_t h5part_int64_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*,...)
#ifdef __GNUC__
__attribute__ ((format (printf, 3, 4)))
+3 -3
View File
@@ -33,7 +33,7 @@ _write_data (
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 ( j = 0; j < j_dims; j++ ) {
for ( k = 0; k < k_dims; k++ ) {
@@ -170,7 +170,7 @@ _read_data (
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 (
f,
@@ -179,7 +179,7 @@ _read_data (
layout->k_start, layout->k_end );
if ( herr < 0 ) return herr;
herr = H5Block3dReadScalarField ( f, "TestField", data );
herr = H5Block3dReadScalarField ( f, "TestField", data );
if ( herr < 0 ) return herr;
for ( i = 0; i < i_dims; i++ ) {
+7
View File
@@ -48,6 +48,13 @@ h5pToGNUplot_SOURCES = h5pToGNUplot.cc
# Specific building instruction (What compilers to use...)
# ------------ 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
$(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;
}