Commit 6b4b556f authored by Marc Howison's avatar Marc Howison

removed H5PartSetViewEmpty and enabled 0 as input to H5PartSetNumParticles

parent 08574436
......@@ -18,6 +18,9 @@ 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
......
#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;
}
#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;
}
#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;
}
......@@ -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, comm, 0 ) < 0) {
if (H5Pset_fapl_core ( f->access_prop, align, 1 ) < 0) {
HANDLE_H5P_SET_FAPL_ERR;
goto error_cleanup;
}
......@@ -713,7 +713,11 @@ _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 */
......@@ -726,6 +730,8 @@ _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
......@@ -751,11 +757,14 @@ _set_num_particles (
f->nparticles = (hsize_t) 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 );
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 );
}
/* we need a hyperslab selection if there is striding
* (otherwise, the default H5S_ALL selection is ok)
......@@ -796,7 +805,7 @@ _set_num_particles (
*/
ret = MPI_Allgather (
&nparticles, 1, MPI_LONG_LONG,
(void*)&nparticles, 1, MPI_LONG_LONG,
f->pnparticles, 1, MPI_LONG_LONG,
f->comm );
if ( ret != MPI_SUCCESS) return HANDLE_MPI_ALLGATHER_ERR;
......@@ -833,12 +842,16 @@ _set_num_particles (
count = nparticles;
stride = 1;
herr = H5Sselect_hyperslab (
f->diskshape,
H5S_SELECT_SET,
&start,
&stride,
&count, NULL );
if ( count > 0 ) {
herr = H5Sselect_hyperslab (
f->diskshape,
H5S_SELECT_SET,
&start,
&stride,
&count, NULL );
} else {
herr = H5Sselect_none ( f->diskshape );
}
if ( herr < 0 ) return HANDLE_H5S_SELECT_HYPERSLAB_ERR;
#endif
......@@ -2982,34 +2995,6 @@ 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
......
......@@ -220,11 +220,6 @@ H5PartSetViewIndices (
h5part_int64_t nelems /*!< [in] Size of list */
);
h5part_int64_t
H5PartSetViewEmpty (
H5PartFile *f
);
h5part_int64_t
H5PartGetView (
H5PartFile *f,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment