Compare commits

...

14 Commits

Author SHA1 Message Date
Marc Howison 1cd47a604a 1.6.1 tag 2010-06-21 15:39:41 +00:00
Marc Howison e3b93e4383 removed redundant VFD code in _H5Part_open and added an option for CORE VFD 2010-05-13 17:54:38 +00:00
Marc Howison 3e99a8ccfa fixed autoconf issue with PGI compilers and #define issue with OpenMPI 2010-05-03 20:04:34 +00:00
Marc Howison bb41cc3288 added documentation for file open flags; added flags to h5pt_openr_par_align(); added H5PartSetViewEmpty() and h5pt_setview_empty() calls for creating empty hyperslab selections (previously kludge was to use H5PartSetViewIndices with a null list); fixed memory leak with file open flags in the Fortran interface; fixed missing statement in 1.6.x logic for _H5Part_have_group() 2010-04-29 16:17:51 +00:00
Marc Howison cf1368291d fixed the H5PART_HAVE_HDF5_18 logic to work with the 1.9 snapshot; fixed broken test in _H5Part_have_group in the codepath for HDF5 1.6 2010-03-23 22:18:40 +00:00
Marc Howison 698b5e0c76 removed config.h.in 2010-03-11 23:04:27 +00:00
Marc Howison ea40b3272e fixes to lustre optimizations 2010-03-11 23:00:43 +00:00
Marc Howison 90f8506628 changed print functions to only print from proc 0 in parallel mode, except for 'debug detail' level which prints from all procs 2010-02-23 19:45:43 +00:00
Marc Howison a7727635a7 reverted the rename of xfer_prop because it is used in OPAL 2010-02-22 21:18:37 +00:00
Marc Howison 66476adf6a removed overloaded use of H5_USE_16_API so that it can be used with HDF 1.85 without invoking the HDF5 1.6 codepath in places 2010-02-22 18:35:37 +00:00
Marc Howison 1c4c62192d added chunking for H5Part; had to remove open object test because out-of-order file handle / property list closes were causing errors 2010-02-18 21:08:03 +00:00
Marc Howison fb660f8459 changed throttling routine; removed read-only restriction for setting step to existing steps; revised NEWS 2010-02-18 18:56:39 +00:00
Marc Howison 20bff7f87c fixes for HDF5 1.6.x 2010-02-17 03:19:20 +00:00
Marc Howison 64c2b96f27 incorporated fixes from Gunther for 1.6.0 release 2010-02-16 18:46:57 +00:00
21 changed files with 629 additions and 390 deletions
+2 -1
View File
@@ -10,7 +10,6 @@
/README -text
/autogen.sh -text
/config.guess -text
/config.h.in -text
/config.sub -text
/configure-crayxt -text
/configure.ac -text
@@ -19,7 +18,9 @@ doc/Doxyfile -text
doc/H5X_File_Format.txt -text
doc/Makefile.am -text
doc/doxyfooter -text
examples/simplef.F90 -text
examples/stridedf.F90 -text
examples/write_setview.c -text
/install-sh -text
/license.txt -text
/missing -text
+2
View File
@@ -7,6 +7,8 @@ SUBDIRS = \
test \
tools
EXTRA_DIST = configure-crayxt
MAINTAINERCLEANFILES = \
config.h \
config.log \
+39 -1
View File
@@ -1,3 +1,41 @@
#### H5PART 1.6.1 ############################################################
Chunking in the H5Part API
--------------------------
There is now an H5Part equivalent H5PartSetChunkSize to the existing
H5BlockDefine3DChunkDims call. Both of these calls enable the chunking
mechanism in the underlying HDF5 layer. Chunking is used in combination
with the aligned open calls to pad datasets to alignment multiples
on disk.
All Steps Available on Write
----------------------------
Previously, existing steps in a file were only accessible in read-only mode.
Now, all steps are available in all modes, including write-truncate and
write-append. Thus, it is now possible to overwrite existing data in write
mode. To help alert the user to this possibility, a warning is issued every
time an existing dataset is written to. Warnings can be printed by setting
the verbosity to H5PART_VERB_WARN or higher.
New Throttling Routine
----------------------
Previously, a throttle factor of N meant that for P processors, the total
number of P writes were divided into N batches of P/N writes.
To better accommodate round-robin lustre striping, the new policy is to
execute P/N batches of N writes. Thus, matching N to the number of stripes
results in the desirable 1-1 matching of writers to stripes.
Other Fixes
-----------
* The configure script should correctly detect PGI compilers now.
* There was a small memory leak in the Fortran file open calls.
* There was a compile error with HDF5 1.6.x due to a missing assignment.
#### H5PART 1.6 ##############################################################
Updated Documentation
@@ -122,7 +160,7 @@ calls.
Previously, a user could overrun internal buffers for dataset names. Now, a
fixed limit of 64 chars is imposed. Dataset names that are longer than this are
truncated and a warning is printed. We expect that most users are using
short canoncical names like x, px, id, etc.
short canonical names like x, px, id, etc.
Changes to Existing API
-----------------------
-99
View File
@@ -1,99 +0,0 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* "" */
#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
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Version number of package */
#undef VERSION
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
+6 -5
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.6.0], [h5part@lists.psi.ch], H5Part)
AC_INIT([H5Part], [1.6.1], [h5part@lists.psi.ch], H5Part)
# Ensure that a recent enough version of Autoconf is being used.
@@ -168,7 +168,7 @@ fi
# If CC is not already set in the environment, check for gcc and cc, then
# for other C compilers.
# Set output variable CC to the name of the compiler found.
AC_PROG_CC(pathcc icc cc_r gcc cc)
AC_PROG_CC(pgcc pathcc icc cc_r gcc cc)
# AC_PROG_CC doesn't pick up cc_r in Bassi. The following AC_PATH_PROGS
# is the fix.
@@ -189,7 +189,7 @@ fi
# then search for a C++ compiler under the likely names (first g++ and c++
# then other names).
# If none of those checks succeed, then as a last resort set CXX to g++.
AC_PROG_CXX(pathCC icc cc_r g++ gcc cc)
AC_PROG_CXX(pgCC pathCC icc cc_r g++ gcc cc)
# Set output variable INSTALL to the path of a BSD-compatible install program,
@@ -248,7 +248,8 @@ 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
if test "X$USE_64:/f90
" = "Xyes"; then
AC_MSG_RESULT([yes])
if test $uname = "AIX"; then
CFLAGS="$CFLAGS -q64"
@@ -269,7 +270,7 @@ AC_MSG_CHECKING([if fortran interface enabled])
if test "X$USE_FORTRAN" = "Xyes"; then
AC_MSG_RESULT([yes])
AC_PROG_FC(ifort xlf_r pathf90 g95 g90 ftn gfortran)
AC_PROG_FC(pgf90 ifort xlf_r pathf90 g95 g90 ftn gfortran)
if test -z "$FC" ; then
AC_MSG_ERROR([Cannot find a fortran compiler!!!])
exit 1
+1 -1
View File
@@ -4,7 +4,7 @@
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = H5Part
PROJECT_NUMBER = 1.6.0
PROJECT_NUMBER = 1.6.1
OUTPUT_DIRECTORY = ./ReferencePages
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
+49
View File
@@ -0,0 +1,49 @@
program H5PartTest
implicit none
include 'mpif.h'
include 'H5PartF.h'
integer :: comm, rank, ierr
integer*8 :: file_id, status, npoints, i
real*8, allocatable :: particles(:)
integer*8, allocatable :: id(:)
comm = MPI_COMM_WORLD
call mpi_init(ierr)
call mpi_comm_rank(comm, rank, ierr)
! open the a file for parallel writing
file_id = h5pt_openw_par('test.h5', comm)
! in the Fortran API, time steps start at 1
status = h5pt_setstep(file_id, 1_8)
! write an attribute to the file
status = h5pt_writefileattrib_string(file_id, 'desc', 'This is a test.')
! create fake data
npoints = 99
allocate(particles(npoints), id(npoints))
do i=1,npoints
particles(i) = real(i+npoints*rank)
id(i) = i+npoints*rank
enddo
! set the size of the 1D array
status = h5pt_setnpoints(file_id, npoints)
! write the particles
status = h5pt_writedata_r8(file_id, "x", particles)
! write the ids
status = h5pt_writedata_i8(file_id, "id", id)
! close the file
status = h5pt_close(file_id)
deallocate(particles, id)
call mpi_finalize(ierr)
end program H5PartTest
+57
View File
@@ -0,0 +1,57 @@
#include <stdlib.h>
#include <assert.h>
#include <mpi.h>
#include <H5Part.h>
#define DATASIZE 32
#define ITERS 4
int main(int argc, char** argv)
{
int i, rank, nprocs;
h5part_int32_t data[ITERS*DATASIZE];
h5part_int64_t stat;
h5part_int64_t offset;
H5PartFile *file;
// initialize MPI
MPI_Init (&argc, &argv);
MPI_Comm_rank (MPI_COMM_WORLD, &rank);
MPI_Comm_size (MPI_COMM_WORLD, &nprocs);
H5PartSetVerbosityLevel(H5PART_VERB_DEBUG);
file = H5PartOpenFileParallel("test.h5", H5PART_WRITE, MPI_COMM_WORLD);
assert (file != NULL);
stat = H5PartSetStep(file, 0);
assert (stat == H5PART_SUCCESS);
stat = H5PartSetNumParticles(file, ITERS*DATASIZE);
assert (stat == H5PART_SUCCESS);
// create fake data
for (i=0; i<ITERS*DATASIZE; i++) {
data[i] = i + rank * ITERS * DATASIZE;
}
offset = rank * ITERS * DATASIZE;
// iterate over arrays
for (i=0; i<ITERS; i++) {
// set the "view" to select a subset of the dataset
stat = H5PartSetView(file,
offset + i*DATASIZE,
offset + (i+1)*DATASIZE - 1);
assert (stat == H5PART_SUCCESS);
// write the data
stat = H5PartWriteDataInt32(file, "data", data + i*DATASIZE);
assert (stat == H5PART_SUCCESS);
}
H5PartCloseFile(file);
MPI_Finalize();
return EXIT_SUCCESS;
}
+27 -2
View File
@@ -721,8 +721,13 @@ _release_hyperslab (
/*!
\ingroup h5block_model
Define the field layout given the dense index space at the actual
time step.
Defines the partition of the field that this processor owns, using
Fortran ordering: the fastest moving index is \c i.
This routine uses an MPI_Allgather, so at large concurrency it should
be called as infrequently as possible. For instance, if several timesteps
use the same field dimensions, set the layout only once before the
first timestep.
\return \c H5PART_SUCCESS on success<br>
\c H5PART_ERR_MPI<br>
@@ -1186,6 +1191,11 @@ _H5Block_read_data (
herr = _H5Block_select_hyperslab_for_reading ( f, dataset_id );
if ( herr < 0 ) return herr;
#ifdef PARALLEL_IO
herr = _H5Part_start_throttle ( f );
if ( herr < 0 ) return herr;
#endif
herr = H5Dread (
dataset_id,
type,
@@ -1195,6 +1205,11 @@ _H5Block_read_data (
data );
if ( herr < 0 ) return HANDLE_H5D_READ_ERR ( name, f->timestep );
#ifdef PARALLEL_IO
herr = _H5Part_end_throttle ( f );
if ( herr < 0 ) return herr;
#endif
herr = H5Dclose ( dataset_id );
if ( herr < 0 ) return HANDLE_H5D_CLOSE_ERR;
@@ -1443,6 +1458,11 @@ _H5Block_write_data (
);
if ( dataset < 0 ) return HANDLE_H5D_CREATE_ERR ( name, f->timestep );
#ifdef PARALLEL_IO
herr = _H5Part_start_throttle ( f );
if ( herr < 0 ) return herr;
#endif
herr = H5Dwrite (
dataset,
type,
@@ -1452,6 +1472,11 @@ _H5Block_write_data (
data );
if ( herr < 0 ) return HANDLE_H5D_WRITE_ERR ( name, f->timestep );
#ifdef PARALLEL_IO
herr = _H5Part_end_throttle ( f );
if ( herr < 0 ) return herr;
#endif
herr = H5Dclose ( dataset );
if ( herr < 0 ) return HANDLE_H5D_CLOSE_ERR;
+13 -8
View File
@@ -10,8 +10,11 @@
#include "H5MultiBlockErrors.h"
#include "H5MultiBlockPrivate.h"
#ifdef PARALLEL_IO
/*!
\ingroup h5multiblock_write
\ingroup h5multiblock_data
Write a multiblock field \c name from the buffer starting at \c data
to the current time-step using the defined block decomposition and dimensions.
@@ -39,7 +42,7 @@ H5MultiBlock3dWriteFieldFloat64 (
}
/*!
\ingroup h5multiblock_read
\ingroup h5multiblock_data
Allocate a buffer to hold a block from a multiblock field and place the
pointer in \c data, then read the block into the buffer. Uses the block
@@ -68,7 +71,7 @@ H5MultiBlock3dReadFieldFloat64 (
}
/*!
\ingroup h5multiblock_write
\ingroup h5multiblock_data
Write a multiblock field \c name from the buffer starting at \c data
to the current time-step using the defined block decomposition and dimensions.
@@ -96,7 +99,7 @@ H5MultiBlock3dWriteFieldFloat32 (
}
/*!
\ingroup h5multiblock_read
\ingroup h5multiblock_data
Allocate a buffer to hold a block from a multiblock field and place the
pointer in \c data, then read the block into the buffer. Uses the block
@@ -125,7 +128,7 @@ H5MultiBlock3dReadFieldFloat32 (
}
/*!
\ingroup h5multiblock_write
\ingroup h5multiblock_data
Write a multiblock field \c name from the buffer starting at \c data
to the current time-step using the defined block decomposition and dimensions.
@@ -153,7 +156,7 @@ H5MultiBlock3dWriteFieldInt64 (
}
/*!
\ingroup h5multiblock_read
\ingroup h5multiblock_data
Allocate a buffer to hold a block from a multiblock field and place the
pointer in \c data, then read the block into the buffer. Uses the block
@@ -182,7 +185,7 @@ H5MultiBlock3dReadFieldInt64 (
}
/*!
\ingroup h5multiblock_write
\ingroup h5multiblock_data
Write a multiblock field \c name from the buffer starting at \c data
to the current time-step using the defined block decomposition and dimensions.
@@ -210,7 +213,7 @@ H5MultiBlock3dWriteFieldInt32 (
}
/*!
\ingroup h5multiblock_read
\ingroup h5multiblock_data
Allocate a buffer to hold a block from a multiblock field and place the
pointer in \c data, then read the block into the buffer. Uses the block
@@ -237,3 +240,5 @@ H5MultiBlock3dReadFieldInt32 (
return H5PART_SUCCESS;
}
#endif // PARALLEL_IO
+310 -218
View File
@@ -98,6 +98,7 @@ h5part_error_handler _err_handler = H5PartReportErrorHandler;
/********* Private Variable Declarations *************/
static unsigned _is_root_proc = 0;
static unsigned _debug = H5PART_VERB_ERROR;
static h5part_int64_t _h5part_errno = H5PART_SUCCESS;
static char *__funcname;
@@ -125,6 +126,14 @@ _h5_error_handler (
void *
);
static void
_vprint (
FILE* f,
const char *prefix,
const char *fmt,
va_list ap
);
/*========== File Opening/Closing ===============*/
static H5PartFile*
@@ -154,7 +163,7 @@ _H5Part_open_file (
strncpy ( f->groupname_step, H5PART_GROUPNAME_STEP, H5PART_STEPNAME_LEN );
f->stepno_width = 0;
f->xfer_prop = f->create_prop = H5P_DEFAULT;
f->xfer_prop = f->dcreate_prop = f->fcreate_prop = H5P_DEFAULT;
f->access_prop = H5Pcreate (H5P_FILE_ACCESS);
if (f->access_prop < 0) {
@@ -175,6 +184,9 @@ _H5Part_open_file (
goto error_cleanup;
}
if ( f-> myproc == 0 ) _is_root_proc = 1;
else _is_root_proc = 0;
f->pnparticles =
(h5part_int64_t*) malloc (f->nprocs * sizeof (h5part_int64_t));
if (f->pnparticles == NULL) {
@@ -182,69 +194,38 @@ _H5Part_open_file (
goto error_cleanup;
}
/* select the HDF5 VFD */
if (flags & H5PART_VFD_MPIPOSIX) {
if (f->myproc == 0) {
_H5Part_print_info ( "Selecting MPI-POSIX VFD" );
}
if (H5Pset_fapl_mpiposix ( f->access_prop, comm, 0 ) < 0) {
HANDLE_H5P_SET_FAPL_ERR;
goto error_cleanup;
}
}
else {
if (f->myproc == 0) {
_H5Part_print_info ( "Selecting MPI-IO VFD" );
}
if (H5Pset_fapl_mpio ( f->access_prop, comm, info ) < 0) {
HANDLE_H5P_SET_FAPL_ERR;
goto error_cleanup;
}
if (flags & H5PART_VFD_MPIIO_IND) {
if (f->myproc == 0) {
_H5Part_print_info ( "Using independent mode" );
}
} else {
if (f->myproc == 0) {
_H5Part_print_info ( "Using collective mode" );
}
f->xfer_prop = H5Pcreate (H5P_DATASET_XFER);
if (f->xfer_prop < 0) {
HANDLE_H5P_CREATE_ERR;
goto error_cleanup;
}
if (H5Pset_dxpl_mpio ( f->xfer_prop, H5FD_MPIO_COLLECTIVE ) < 0) {
HANDLE_H5P_SET_DXPL_MPIO_ERR;
goto error_cleanup;
}
}
}
/* optional lustre optimizations */
if ( flags & H5PART_FS_LUSTRE )
{
/* extend the btree size so that metadata pieces are
* close to the alignment value */
unsigned int btree_ik = (align - 256) / 96;
unsigned int btree_bytes = 64 + 96*btree_ik;
if ( btree_bytes > align ) {
HANDLE_H5PART_INVALID_ERR(
"btree_ik", btree_ik );
goto error_cleanup;
}
* close to the alignment value */
if ( align > 0 )
{
unsigned int btree_ik = (align - 4096) / 96;
unsigned int btree_bytes = 64 + 96*btree_ik;
if ( btree_bytes > align ) {
HANDLE_H5PART_INVALID_ERR(
"btree_ik", btree_ik );
goto error_cleanup;
}
if (f->myproc == 0) {
_H5Part_print_info (
"Setting HDF5 btree parameter to %u",
btree_ik );
_H5Part_print_info (
"Extending HDF5 btree size to %u bytes at rank 3",
btree_bytes );
"Extending HDF5 btree size to %u "
"bytes at rank 3", btree_bytes );
f->fcreate_prop = H5Pcreate(H5P_FILE_CREATE);
if ( f->fcreate_prop < 0 ) {
HANDLE_H5P_CREATE_ERR;
goto error_cleanup;
}
H5Pset_istore_k (f->fcreate_prop, btree_ik);
}
f->create_prop = H5Pcreate(H5P_FILE_CREATE);
H5Pset_istore_k (f->create_prop, H5PART_BTREE_IK);
#ifndef H5_USE_16_API
#ifdef H5PART_HAVE_HDF5_18
/* defer metadata cache flushing until file close */
H5AC_cache_config_t cache_config;
cache_config.version = H5AC__CURR_CACHE_CONFIG_VERSION;
@@ -257,14 +238,50 @@ _H5Part_open_file (
cache_config.decr_mode = H5C_decr__off;
H5Pset_mdc_config (f->access_prop, &cache_config);
#else // H5_USE_16_API
_H5Part_print_info (
"Unable to defer metadata write: need HDF5 1.8");
_H5Part_print_warn (
"Unable to defer metadata write: need HDF5 1.8");
#endif // H5_USE_16_API
}
/* select the HDF5 VFD */
if (flags & H5PART_VFD_MPIPOSIX) {
_H5Part_print_info ( "Selecting MPI-POSIX VFD" );
if (H5Pset_fapl_mpiposix ( f->access_prop, comm, 0 ) < 0) {
HANDLE_H5P_SET_FAPL_ERR;
goto error_cleanup;
}
} else if (flags & H5PART_VFD_CORE) {
_H5Part_print_info ( "Selecting CORE VFD" );
if (H5Pset_fapl_core ( f->access_prop, comm, 0 ) < 0) {
HANDLE_H5P_SET_FAPL_ERR;
goto error_cleanup;
}
} else {
_H5Part_print_info ( "Selecting MPI-IO VFD" );
if (H5Pset_fapl_mpio ( f->access_prop, comm, info ) < 0) {
HANDLE_H5P_SET_FAPL_ERR;
goto error_cleanup;
}
if (flags & H5PART_VFD_MPIIO_IND) {
_H5Part_print_info ( "Using independent mode" );
} else {
_H5Part_print_info ( "Using collective mode" );
f->xfer_prop = H5Pcreate (H5P_DATASET_XFER);
if (f->xfer_prop < 0) {
HANDLE_H5P_CREATE_ERR;
goto error_cleanup;
}
if (H5Pset_dxpl_mpio ( f->xfer_prop, H5FD_MPIO_COLLECTIVE ) < 0) {
HANDLE_H5P_SET_DXPL_MPIO_ERR;
goto error_cleanup;
}
}
}
f->comm = comm;
#endif // PARALLEL_IO
} else {
_is_root_proc = 1;
f->comm = 0;
f->nprocs = 1;
f->myproc = 0;
@@ -273,34 +290,27 @@ _H5Part_open_file (
}
if ( align != 0 ) {
if (f->myproc == 0) {
_H5Part_print_info ( "Setting HDF5 alignment to %ld bytes", align );
}
_H5Part_print_info (
"Setting HDF5 alignment to %ld bytes",
align );
if (H5Pset_alignment ( f->access_prop, 0, align ) < 0) {
HANDLE_H5P_SET_FAPL_ERR;
goto error_cleanup;
}
if (f->myproc == 0) {
_H5Part_print_info ( "Setting HDF5 meta block to %ld bytes", align );
}
_H5Part_print_info (
"Setting HDF5 meta block to %ld bytes",
align );
if (H5Pset_meta_block_size ( f->access_prop, align ) < 0) {
HANDLE_H5P_SET_FAPL_ERR;
goto error_cleanup;
}
/*if (f->myproc == 0) {
_H5Part_print_info ( "Setting HDF5 sieve buffer to %ld bytes", align );
}
if (H5Pset_sieve_buf_size ( f->access_prop, align ) < 0) {
HANDLE_H5P_SET_FAPL_ERR;
goto error_cleanup;
}*/
}
if ( flags & H5PART_READ ) {
f->file = H5Fopen(filename, H5F_ACC_RDONLY, f->access_prop);
}
else if ( flags & H5PART_WRITE ){
f->file = H5Fcreate (filename, H5F_ACC_TRUNC, f->create_prop,
f->file = H5Fcreate (filename, H5F_ACC_TRUNC, f->fcreate_prop,
f->access_prop);
f->empty = 1;
}
@@ -308,7 +318,7 @@ _H5Part_open_file (
int fd = open(filename, O_RDONLY, 0);
if ( (fd == -1) && (errno == ENOENT) ) {
f->file = H5Fcreate(filename, H5F_ACC_TRUNC,
f->create_prop, f->access_prop);
f->fcreate_prop, f->access_prop);
f->empty = 1;
}
else if (fd != -1) {
@@ -367,13 +377,17 @@ _H5Part_open_file (
Opens file with specified filename.
If you open with flag \c H5PART_WRITE, it will truncate any
file with the specified filename and start writing to it. If
you open with \c H5PART_APPEND, then you can append new timesteps.
If you open with \c H5PART_READ, then it will open the file
readonly.
Flags are bit values that can be combined with the bit operator \c |
and include:
The typical extension for these files is \c .h5.
- \c H5PART_WRITE - truncate file and open for writing
- \c H5PART_APPEND - open file for writing without truncating
- \c H5PART_READ - open file read-only
- \c H5PART_FS_LUSTRE - enable optimizations for the Lustre file system
- \c H5PART_VFD_MPIPOSIX - use the HDF5 MPI-POSIX virtual file driver
- \c H5PART_VFD_MPIO_IND - use MPI-IO in indepedent mode
The typical file extension is \c .h5.
H5PartFile should be treated as an essentially opaque
datastructure. It acts as the file handle, but internally
@@ -403,6 +417,23 @@ H5PartOpenFileParallel (
Opens file with specified filename, and also specifices an alignment
value used for HDF5 tuning parameters.
Flags are bit values that can be combined with the bit operator \c |
and include:
- \c H5PART_WRITE - truncate file and open for writing
- \c H5PART_APPEND - open file for writing without truncating
- \c H5PART_READ - open file read-only
- \c H5PART_FS_LUSTRE - enable optimizations for the Lustre file system
- \c H5PART_VFD_MPIPOSIX - use the HDF5 MPI-POSIX virtual file driver
- \c H5PART_VFD_MPIO_IND - use MPI-IO in indepedent mode
The typical file extension is \c .h5.
H5PartFile should be treated as an essentially opaque
datastructure. It acts as the file handle, but internally
it maintains several key state variables associated with
the file.
\return File handle or \c NULL
*/
H5PartFile*
@@ -426,13 +457,14 @@ H5PartOpenFileParallelAlign (
Opens file with specified filename.
If you open with flag \c H5PART_WRITE, it will truncate any
file with the specified filename and start writing to it. If
you open with \c H5PART_APPEND, then you can append new timesteps.
If you open with \c H5PART_READ, then it will open the file
readonly.
Flags are bit values that can be combined with the bit operator \c |
and include:
The typical extension for these files is \c .h5.
- \c H5PART_WRITE - truncate file and open for writing
- \c H5PART_APPEND - open file for writing without truncating
- \c H5PART_READ - open file read-only
The typical file extension is \c .h5.
H5PartFile should be treated as an essentially opaque
datastructure. It acts as the file handle, but internally
@@ -462,6 +494,20 @@ H5PartOpenFile (
Opens file with specified filename, and also specifices an alignment
value used for HDF5 tuning parameters.
Flags are bit values that can be combined with the bit operator \c |
and include:
- \c H5PART_WRITE - truncate file and open for writing
- \c H5PART_APPEND - open file for writing without truncating
- \c H5PART_READ - open file read-only
The typical file extension is \c .h5.
H5PartFile should be treated as an essentially opaque
datastructure. It acts as the file handle, but internally
it maintains several key state variables associated with
the file.
\return File handle or \c NULL
*/
H5PartFile*
@@ -497,12 +543,23 @@ _H5Part_file_is_valid (
return H5PART_ERR_BADFD;
}
/*!
\ingroup h5part_open
Closes an open file.
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
_H5Part_close_hdf_ids (
H5PartCloseFile (
H5PartFile *f /*!< [in] filehandle of the file to close */
) {
SET_FNAME ( "H5PartCloseFile" );
herr_t r = 0;
_h5part_errno = H5PART_SUCCESS;
CHECK_FILEHANDLE ( f );
if ( f->block && f->close_block ) {
(*f->close_block) ( f );
@@ -543,46 +600,28 @@ _H5Part_close_hdf_ids (
if ( r < 0 ) HANDLE_H5P_CLOSE_ERR ( "f->xfer_prop" );
f->xfer_prop = H5P_DEFAULT;
}
if( f->access_prop != H5P_DEFAULT ) {
r = H5Pclose( f->access_prop );
if ( r < 0 ) HANDLE_H5P_CLOSE_ERR ( "f->access_prop" );
f->access_prop = H5P_DEFAULT;
}
if( f->create_prop != H5P_DEFAULT ) {
r = H5Pclose( f->create_prop );
if ( r < 0 ) HANDLE_H5P_CLOSE_ERR ( "f->create_prop" );
f->create_prop = H5P_DEFAULT;
if( f->dcreate_prop != H5P_DEFAULT ) {
r = H5Pclose( f->dcreate_prop );
if ( r < 0 ) HANDLE_H5P_CLOSE_ERR ( "f->dcreate_prop" );
f->dcreate_prop = H5P_DEFAULT;
}
return H5PART_SUCCESS;
}
/*!
\ingroup h5part_open
Closes an open file.
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5PartCloseFile (
H5PartFile *f /*!< [in] filehandle of the file to close */
) {
SET_FNAME ( "H5PartCloseFile" );
herr_t r = 0;
_h5part_errno = H5PART_SUCCESS;
CHECK_FILEHANDLE ( f );
r = _H5Part_close_hdf_ids ( f );
if ( r < 0 ) return r;
if ( f->file ) {
r = H5Fclose( f->file );
if ( r < 0 ) HANDLE_H5F_CLOSE_ERR;
f->file = 0;
}
if( f->access_prop != H5P_DEFAULT ) {
r = H5Pclose( f->access_prop );
if ( r < 0 ) HANDLE_H5P_CLOSE_ERR ( "f->access_prop" );
f->access_prop = H5P_DEFAULT;
}
if( f->fcreate_prop != H5P_DEFAULT ) {
r = H5Pclose( f->fcreate_prop );
if ( r < 0 ) HANDLE_H5P_CLOSE_ERR ( "f->fcreate_prop" );
f->fcreate_prop = H5P_DEFAULT;
}
/* free memory from H5PartFile struct */
if( f->pnparticles ) {
@@ -763,10 +802,10 @@ _set_num_particles (
if ( ret != MPI_SUCCESS) return HANDLE_MPI_ALLGATHER_ERR;
if ( f->myproc == 0 ) {
_H5Part_print_debug ( "Particle offsets:" );
for ( i=0; i<f->nprocs; i++ )
_H5Part_print_debug ( "\t[%d] np=%lld", i,
(long long) f->pnparticles[i] );
_H5Part_print_debug_detail (
"[%d] np=%lld",
i, (long long) f->pnparticles[i] );
}
/* compute start offsets */
@@ -896,6 +935,47 @@ H5PartSetNumParticlesStrided (
return H5PART_SUCCESS;
}
/*!
\ingroup h5part_model
Define the chunk \c size and enables chunking in the underlying
HDF5 layer. When combined with the \c align value in the
\ref H5PartOpenFileAlign or \ref H5PartOpenFileParallelAlign
function, this causes each group of \c size particles to be
padded on disk out to the nearest multiple of \c align bytes.
Note that this policy wastes disk space, but can improve write
bandwidth on parallel filesystems that are sensitive to alignment
to stripe boundaries (e.g. lustre).
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5PartSetChunkSize (
H5PartFile *f,
const h5part_int64_t size
) {
SET_FNAME ( "H5PartSetChunkSize" );
CHECK_FILEHANDLE( f );
_H5Part_print_info (
"Setting chunk size to %lld elements",
(long long)size );
if ( f->dcreate_prop == H5P_DEFAULT ) {
f->dcreate_prop = H5Pcreate (H5P_DATASET_CREATE);
if ( f->dcreate_prop < 0 ) return HANDLE_H5P_CREATE_ERR;
}
hsize_t hsize = (hsize_t)size;
herr_t herr = H5Pset_chunk ( f->dcreate_prop, 1, &hsize );
if ( herr < 0 ) return HANDLE_H5P_SET_CHUNK_ERR;
return H5PART_SUCCESS;
}
static void
_normalize_dataset_name (
const char *name,
@@ -953,23 +1033,19 @@ _write_data (
"Dataset[%s] at timestep %lld "
"already exists", name2, (long long)f->timestep );
} else {
#ifndef H5_USE_16_API
dataset_id = H5Dcreate2 (
f->timegroup,
name2,
type,
f->shape,
H5P_DEFAULT,
H5P_DEFAULT,
H5P_DEFAULT );
#else
dataset_id = H5Dcreate (
f->timegroup,
name2,
type,
f->shape,
H5P_DEFAULT );
#ifndef H5_USE_16_API
H5P_DEFAULT,
f->dcreate_prop,
H5P_DEFAULT
#else
f->dcreate_prop
#endif
);
if ( dataset_id < 0 )
return HANDLE_H5D_CREATE_ERR ( name2, f->timestep );
}
@@ -1259,7 +1335,7 @@ _H5Part_read_attrib (
hid_t space_id;
hid_t type_id;
#ifndef H5_USE_16_API
#ifdef H5PART_HAVE_HDF5_18
if (! H5Aexists ( id, attrib_name )) {
_H5Part_print_warn ( "Attribute '%s' does not exist!", attrib_name );
}
@@ -1851,9 +1927,11 @@ _H5Part_set_step (
char stepname[H5PART_STEPNAME_LEN];
_H5Part_get_step_name(f, step, stepname);
#if H5PART_SET_STEP_READ_ONLY
if ( (!(f->flags & H5PART_READ)) && _H5Part_have_group ( f->file, stepname ) ) {
return HANDLE_H5PART_STEP_EXISTS_ERR ( step );
}
#endif
if ( f->timegroup >= 0 ) {
herr_t herr = H5Gclose ( f->timegroup );
@@ -1862,6 +1940,9 @@ _H5Part_set_step (
f->timegroup = -1;
f->timestep = step;
#if H5PART_SET_STEP_READ_ONLY
// in this mode, existing steps can be selecting only
// for a READ file handle
if ( f->flags & H5PART_READ ) {
_H5Part_print_debug (
"Proc[%d]: Set step to #%lld for file %lld",
@@ -1893,6 +1974,33 @@ _H5Part_set_step (
return HANDLE_H5G_CREATE_ERR ( stepname );
}
#else // H5PART_SET_STEP_READ_ONLY
// in this mode, existing steps can be selected for all file
// handles: first try to open the step, and create it if it
// doesn't exist
H5E_BEGIN_TRY
f->timegroup = H5Gopen ( f->file, stepname
#ifndef H5_USE_16_API
, H5P_DEFAULT
#endif
);
H5E_END_TRY
if ( f->timegroup < 0 )
{
f->timegroup = H5Gcreate( f->file, stepname, 0
#ifndef H5_USE_16_API
, H5P_DEFAULT, H5P_DEFAULT
#endif
);
if ( f->timegroup < 0 )
return HANDLE_H5G_CREATE_ERR ( stepname );
}
#endif // H5PART_SET_STEP_READ_ONLY
return H5PART_SUCCESS;
}
@@ -1937,11 +2045,12 @@ _H5Part_have_group (
const hid_t id,
const char *name
) {
#ifndef H5_USE_16_API
#ifdef H5PART_HAVE_HDF5_18
return (H5Lexists( id, name, H5P_DEFAULT ) ? 1 : 0);
#else
herr_t exists = 0;
H5E_BEGIN_TRY
herr_t exists = H5Gget_objinfo( id, name, 1, NULL );
exists = H5Gget_objinfo( id, name, 1, NULL );
H5E_END_TRY
return (exists >= 0 ? 1 : 0);
#endif
@@ -1955,7 +2064,7 @@ _H5Part_have_group (
Iterator for \c H5Giterate().
*/
#ifndef H5_USE_16_API
#ifdef H5PART_HAVE_HDF5_18
herr_t
_H5Part_iteration_operator2 (
hid_t group_id, /*!< [in] parent object id */
@@ -2079,7 +2188,7 @@ _H5Part_iteration_operator (
if ( data->type != H5G_UNKNOWN )
{
#ifndef H5_USE_16_API
#ifdef H5PART_HAVE_HDF6_18
H5O_info_t objinfo;
hid_t obj_id = H5Oopen(group_id, member_name, H5P_DEFAULT);
@@ -2159,7 +2268,7 @@ _H5Part_get_num_objects_matching_pattern (
data.type = type;
data.pattern = pattern;
#ifndef H5_USE_16_API
#ifdef H5PART_HAVE_HDF5_18
hid_t child_id = H5Gopen( group_id, group_name, H5P_DEFAULT );
if ( child_id < 0 ) return child_id;
herr = H5Literate( child_id, H5_INDEX_NAME, H5_ITER_INC, 0,
@@ -2170,7 +2279,7 @@ _H5Part_get_num_objects_matching_pattern (
#endif
if ( herr < 0 ) return herr;
#ifndef H5_USE_16_API
#ifdef H5PART_HAVE_HDF5_18
herr = H5Gclose ( child_id );
if ( herr < 0 ) return HANDLE_H5G_CLOSE_ERR;
#endif
@@ -2204,7 +2313,7 @@ _H5Part_get_object_name (
data.name = obj_name;
data.len = (size_t)len_obj_name;
#ifndef H5_USE_16_API
#ifdef H5PART_HAVE_HDF5_18
hid_t child_id = H5Gopen ( group_id, group_name, H5P_DEFAULT );
if ( child_id < 0 ) return child_id;
herr = H5Literate ( child_id, H5_INDEX_NAME, H5_ITER_INC, 0,
@@ -2217,7 +2326,7 @@ _H5Part_get_object_name (
return HANDLE_H5L_ITERATE_ERR;
}
#ifndef H5_USE_16_API
#ifdef H5PART_HAVE_HDF5_18
herr_t herr2 = H5Gclose ( child_id );
if ( herr2 < 0 ) return HANDLE_H5G_CLOSE_ERR;
#endif
@@ -2873,6 +2982,34 @@ H5PartSetViewIndices (
return _set_view_indices ( f, indices, nelems );
}
/*!
\ingroup h5part_model
In MPI-IO collective mode, all MPI tasks must participate in I/O
operations. \c H5PartSetViewEmpty() allows a task to participate
but with an empty view of the file, so that it contributes no data
to the I/O operation.
\return \c H5PART_SUCCESS or error code
*/
h5part_int64_t
H5PartSetViewEmpty (
H5PartFile *f /*!< [in] Handle to open file */
) {
SET_FNAME ( "H5PartSetViewEmpty" );
CHECK_FILEHANDLE( f );
if ( f->timegroup < 0 ) {
h5part_int64_t herr = _H5Part_set_step ( f, 0 );
if ( herr < 0 ) return herr;
}
/* using a null indices list will set an empty view */
return _set_view_indices ( f, NULL, 0 );
}
/*!
\ingroup h5part_model
@@ -3343,7 +3480,7 @@ H5PartSetThrottle (
if ( f->flags & H5PART_VFD_MPIIO_IND || f->flags & H5PART_VFD_MPIPOSIX ) {
f->throttle = factor;
_H5Part_print_info (
"Throttling set with factor '%d'", f->throttle );
"Throttling set with factor = %d", f->throttle );
} else {
_H5Part_print_warn (
"Throttling is only permitted with the MPI-POSIX "
@@ -3361,25 +3498,26 @@ _H5Part_start_throttle (
if (f->throttle > 0) {
int ret;
int token = 1;
if (f->myproc == 0) {
_H5Part_print_info ("Throttling with factor = %d",
f->throttle);
}
if (f->myproc % f->throttle > 0) {
_H5Part_print_info (
"Throttling with factor = %d",
f->throttle);
if (f->myproc / f->throttle > 0) {
_H5Part_print_debug_detail (
"[%d] throttle: waiting on token from %d",
f->myproc, f->myproc - 1);
f->myproc, f->myproc - f->throttle);
// wait to receive token before continuing with read
ret = MPI_Recv(
&token, 1, MPI_INT,
f->myproc - 1, // receive from previous proc
f->myproc - f->throttle, // receive from previous proc
f->myproc, // use this proc id as message tag
f->comm,
MPI_STATUS_IGNORE
);
if ( ret != MPI_SUCCESS ) return HANDLE_MPI_SENDRECV_ERR;
}
_H5Part_print_debug_detail ("[%d] throttle: received token", f->myproc);
_H5Part_print_debug_detail (
"[%d] throttle: received token",
f->myproc);
}
return H5PART_SUCCESS;
}
@@ -3392,19 +3530,17 @@ _H5Part_end_throttle (
if (f->throttle > 0) {
int ret;
int token;
if (f->myproc % f->throttle < f->throttle - 1) {
if (f->myproc + f->throttle < f->nprocs) {
// pass token to next proc
if (f->myproc + 1 < f->nprocs) {
_H5Part_print_debug_detail (
"[%d] throttle: passing token to %d",
f->myproc, f->myproc + 1);
ret = MPI_Send(
&token, 1, MPI_INT,
f->myproc + 1, // send to next proc
f->myproc + 1, // use the id of the target as tag
f->comm
);
}
_H5Part_print_debug_detail (
"[%d] throttle: passing token to %d",
f->myproc, f->myproc + f->throttle);
ret = MPI_Send(
&token, 1, MPI_INT,
f->myproc + f->throttle, // send to next proc
f->myproc + f->throttle, // use the id of the target as tag
f->comm
);
if ( ret != MPI_SUCCESS ) return HANDLE_MPI_SENDRECV_ERR;
}
}
@@ -3488,10 +3624,10 @@ H5PartReportErrorHandler (
) {
_h5part_errno = eno;
if ( _debug > 0 ) {
if ( _debug > 0 && _is_root_proc ) {
va_list ap;
va_start ( ap, fmt );
_H5Part_vprint_error ( fmt, ap );
_vprint ( stderr, "E", fmt, ap );
va_end ( ap );
}
return _h5part_errno;
@@ -3512,7 +3648,7 @@ H5PartAbortErrorHandler (
) {
_h5part_errno = eno;
if ( _debug > 0 ) {
if ( _debug > 0 && _is_root_proc ) {
va_list ap;
va_start ( ap, fmt );
fprintf ( stderr, "%s: ", funcname );
@@ -3575,113 +3711,68 @@ _vprint (
free ( fmt2 );
}
void
_H5Part_vprint_error (
const char *fmt,
va_list ap
) {
if ( _debug < 1 ) return;
_vprint ( stderr, "E", fmt, ap );
}
void
_H5Part_print_error (
const char *fmt,
...
) {
if ( _debug < 1 || !_is_root_proc) return;
va_list ap;
va_start ( ap, fmt );
_H5Part_vprint_error ( fmt, ap );
_vprint ( stderr, "E", fmt, ap );
va_end ( ap );
}
void
_H5Part_vprint_warn (
const char *fmt,
va_list ap
) {
if ( _debug < 2 ) return;
_vprint ( stderr, "W", fmt, ap );
}
void
_H5Part_print_warn (
const char *fmt,
...
) {
if ( _debug < 2 || !_is_root_proc ) return;
va_list ap;
va_start ( ap, fmt );
_H5Part_vprint_warn ( fmt, ap );
_vprint ( stderr, "W", fmt, ap );
va_end ( ap );
}
void
_H5Part_vprint_info (
const char *fmt,
va_list ap
) {
if ( _debug < 3 ) return;
_vprint ( stdout, "I", fmt, ap );
}
void
_H5Part_print_info (
const char *fmt,
...
) {
if ( _debug < 3 || !_is_root_proc ) return;
va_list ap;
va_start ( ap, fmt );
_H5Part_vprint_info ( fmt, ap );
_vprint ( stdout, "I", fmt, ap );
va_end ( ap );
}
void
_H5Part_vprint_debug (
const char *fmt,
va_list ap
) {
if ( _debug < 4 ) return;
_vprint ( stdout, "D", fmt, ap );
}
void
_H5Part_print_debug (
const char *fmt,
...
) {
if ( _debug < 4 || !_is_root_proc ) return;
va_list ap;
va_start ( ap, fmt );
_H5Part_vprint_debug ( fmt, ap );
_vprint ( stdout, "D", fmt, ap );
va_end ( ap );
}
void
_H5Part_vprint_debug_detail (
const char *fmt,
va_list ap
) {
if ( _debug < 5 ) return;
_vprint ( stdout, "DD", fmt, ap );
}
void
_H5Part_print_debug_detail (
const char *fmt,
...
) {
if ( _debug < 5 ) return;
va_list ap;
va_start ( ap, fmt );
_H5Part_vprint_debug_detail ( fmt, ap );
_vprint ( stdout, "DD", fmt, ap );
va_end ( ap );
}
@@ -3690,6 +3781,7 @@ _H5Part_set_funcname (
char *fname
) {
__funcname = fname;
_H5Part_print_debug ("(entered function)");
}
char*
+30
View File
@@ -108,17 +108,32 @@ END FUNCTION
!> \ingroup h5partf_open
!! Opens a parallel file for reading and specifies an HDF5 alignment.
!! See \ref H5PartOpenFileParallelAlign
!!
!! Flags are specified as a comma separated string that can include:
!!
!! - \c fs_lustre - enable optimizations for the Lustre file system
!! - \c vfd_mpiposix - use the HDF5 MPI-POSIX virtual file driver
!! - \c vfd_mpio_ind - use MPI-IO in indepedent mode
!!
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_openr_par_align ( filename, mpi_communicator, align )
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for reading
INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program
INTEGER*8, INTENT(IN) :: align !< alignment value in bytes
CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags
END FUNCTION
!> \ingroup h5partf_open
!! Opens a parallel file for writing in truncate mode and specifies
!! an HDF5 alignment.
!!
!! Flags are specified as a comma separated string that can include:
!!
!! - \c fs_lustre - enable optimizations for the Lustre file system
!! - \c vfd_mpiposix - use the HDF5 MPI-POSIX virtual file driver
!! - \c vfd_mpio_ind - use MPI-IO in indepedent mode
!!
!! See \ref H5PartOpenFileParallelAlign
!! \return 0 on success or error code
!<
@@ -132,6 +147,13 @@ END FUNCTION
!> \ingroup h5partf_open
!! Opens a parallel file for writing in append mode and specifies
!! an HDF5 alignment.
!!
!! Flags are specified as a comma separated string that can include:
!!
!! - \c fs_lustre - enable optimizations for the Lustre file system
!! - \c vfd_mpiposix - use the HDF5 MPI-POSIX virtual file driver
!! - \c vfd_mpio_ind - use MPI-IO in indepedent mode
!!
!! See \ref H5PartOpenFileParallelAlign
!! \return 0 on success or error code
!<
@@ -243,6 +265,14 @@ INTEGER*8 FUNCTION h5pt_setview_indices (filehandle,indices,nelem)
INTEGER*8, INTENT(IN) :: nelem !< number of particles in the list
END FUNCTION
!> \ingroup h5partf_model
!! See \ref H5PartSetViewEmpty
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_setview_empty (filehandle)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
END FUNCTION
!> \ingroup h5partf_model
!! See \ref H5PartResetView
!! \return 0 on success or error code
+18 -2
View File
@@ -16,10 +16,10 @@ extern "C" {
#include "H5MultiBlock.h"
#endif
#define H5PART_VER_STRING "1.6.0"
#define H5PART_VER_STRING "1.6.2"
#define H5PART_VER_MAJOR 1
#define H5PART_VER_MINOR 6
#define H5PART_VER_RELEASE 0
#define H5PART_VER_RELEASE 2
/* error values */
#define H5PART_SUCCESS 0
@@ -42,6 +42,7 @@ extern "C" {
#define H5PART_VFD_MPIPOSIX 0x08
#define H5PART_FS_LUSTRE 0x10
#define H5PART_VFD_MPIIO_IND 0x20
#define H5PART_VFD_CORE 0x40
/* verbosity level flags */
#define H5PART_VERB_NONE 0
@@ -99,6 +100,10 @@ H5PartCloseFile (
H5PartFile *f
);
h5part_int64_t
H5PartFileIsValid (
H5PartFile *f
);
/*============== File Writing Functions ==================== */
h5part_int64_t
@@ -121,6 +126,12 @@ H5PartSetNumParticlesStrided (
const h5part_int64_t stride /*!< [in] Stride (e.g. number of fields in the particle array) */
);
h5part_int64_t
H5PartSetChunkSize (
H5PartFile *f,
const h5part_int64_t size
);
h5part_int64_t
H5PartWriteDataFloat64 (
H5PartFile *f,
@@ -209,6 +220,11 @@ H5PartSetViewIndices (
h5part_int64_t nelems /*!< [in] Size of list */
);
h5part_int64_t
H5PartSetViewEmpty (
H5PartFile *f
);
h5part_int64_t
H5PartGetView (
H5PartFile *f,
+27 -2
View File
@@ -100,6 +100,9 @@
#define h5pt_setview_indices F77NAME ( \
h5pt_setview_indices_, \
H5PT_SETVIEW_INDICES )
#define h5pt_setview_empty F77NAME ( \
h5pt_setview_empty_, \
H5PT_SETVIEW_EMPTY )
#define h5pt_resetview F77NAME ( \
h5pt_resetview_, \
H5PT_RESETVIEW )
@@ -197,6 +200,10 @@ _H5Part_flagsfor2c (
while ( flags != NULL ) {
if ( strcmp ( flags, "vfd_mpiposix" ) == 0 )
fbits |= H5PART_VFD_MPIPOSIX;
else if ( strcmp ( flags, "vfd_core" ) == 0 )
fbits |= H5PART_VFD_CORE;
else if ( strcmp ( flags, "vfd_mpio_ind" ) == 0 )
fbits |= H5PART_VFD_MPIIO_IND;
else if ( strcmp ( flags, "fs_lustre" ) == 0 )
fbits |= H5PART_FS_LUSTRE;
flags = strtok ( NULL, "," );
@@ -351,16 +358,22 @@ h5pt_openr_par_align (
const char *file_name,
MPI_Fint *fcomm,
const h5part_int64_t *align,
const int l_file_name
const char *flags,
const int l_file_name,
const int l_flags
) {
MPI_Comm ccomm = MPI_Comm_f2c (*fcomm);
char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name );
char *flags2 = _H5Part_strdupfor2c ( flags, l_flags );
char fbits = H5PART_READ | _H5Part_flagsfor2c ( flags2 );
H5PartFile* f = H5PartOpenFileParallelAlign (
file_name2, H5PART_READ, ccomm, *align );
file_name2, fbits, ccomm, *align );
free ( file_name2 );
free ( flags2 );
return (h5part_int64_t)(size_t)f;
}
@@ -384,6 +397,7 @@ h5pt_openw_par_align (
file_name2, fbits, ccomm, *align );
free ( file_name2 );
free ( flags2 );
return (h5part_int64_t)(size_t)f;
}
@@ -407,6 +421,7 @@ h5pt_opena_par_align (
file_name2, fbits, ccomm, *align );
free ( file_name2 );
free ( flags2 );
return (h5part_int64_t)(size_t)f;
}
#endif
@@ -626,6 +641,16 @@ h5pt_setview_indices (
return H5PartSetViewIndices ( filehandle, indices, *nelem );
}
h5part_int64_t
h5pt_setview_empty (
const h5part_int64_t *f
) {
H5PartFile *filehandle = (H5PartFile*)(size_t)*f;
return H5PartSetViewEmpty ( filehandle );
}
h5part_int64_t
h5pt_resetview (
const h5part_int64_t *f
+6 -31
View File
@@ -2,12 +2,17 @@
#define __H5PART_PRIVATE_H
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 6
#define H5PART_USE_HDF5_16
#define H5_USE_16_API
#endif
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR >= 8
#define H5PART_HAVE_HDF5_18
#endif
#define H5PART_GROUPNAME_STEP "Step"
#define H5PART_BTREE_IK 10000
#define H5PART_SET_STEP_READ_ONLY 0
h5part_int64_t
_H5Part_file_is_valid (
@@ -167,12 +172,6 @@ _H5Part_get_err_handle (
void
);
void
_H5Part_vprint_error (
const char *fmt,
va_list ap
);
void
_H5Part_print_error (
const char *fmt,
@@ -182,12 +181,6 @@ __attribute__ ((format (printf, 1, 2)))
#endif
;
void
_H5Part_vprint_warn (
const char *fmt,
va_list ap
);
void
_H5Part_print_warn (
const char *fmt,
@@ -198,12 +191,6 @@ __attribute__ ((format (printf, 1, 2)))
#endif
;
void
_H5Part_vprint_info (
const char *fmt,
va_list ap
);
void
_H5Part_print_info (
const char *fmt,
@@ -214,12 +201,6 @@ __attribute__ ((format (printf, 1, 2)))
#endif
;
void
_H5Part_vprint_debug (
const char *fmt,
va_list ap
);
void
_H5Part_print_debug (
const char *fmt,
@@ -230,12 +211,6 @@ __attribute__ ((format (printf, 1, 2)))
#endif
;
void
_H5Part_vprint_debug_detail (
const char *fmt,
va_list ap
);
void
_H5Part_print_debug_detail (
const char *fmt,
+4 -1
View File
@@ -20,8 +20,10 @@ __attribute__ ((format (printf, 3, 4)))
;
#ifndef MPI_INCLUDED
#ifndef OPEN_MPI
typedef unsigned long MPI_Comm;
#endif
#endif
#define H5PART_STEPNAME_LEN 64
#define H5PART_DATANAME_LEN 64
@@ -50,8 +52,9 @@ struct H5PartFile {
hid_t timegroup;
hid_t shape;
hid_t xfer_prop;
hid_t create_prop;
hid_t access_prop;
hid_t dcreate_prop;
hid_t fcreate_prop;
/* the dataspace on disk for the current view */
hid_t diskshape;
+8
View File
@@ -11,6 +11,13 @@ c_head = """
#include "H5MultiBlockErrors.h"
#include "H5MultiBlockPrivate.h"
#ifdef PARALLEL_IO
"""
c_tail = """
#endif // PARALLEL_IO
"""
h_head = """
@@ -237,6 +244,7 @@ def write_calls():
# fcfile.write(create_call(read_fc,type,dim));
# fifile.write(create_call(write_fi,type,dim));
# fifile.write(create_call(read_fi,type,dim));
cfile.write(c_tail)
cfile.close()
hfile.write(h_tail)
hfile.close()
+1 -1
View File
@@ -509,7 +509,7 @@ void test_read4(void)
status = H5PartSetStep(file2, NTIMESTEPS);
RETURN(status, H5PART_SUCCESS, "H5PartSetStep");
test_read_data64(file2, NPARTICLES, NTIMESTEPS);
test_read_data64(file2, NPARTICLES, NTIMESTEPS-2);
status = H5PartCloseFile(file1);
RETURN(status, H5PART_SUCCESS, "H5PartCloseFile");
+7 -5
View File
@@ -23,9 +23,10 @@ int main(int argc, char **argv)
int procs;
MPI_Comm_size(MPI_COMM_WORLD, &procs);
if (procs > MAX_MPI_TASKS) {
fprintf(stderr, "ERROR: please use <= %d MPI tasks for the test.",
fprintf(stderr,
"ERROR: please use <= %d MPI tasks for the test.\n",
MAX_MPI_TASKS);
MPI_Abort(MPI_COMM_WORLD, -1);
exit(EXIT_FAILURE);
}
#endif
@@ -62,9 +63,10 @@ int main(int argc, char **argv)
// TestCleanup();
#ifdef PARALLEL_IO
return MPI_Finalize();
#else
return GetTestNumErrs();
TestPrintf ("reached end\n");
fflush(stdout);
MPI_Finalize();
#endif
return GetTestNumErrs();
}
+3
View File
@@ -31,6 +31,7 @@
#include <string.h>
#include <H5Part.h>
#include "testframe.h"
#include "../src/H5PartPrivate.h"
/*
* Definitions for the testing structure.
@@ -652,6 +653,7 @@ test_is_valid(H5PartFile *file)
void
test_open_objects(H5PartFile *file, int max_objects)
{
#ifndef H5_USE_16_API
ssize_t nopen = H5Fget_obj_count(file->file, H5F_OBJ_ALL);
if (nopen > max_objects)
{
@@ -682,5 +684,6 @@ test_open_objects(H5PartFile *file, int max_objects)
}
free(list);
}
#endif
}
+19 -13
View File
@@ -65,7 +65,7 @@ static void
test_write_data64(H5PartFile *file, int nparticles, int step)
{
int i,t;
h5part_int64_t status;
h5part_int64_t status, val;
double *x,*y,*z;
double *px,*py,*pz;
@@ -108,10 +108,12 @@ test_write_data64(H5PartFile *file, int nparticles, int step)
id[i] = i + nparticles*t;
}
val = H5PartHasStep(file, t);
status = H5PartSetStep(file, t);
RETURN(status, H5PART_SUCCESS, "H5PartSetStep");
test_write_step_attribs(file, t);
if (val == 0) test_write_step_attribs(file, t);
status = H5PartSetNumParticles(file, nparticles);
RETURN(status, H5PART_SUCCESS, "H5PartSetNumParticles");
@@ -198,7 +200,7 @@ static void
test_write_data32(H5PartFile *file, int nparticles, int step)
{
int i,t;
h5part_int32_t status;
h5part_int32_t status, val;
int rank, nprocs;
float *x,*y,*z;
@@ -244,8 +246,11 @@ test_write_data32(H5PartFile *file, int nparticles, int step)
id[i] = i + nparticles*t;
}
status = H5PartSetStep(file, t);
RETURN(status, H5PART_SUCCESS, "H5PartSetStep");
val = H5PartHasStep(file, t);
if (val == 0) {
status = H5PartSetStep(file, t);
RETURN(status, H5PART_SUCCESS, "H5PartSetStep");
}
/* test a two-part write using views */
status = H5PartSetView(file,
@@ -370,8 +375,6 @@ void test_write1(void)
test_write_data32(file1, NPARTICLES, 1);
test_write_file_attribs(file1, 0);
_H5Part_close_hdf_ids(file1);
test_open_objects(file1, 1);
status = H5PartCloseFile(file1);
RETURN(status, H5PART_SUCCESS, "H5PartCloseFile");
}
@@ -405,10 +408,10 @@ void test_write3(void)
h5part_int64_t status;
TEST( "Opening file once, write-truncate, lustre filesyste, "
"MPI-POSIX VFD, 64KB alignment");
"MPI-POSIX VFD, 1KB alignment");
file1 = OPENALIGN(FILENAME,
H5PART_WRITE | H5PART_VFD_MPIPOSIX | H5PART_FS_LUSTRE,
65536);
1024);
test_is_valid(file1);
TEST("Redefining step name");
@@ -430,14 +433,14 @@ void test_write4(void)
h5part_int64_t status;
TEST( "Opening file twice, write-append + read-only, "
"lustre filesystem, MPI-IO Independent VFD, 64K alignment");
"lustre filesystem, MPI-IO Independent VFD, 1K alignment");
file1 = OPENALIGN(FILENAME,
H5PART_APPEND | H5PART_VFD_MPIIO_IND | H5PART_FS_LUSTRE,
65536);
1024);
test_is_valid(file1);
file2 = OPENALIGN(FILENAME,
H5PART_READ | H5PART_VFD_MPIIO_IND | H5PART_FS_LUSTRE,
65536);
1024);
test_is_valid(file2);
TEST("Redefining step name");
@@ -447,7 +450,10 @@ void test_write4(void)
status = H5PartDefineStepName(file2, LONGNAME, 16);
RETURN(status, H5PART_SUCCESS, "H5PartDefineStepName");
test_write_data64(file1, NPARTICLES, NTIMESTEPS);
status = H5PartSetChunkSize(file1, NPARTICLES);
RETURN(status, H5PART_SUCCESS, "H5PartSetChunkSize");
test_write_data64(file1, NPARTICLES, NTIMESTEPS-2);
test_write_file_attribs(file1, 1);
status = H5PartCloseFile(file1);