- H5PartSetNumPoints() renamed to H5PartSetNumItems()
- H5PartGetNumPoints() renamed to H5PartGetNumItems()
- Dataset names longer then 64 bytes are handled as error.
- Same for step/iteration names.
* core API
- we use the term 'iteration' instead of 'step'
- we use the term 'item' instead of 'point'
- re-factor function and variable names
- in printing messages/debug output fixed
- do not flush (sync to disk) after writing a dataset by default,
  can be controlled by a property
This commit is contained in:
Gsell Achim
2018-09-14 16:46:40 +02:00
parent 072a2781fc
commit 4daf9b786c
47 changed files with 842 additions and 655 deletions
+52 -5
View File
@@ -7,6 +7,9 @@
License: see file COPYING in top level of source distribution.
*/
#include <stdlib.h>
#include <mpi.h>
#include "H5hut.h"
#include "examples.h"
@@ -15,16 +18,51 @@ const char* fname = "example_setview.h5";
// H5hut verbosity level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
const h5_int64_t h5_debug_mask = 0;
// we are going to write multiple consecutive blocks
const h5_int64_t num_blocks = 4;
const h5_int64_t num_particles_per_block = 32;
//const h5_int64_t num_blocks = 32;
//const h5_int64_t num_particles_per_block = 1048576*8;
int
main (
int argc,
char* argv[]
){
if (argc < 3) {
fprintf (stderr, "Usage: %s <number_of_blocks> <sizeof_block>\n", argv[0]);
exit (1);
}
char* endptr = NULL;
long long n = strtoll (argv[1], &endptr, 10);
if (*endptr != 0) {
fprintf (stderr, "first argument (number of blocks) is not a unsigned integer!\n");
exit (1);
}
if (n < 1) {
fprintf (stderr, "first argument (number of block) must be >= 1!\n");
exit (1);
}
if (n == LLONG_MAX) {
fprintf (stderr, "first argument (number of block) to large!\n");
exit (1);
}
h5_int64_t num_blocks = (h5_int64_t)n;
n = strtoll (argv[2], &endptr, 10);
if (*endptr != 0) {
fprintf (stderr, "second argument (sizeof blocks) is not a unsigned integer!\n");
exit (1);
}
if (n < 1024) {
fprintf (stderr, "second argument (sizeof block) must be >= 1024!\n");
exit (1);
}
if (n == LLONG_MAX) {
fprintf (stderr, "second argument (sizeof block) to large!\n");
exit (1);
}
h5_int64_t num_particles_per_block = (h5_int64_t)n;
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
@@ -33,9 +71,16 @@ main (
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
H5SetDebugMask (h5_debug_mask);
h5_prop_t prop = H5CreateFileProp ();
H5SetPropFileAlign (prop, 1048576*8);
H5SetPropFileMPIOIndependent (prop, &comm);
//H5SetPropFileMPIOCollective (prop, &comm);
// open file and create first step
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, H5_PROP_DEFAULT);
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, prop);
//H5PartSetChunkSize (file, 1048576*1);
H5SetStep (file, 0);
/*
@@ -52,7 +97,9 @@ main (
// write multiple consecutive blocks
for (int i = 0; i < num_blocks; i++) {
// create fake data
h5_int32_t data[num_particles_per_block];
//h5_int32_t data[num_particles_per_block];
h5_int64_t *data;
data = calloc (num_particles_per_block, sizeof(*data));
for (int j = 0; j < num_particles_per_block; j++) {
data[j] = j + i*num_particles_per_block + offset;
}
@@ -63,7 +110,7 @@ main (
offset + i*num_particles_per_block,
offset + (i+1)*num_particles_per_block - 1);
// write data
H5PartWriteDataInt32 (file, "data", data);
H5PartWriteDataInt64 (file, "data", data);
}
// done