explicit set of verbosity level to default; refactor variables for MPI communicator size and rank to 'comm_size' and 'comm_rank'

This commit is contained in:
2013-10-31 15:30:43 +01:00
parent 468a5d6871
commit 950bcef057
7 changed files with 85 additions and 49 deletions
+11 -7
View File
@@ -10,28 +10,32 @@
#include <stdlib.h>
#include "H5hut.h"
#define FNAME "example_setview.h5"
#define DATASIZE 32
#define ITERS 4
#define DEFAULT_VERBOSITY H5_VERBOSE_DEFAULT
#define FNAME "example_setview.h5"
#define DATASIZE 32
#define ITERS 4
int
main (
int argc, char** argv
) {
h5_int64_t verbosity = DEFAULT_VERBOSITY;
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int mpi_rank = 0;
MPI_Comm_rank (comm, &mpi_rank);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (verbosity);
// 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 + mpi_rank*npoints;
data[i] = i + comm_rank*npoints;
}
// open file and create step #0
@@ -43,7 +47,7 @@ main (
H5PartSetNumParticles(file, npoints);
// write ITER consecutive blocks of size DATASIZE
h5_int64_t offset = mpi_rank * npoints;
h5_int64_t offset = comm_rank * npoints;
for (int i = 0; i < ITERS; i++) {
// set the "view" to select a subset of the dataset
H5PartSetView (