H5Part examples reviewed
This commit is contained in:
@@ -14,23 +14,24 @@
|
||||
#define DATASIZE 32
|
||||
#define ITERS 4
|
||||
|
||||
int main (
|
||||
int
|
||||
main (
|
||||
int argc, char** argv
|
||||
) {
|
||||
h5_int64_t npoints = ITERS*DATASIZE
|
||||
|
||||
// initialize MPI & H5hut
|
||||
MPI_Init (&argc, &argv);
|
||||
MPI_Comm comm = MPI_COMM_WORLD;
|
||||
int rank = 0;
|
||||
MPI_Comm_rank (comm, &rank);
|
||||
int mpi_rank = 0;
|
||||
MPI_Comm_rank (comm, &mpi_rank);
|
||||
|
||||
H5AbortOnError ();
|
||||
|
||||
// create fake data
|
||||
h5_int64_t npoints = ITERS*DATASIZE;
|
||||
h5_int32_t data[ITERS*DATASIZE];
|
||||
for (int i = 0; i < npoints; i++) {
|
||||
data[i] = i + rank*npoints;
|
||||
data[i] = i + mpi_rank*npoints;
|
||||
}
|
||||
|
||||
// open file and create step #0
|
||||
@@ -42,7 +43,7 @@ int main (
|
||||
H5PartSetNumParticles(file, npoints);
|
||||
|
||||
// write ITER consecutive blocks of size DATASIZE
|
||||
h5_int64_t offset = rank * npoints;
|
||||
h5_int64_t offset = mpi_rank * npoints;
|
||||
for (int i = 0; i < ITERS; i++) {
|
||||
// set the "view" to select a subset of the dataset
|
||||
H5PartSetView (
|
||||
|
||||
Reference in New Issue
Block a user