Compare commits

..

1 Commits

Author SHA1 Message Date
Marc Howison 1cd47a604a 1.6.1 tag 2010-06-21 15:39:41 +00:00
14 changed files with 120 additions and 236 deletions
-3
View File
@@ -18,9 +18,6 @@ doc/Doxyfile -text
doc/H5X_File_Format.txt -text
doc/Makefile.am -text
doc/doxyfooter -text
examples/core_vfd.c -text
examples/fields.c -text
examples/particles.c -text
examples/simplef.F90 -text
examples/stridedf.F90 -text
examples/write_setview.c -text
-13
View File
@@ -1,16 +1,3 @@
#### H5PART 1.6.2 ############################################################
Removed H5PartSetViewEmpty
--------------------------
An empty view can now be selected with:
H5PartSetNumParticles(file, 0);
Bug Fixes to Attribute Calls in Fortran API
-------------------------------------------
Fixed a problem where attribute values were reverting to zero.
#### H5PART 1.6.1 ############################################################
Chunking in the H5Part API
+1 -1
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.2], [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.
-51
View File
@@ -1,51 +0,0 @@
#include <stdlib.h>
#include <assert.h>
#include <mpi.h>
#include <H5Part.h>
#define DATASIZE 32
int main(int argc, char** argv)
{
int i, rank, nprocs;
h5part_int32_t data[DATASIZE];
h5part_int64_t stat;
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);
char filename[8];
sprintf (filename, "%d.h5", rank);
file = H5PartOpenFileParallel(
filename,
H5PART_WRITE | H5PART_VFD_CORE,
MPI_COMM_SELF);
assert (file != NULL);
stat = H5PartSetStep(file, 0);
assert (stat == H5PART_SUCCESS);
stat = H5PartSetNumParticles(file, DATASIZE);
assert (stat == H5PART_SUCCESS);
// create fake data
for (i=0; i<DATASIZE; i++) {
data[i] = i + rank * DATASIZE;
}
// write the data
stat = H5PartWriteDataInt32(file, "data", data);
assert (stat == H5PART_SUCCESS);
H5PartCloseFile(file);
MPI_Finalize();
return EXIT_SUCCESS;
}
-45
View File
@@ -1,45 +0,0 @@
#include <stdlib.h>
#include <assert.h>
#include <mpi.h>
#include <H5Part.h>
#define XSIZE 8
#define YSIZE 8
#define ZSIZE 8
#define DATASIZE XSIZE*YSIZE*ZSIZE
#define H5OpenFileParallel H5PartOpenFileParallel
#define H5SetStep H5PartSetStep
#define H5Block3dSetLayout H5BlockDefine3DFieldLayout
#define H5CloseFile H5PartCloseFile
int main(int argc, char** argv)
{
int rank, nprocs;
h5part_float64_t ex[DATASIZE];
h5part_float64_t ey[DATASIZE];
h5part_float64_t ez[DATASIZE];
h5part_float64_t q[DATASIZE];
h5part_int64_t nparticles = DATASIZE;
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 = H5OpenFileParallel("fields.h5", H5PART_WRITE, MPI_COMM_WORLD);
H5SetStep(file, 0);
H5Block3dSetLayout(file,
rank*XSIZE, (rank+1)*XSIZE - 1,
0, YSIZE - 1,
0, ZSIZE - 1);
H5Block3dWriteScalarFieldFloat64(file, "Q", q);
H5Block3dWrite3dVectorFieldFloat64(file, "E", ex, ez, ey);
H5CloseFile(file);
MPI_Finalize();
return EXIT_SUCCESS;
}
-41
View File
@@ -1,41 +0,0 @@
#include <stdlib.h>
#include <assert.h>
#include <mpi.h>
#include <H5Part.h>
#define DATASIZE 32
int main(int argc, char** argv)
{
int rank, nprocs;
h5part_float64_t x[DATASIZE];
h5part_float64_t y[DATASIZE];
h5part_float64_t z[DATASIZE];
h5part_float64_t px[DATASIZE];
h5part_float64_t py[DATASIZE];
h5part_float64_t pz[DATASIZE];
h5part_int64_t nparticles = DATASIZE;
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("particles.h5", H5PART_WRITE, MPI_COMM_WORLD);
H5PartSetStep(file, 0);
H5PartSetNumParticles(file, nparticles);
H5PartWriteDataFloat64(file, "x", x);
H5PartWriteDataFloat64(file, "y", y);
H5PartWriteDataFloat64(file, "z", z);
H5PartWriteDataFloat64(file, "px", px);
H5PartWriteDataFloat64(file, "py", py);
H5PartWriteDataFloat64(file, "pz", pz);
H5PartCloseFile(file);
MPI_Finalize();
return EXIT_SUCCESS;
}
-7
View File
@@ -8,15 +8,12 @@ program H5PartTest
integer*8 :: file_id, status, npoints, i
real*8, allocatable :: particles(:)
integer*8, allocatable :: id(:)
real*8 :: r8val
integer*8 :: i8val
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_set_verbosity_level(5)
file_id = h5pt_openw_par('test.h5', comm)
! in the Fortran API, time steps start at 1
@@ -25,10 +22,6 @@ program H5PartTest
! write an attribute to the file
status = h5pt_writefileattrib_string(file_id, 'desc', 'This is a test.')
r8val = 0.5
i8val = 1
status = h5pt_writefileattrib_r8(file_id, 'double', r8val, i8val)
! create fake data
npoints = 99
allocate(particles(npoints), id(npoints))
+56 -40
View File
@@ -199,7 +199,7 @@ _H5Part_open_file (
{
/* extend the btree size so that metadata pieces are
* close to the alignment value */
if ( align > 16384 )
if ( align > 0 )
{
unsigned int btree_ik = (align - 4096) / 96;
unsigned int btree_bytes = 64 + 96*btree_ik;
@@ -252,7 +252,7 @@ _H5Part_open_file (
}
} else if (flags & H5PART_VFD_CORE) {
_H5Part_print_info ( "Selecting CORE VFD" );
if (H5Pset_fapl_core ( f->access_prop, align, 1 ) < 0) {
if (H5Pset_fapl_core ( f->access_prop, comm, 0 ) < 0) {
HANDLE_H5P_SET_FAPL_ERR;
goto error_cleanup;
}
@@ -713,11 +713,7 @@ _set_num_particles (
register int i;
#endif
#ifdef PARALLEL_IO
if ( nparticles < 0 )
#else
if ( nparticles <= 0 )
#endif
return HANDLE_H5PART_INVALID_ERR ( "nparticles", nparticles );
/* prevent invalid stride value */
@@ -730,8 +726,6 @@ _set_num_particles (
stride = (hsize_t) _stride;
}
if ( nparticles == 0 ) stride = 1;
#ifndef PARALLEL_IO
/*
if we are not using parallel-IO, there is enough information
@@ -757,14 +751,11 @@ _set_num_particles (
f->nparticles = (hsize_t) nparticles;
if ( f->nparticles > 0 )
{
/* declare local memory datasize with striding */
count = f->nparticles * stride;
f->memshape = H5Screate_simple ( 1, &count, &dmax );
if ( f->memshape < 0 )
return HANDLE_H5S_CREATE_SIMPLE_ERR ( f->nparticles );
}
/* declare local memory datasize with striding */
count = f->nparticles * stride;
f->memshape = H5Screate_simple ( 1, &count, &dmax );
if ( f->memshape < 0 )
return HANDLE_H5S_CREATE_SIMPLE_ERR ( f->nparticles );
/* we need a hyperslab selection if there is striding
* (otherwise, the default H5S_ALL selection is ok)
@@ -805,7 +796,7 @@ _set_num_particles (
*/
ret = MPI_Allgather (
(void*)&nparticles, 1, MPI_LONG_LONG,
&nparticles, 1, MPI_LONG_LONG,
f->pnparticles, 1, MPI_LONG_LONG,
f->comm );
if ( ret != MPI_SUCCESS) return HANDLE_MPI_ALLGATHER_ERR;
@@ -842,16 +833,12 @@ _set_num_particles (
count = nparticles;
stride = 1;
if ( count > 0 ) {
herr = H5Sselect_hyperslab (
f->diskshape,
H5S_SELECT_SET,
&start,
&stride,
&count, NULL );
} else {
herr = H5Sselect_none ( f->diskshape );
}
herr = H5Sselect_hyperslab (
f->diskshape,
H5S_SELECT_SET,
&start,
&stride,
&count, NULL );
if ( herr < 0 ) return HANDLE_H5S_SELECT_HYPERSLAB_ERR;
#endif
@@ -1647,9 +1634,9 @@ H5PartWriteStepAttrib (
h5part_int64_t herr = _H5Part_write_step_attrib (
f,
name,
(hid_t)type,
(const hid_t)type,
data,
(hsize_t)nelem );
nelem );
if ( herr < 0 ) return herr;
return H5PART_SUCCESS;
@@ -1691,9 +1678,9 @@ H5PartWriteFileAttrib (
h5part_int64_t herr = _H5Part_write_file_attrib (
f,
name,
(hid_t)type,
(const hid_t)type,
data,
(hsize_t)nelem );
nelem );
if ( herr < 0 ) return herr;
return H5PART_SUCCESS;
@@ -2282,12 +2269,7 @@ _H5Part_get_num_objects_matching_pattern (
data.pattern = pattern;
#ifdef H5PART_HAVE_HDF5_18
hid_t child_id = H5Gopen( group_id, group_name
#ifndef H5_USE_16_API
, H5P_DEFAULT
#endif
);
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,
_H5Part_iteration_operator2, &data );
@@ -2790,7 +2772,10 @@ _set_view (
end==-1 to mean end of file
*/
total = (hsize_t) _H5Part_get_num_particles ( f );
if ( total == 0 ) {
if ( total < 0 ) {
return HANDLE_H5PART_GET_NUM_PARTICLES_ERR ( total );
}
else if ( total == 0 ) {
/* No datasets have been created yet and no veiws are set.
* We have to leave the view empty because we don't know how
* many particles there should be! */
@@ -2869,7 +2854,10 @@ _set_view_indices (
end==-1 to mean end of file
*/
total = (hsize_t) _H5Part_get_num_particles ( f );
if ( total == 0 ) {
if ( total < 0 ) {
return HANDLE_H5PART_GET_NUM_PARTICLES_ERR ( total );
}
else if ( total == 0 ) {
/* No datasets have been created yet and no veiws are set.
* We have to leave the view empty because we don't know how
* many particles there should be! */
@@ -2994,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
@@ -3141,7 +3157,7 @@ _read_data (
) {
h5part_int64_t herr;
hssize_t ndisk, nread, nmem;
hsize_t ndisk, nread, nmem;
hid_t dataset_id;
hid_t space_id;
hid_t memspace_id;
+8
View File
@@ -265,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
+5
View File
@@ -220,6 +220,11 @@ H5PartSetViewIndices (
h5part_int64_t nelems /*!< [in] Size of list */
);
h5part_int64_t
H5PartSetViewEmpty (
H5PartFile *f
);
h5part_int64_t
H5PartGetView (
H5PartFile *f,
+30 -30
View File
@@ -23,7 +23,7 @@ h5pt_writefileattrib_r8 (
h5part_int64_t *f,
const char *name,
const h5part_float64_t *data,
const h5part_int64_t *nelem,
const h5part_float64_t *nelem,
const int l_name
) {
@@ -39,9 +39,9 @@ h5pt_writefileattrib_r8 (
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_readfileattrib_r8 F77NAME ( \
h5pt_readfileattrib_r8_, \
H5PT_READFILEATTRIB_R8 )
#define h5pt_writefileattrib_r8 F77NAME ( \
h5pt_writefileattrib_r8_, \
H5PT_WRITEFILEATTRIB_R8 )
#endif
h5part_int64_t
@@ -74,7 +74,7 @@ h5pt_writefileattrib_r4 (
h5part_int64_t *f,
const char *name,
const h5part_float32_t *data,
const h5part_int64_t *nelem,
const h5part_float32_t *nelem,
const int l_name
) {
@@ -90,9 +90,9 @@ h5pt_writefileattrib_r4 (
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_readfileattrib_r4 F77NAME ( \
h5pt_readfileattrib_r4_, \
H5PT_READFILEATTRIB_R4 )
#define h5pt_writefileattrib_r4 F77NAME ( \
h5pt_writefileattrib_r4_, \
H5PT_WRITEFILEATTRIB_R4 )
#endif
h5part_int64_t
@@ -141,9 +141,9 @@ h5pt_writefileattrib_i8 (
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_readfileattrib_i8 F77NAME ( \
h5pt_readfileattrib_i8_, \
H5PT_READFILEATTRIB_I8 )
#define h5pt_writefileattrib_i8 F77NAME ( \
h5pt_writefileattrib_i8_, \
H5PT_WRITEFILEATTRIB_I8 )
#endif
h5part_int64_t
@@ -176,7 +176,7 @@ h5pt_writefileattrib_i4 (
h5part_int64_t *f,
const char *name,
const h5part_int32_t *data,
const h5part_int64_t *nelem,
const h5part_int32_t *nelem,
const int l_name
) {
@@ -192,9 +192,9 @@ h5pt_writefileattrib_i4 (
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_readfileattrib_i4 F77NAME ( \
h5pt_readfileattrib_i4_, \
H5PT_READFILEATTRIB_I4 )
#define h5pt_writefileattrib_i4 F77NAME ( \
h5pt_writefileattrib_i4_, \
H5PT_WRITEFILEATTRIB_I4 )
#endif
h5part_int64_t
@@ -227,7 +227,7 @@ h5pt_writestepattrib_r8 (
h5part_int64_t *f,
const char *name,
const h5part_float64_t *data,
const h5part_int64_t *nelem,
const h5part_float64_t *nelem,
const int l_name
) {
@@ -243,9 +243,9 @@ h5pt_writestepattrib_r8 (
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_readstepattrib_r8 F77NAME ( \
h5pt_readstepattrib_r8_, \
H5PT_READSTEPATTRIB_R8 )
#define h5pt_writestepattrib_r8 F77NAME ( \
h5pt_writestepattrib_r8_, \
H5PT_WRITESTEPATTRIB_R8 )
#endif
h5part_int64_t
@@ -278,7 +278,7 @@ h5pt_writestepattrib_r4 (
h5part_int64_t *f,
const char *name,
const h5part_float32_t *data,
const h5part_int64_t *nelem,
const h5part_float32_t *nelem,
const int l_name
) {
@@ -294,9 +294,9 @@ h5pt_writestepattrib_r4 (
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_readstepattrib_r4 F77NAME ( \
h5pt_readstepattrib_r4_, \
H5PT_READSTEPATTRIB_R4 )
#define h5pt_writestepattrib_r4 F77NAME ( \
h5pt_writestepattrib_r4_, \
H5PT_WRITESTEPATTRIB_R4 )
#endif
h5part_int64_t
@@ -345,9 +345,9 @@ h5pt_writestepattrib_i8 (
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_readstepattrib_i8 F77NAME ( \
h5pt_readstepattrib_i8_, \
H5PT_READSTEPATTRIB_I8 )
#define h5pt_writestepattrib_i8 F77NAME ( \
h5pt_writestepattrib_i8_, \
H5PT_WRITESTEPATTRIB_I8 )
#endif
h5part_int64_t
@@ -380,7 +380,7 @@ h5pt_writestepattrib_i4 (
h5part_int64_t *f,
const char *name,
const h5part_int32_t *data,
const h5part_int64_t *nelem,
const h5part_int32_t *nelem,
const int l_name
) {
@@ -396,9 +396,9 @@ h5pt_writestepattrib_i4 (
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_readstepattrib_i4 F77NAME ( \
h5pt_readstepattrib_i4_, \
H5PT_READSTEPATTRIB_I4 )
#define h5pt_writestepattrib_i4 F77NAME ( \
h5pt_writestepattrib_i4_, \
H5PT_WRITESTEPATTRIB_I4 )
#endif
h5part_int64_t
+13
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 )
@@ -638,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
+3 -1
View File
@@ -19,9 +19,11 @@ __attribute__ ((format (printf, 3, 4)))
#endif
;
#ifndef PARALLEL_IO
#ifndef MPI_INCLUDED
#ifndef OPEN_MPI
typedef unsigned long MPI_Comm;
#endif
#endif
#define H5PART_STEPNAME_LEN 64
#define H5PART_DATANAME_LEN 64
+4 -4
View File
@@ -113,7 +113,7 @@ h5pt_write#LEVELLC#attrib_#TYPE_F90_ABV# (
h5part_int64_t *f,
const char *name,
const h5part_#TYPE_H5P#_t *data,
const h5part_int64_t *nelem,
const h5part_#TYPE_H5P#_t *nelem,
const int l_name
) {
@@ -143,9 +143,9 @@ END FUNCTION
read_attr_fc = """
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_read#LEVELLC#attrib_#TYPE_F90_ABV# F77NAME ( \\
h5pt_read#LEVELLC#attrib_#TYPE_F90_ABV#_, \\
H5PT_READ#LEVELUC#ATTRIB_#TYPE_F90_ABVC# )
#define h5pt_write#LEVELLC#attrib_#TYPE_F90_ABV# F77NAME ( \\
h5pt_write#LEVELLC#attrib_#TYPE_F90_ABV#_, \\
H5PT_WRITE#LEVELUC#ATTRIB_#TYPE_F90_ABVC# )
#endif
h5part_int64_t