more work on examples

This commit is contained in:
2013-10-10 17:00:44 +02:00
parent 61d17a352f
commit 0dcc666e5e
15 changed files with 478 additions and 185 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ program openclose
call mpi_comm_rank(comm, rank, ierr)
props = h5_createprop_file ()
status = h5_setprop_filempio (props, comm)
status = h5_setprop_file_mpio_collective (props, comm)
file_id = h5_openfile ("testfile.h5", H5_O_WRONLY, props)
status = h5_closeprop (props)
status = h5_closefile (file_id);
+6 -2
View File
@@ -10,6 +10,7 @@
#include "H5hut.h"
#define FNAME "example_file_attribs.h5"
#define VERBOSITY H5_VERBOSE_ERROR
#define ATTR_STRING "FileAttrString"
#define ATTR_INT32 "FileAttrInt32"
@@ -22,8 +23,11 @@ main (
int argc,
char** argv
) {
MPI_Init (&argc, &argv);
H5AbortOnError ();
H5SetVerbosityLevel (VERBOSITY);
MPI_Init (&argc, &argv);
// if file properties is set to default, MPI_COMM_WORLD will be used
h5_file_t f = H5OpenFile (FNAME, H5_O_RDONLY, H5_PROP_DEFAULT);
h5_size_t len;
@@ -74,7 +78,7 @@ main (
printf ("\n");
free (attr_float64);
// cleanup
H5CloseFile (f);
MPI_Finalize ();
return 0;
+5 -1
View File
@@ -16,7 +16,11 @@
! the file name we want to read
character (len=*), parameter :: FNAME = "example_file_attribs.h5"
! verbosity level: set it to a power of 2 minus one or zero
! verbosity level: set it to
! - 1 to see error messages, if something goes wrong
! - 0 to get no output
! - a power of 2 minus one to get lot of output
! zeror zero
integer*8, parameter :: verbosity_level = 1
! we know the attribute names!
+21 -16
View File
@@ -19,32 +19,37 @@ noinst_PROGRAMS =
if ENABLE_C
noinst_PROGRAMS += \
Bench \
H5test \
core_vfd \
particles \
read_canonicalview \
write_setnumparticles \
write_setview
read_setnparticles \
read_setview \
read_strided \
use_core_vfd \
write_setnparticles \
write_setview \
write_strided
endif
if ENABLE_FORTRAN
noinst_PROGRAMS += H5testF
noinst_PROGRAMS += \
read_canonicalviewf \
read_setnparticlesf \
read_setviewf \
read_stridedf \
use_core_vfd \
write_setnparticlesf \
write_setviewf \
write_stridedf
endif
EXTRA_PROGRAMS = Bench H5test H5testF
EXTRA_PROGRAMS =
Bench_SOURCES = Bench.c
H5test_SOURCES = H5test.c
core_vfd_SOURCES = core_vfd.c
particles_SOURCES = particles.c
read_canonicalview_SOURCES = read_canonicalview.c
write_setnumparticles_SOURCES = write_setnumparticles.c
write_setview_SOURCES = write_setview.c
H5testF_SOURCES = H5testF.f90
write_setviewf_SOURCES = write_setviewf.f90
write_stridedf_SOURCES = write_stridedf.f90
%.o : %.f90
$(FC) $(FFLAGS) -c $<
clean-local:
$(RM) *~
+18 -10
View File
@@ -1,20 +1,28 @@
/*
Copyright (c) 2006-2013, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include <stdlib.h>
#include "H5hut.h"
#define FNAME "example_particles.h5"
int
main (
int argc, char* argv[]
){
h5_file_t file;
int nprocs, myproc;
MPI_Comm comm = MPI_COMM_WORLD;
H5AbortOnError ();
H5SetVerbosityLevel (VERBOSITY);
int myproc;
MPI_Init (&argc, &argv);
MPI_Comm_size (comm, &nprocs);
MPI_Comm_rank (comm, &myproc);
H5SetVerbosityLevel (4);
file = H5OpenFile ("parttest.h5", H5_O_RDONLY, comm);
MPI_Comm_rank (MPI_COMM_WORLD, &myproc);
h5_file_t file = H5OpenFile (FNAME, H5_O_RDONLY, H5_PROP_DEFAULT);
H5SetStep (file, 0);
@@ -22,6 +30,6 @@ main (
h5_int64_t num_particles = H5PartGetNumParticles (file);
printf ("[proc %d]: particles in view: %lld\n", myproc, num_particles);
H5CloseFile(file);
return MPI_Finalize();
H5CloseFile (file);
return MPI_Finalize ();
}
+50
View File
@@ -0,0 +1,50 @@
/*
Copyright (c) 2006-2013, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
#define FNAME "example_setnparticles.h5"
int
main (
int argc, char* argv[]
){
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
int comm_size = 0;
MPI_Comm_size (comm, &comm_size);
H5AbortOnError ();
H5SetVerbosityLevel (H5_VERBOSE_INFO);
// open file and open step #0
h5_file_t file = H5OpenFile (FNAME, H5_O_RDONLY, H5_PROP_DEFAULT);
H5SetStep (file, 0);
// compute number of particles this process has to read
h5_ssize_t nparticels_total = H5PartGetNumParticles (file);
h5_ssize_t nparticels = nparticels_total / comm_size;
if (comm_rank+1 == comm_size)
nparticels += nparticels_total % comm_size;
h5_info ("Total number of particles: %lld", (long long unsigned)nparticels_total);
h5_info ("Number of particles on this core: %lld", (long long unsigned)nparticels);
// read data
H5PartSetNumParticles (file, nparticels);
h5_int32_t* data = calloc (nparticels, sizeof (*data));
H5PartReadDataInt32 (file, "data", data);
// cleanup
H5CloseFile (file);
return MPI_Finalize ();
}
+34
View File
@@ -0,0 +1,34 @@
/*
Copyright (c) 2006-2013, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
#include "examples.h"
#define FNAME "example_particles.h5"
int
main (
int argc, char* argv[]
){
H5AbortOnError ();
H5SetVerbosityLevel (VERBOSITY);
int myproc;
MPI_Init (&argc, &argv);
MPI_Comm_rank (MPI_COMM_WORLD, &myproc);
h5_file_t file = H5OpenFile (FNAME, H5_O_RDONLY, H5_PROP_DEFAULT);
H5SetStep (file, 0);
// TODO
H5CloseFile (file);
return MPI_Finalize ();
}
+34
View File
@@ -0,0 +1,34 @@
/*
Copyright (c) 2006-2013, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
#include "examples.h"
#define FNAME "example_particles.h5"
int
main (
int argc, char* argv[]
){
H5AbortOnError ();
H5SetVerbosityLevel (VERBOSITY);
int myproc;
MPI_Init (&argc, &argv);
MPI_Comm_rank (MPI_COMM_WORLD, &myproc);
h5_file_t file = H5OpenFile (FNAME, H5_O_RDONLY, H5_PROP_DEFAULT);
H5SetStep (file, 0);
// TODO
H5CloseFile (file);
return MPI_Finalize ();
}
+28 -20
View File
@@ -1,14 +1,28 @@
/*
Copyright (c) 2006-2013, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
#include "examples.h"
#include <stdlib.h>
#include <assert.h>
#include <mpi.h>
#include <H5hut.h>
#define FNAME "example_core_vfd"
#define DATASIZE 32
int main(
int argc, char** argv
) {
int i, rank, nprocs;
int
main (
int argc, char* argv[]
){
H5AbortOnError ();
H5SetVerbosityLevel (VERBOSITY);
h5_int32_t data[DATASIZE];
h5_int64_t stat;
h5_file_t file;
@@ -18,31 +32,25 @@ int main(
MPI_Comm_rank (MPI_COMM_WORLD, &rank);
MPI_Comm_size (MPI_COMM_WORLD, &nprocs);
H5SetVerbosityLevel (1);
char filename[8];
sprintf (filename, "%d.h5", rank);
char filename[32];
sprintf (filename, "%s.%d.h5", FNAME, rank);
file = H5OpenFile (filename, H5_O_WRONLY|H5_VFD_CORE, MPI_COMM_SELF);
assert (file != H5_FAILURE);
stat = H5SetStep (file, 0);
assert (stat == H5_SUCCESS);
H5SetStep (file, 0);
stat = H5PartSetNumParticles(file, DATASIZE);
assert (stat == H5_SUCCESS);
H5PartSetNumParticles(file, DATASIZE);
// create fake data
for (i=0; i<DATASIZE; i++) {
for (int i = 0; i < DATASIZE; i++) {
data[i] = i + rank * DATASIZE;
}
// write the data
stat = H5PartWriteDataInt32(file, "data", data);
assert (stat == H5_SUCCESS);
H5PartWriteDataInt32 (file, "data", data);
H5CloseFile(file);
H5CloseFile (file);
MPI_Finalize();
MPI_Finalize ();
return H5_SUCCESS;
}
+30 -19
View File
@@ -1,38 +1,49 @@
/*
Copyright (c) 2006-2013, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include <stdlib.h>
#include "H5hut.h"
#define NUM_PARTICLES 3
#define FNAME "example_setnparticles.h5"
#define NUM_PARTICLES 3
int
main (
int argc,
char* argv[]
){
h5_file_t file;
int nprocs = 0;
int myproc = 0;
int step = 0;
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int rank = 0;
MPI_Comm_rank (comm, &rank);
H5AbortOnError ();
H5SetVerbosityLevel (-1);
MPI_Init (&argc,&argv);
MPI_Comm_size (comm,&nprocs);
MPI_Comm_rank (comm,&myproc);
h5_int64_t id[NUM_PARTICLES];
// create fake data
h5_int32_t data[NUM_PARTICLES];
h5_int64_t num_particles = NUM_PARTICLES;
for (int i = 0; i < num_particles; i++) {
id[i] = i + num_particles * myproc;
data[i] = i + num_particles * rank;
}
// open file and create step #0
h5_file_t file = H5OpenFile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT);
H5SetStep (file, 0);
file = H5OpenFile ("parttest.h5", H5_O_WRONLY, comm);
H5SetStep (file, step);
H5PartSetNumParticles (file,num_particles);
H5PartWriteDataInt64 (file, "id", id);
// define number of items this process will write
H5PartSetNumParticles (file, num_particles);
// write data
H5PartWriteDataInt32 (file, "data", data);
// done
H5CloseFile(file);
MPI_Finalize ();
return MPI_Finalize ();
}
+34 -39
View File
@@ -1,56 +1,51 @@
program H5PartTest
implicit none
!
! Copyright (c) 2006-2013, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program write_setnparticles
use H5hut
implicit none
include 'mpif.h'
include 'H5PartF.h'
! the file name we want to read
character (len=*), parameter :: FNAME = "example_setnparticles.h5"
integer*8, parameter :: NPOINTS = 99
integer :: comm, rank, ierr
integer*8 :: file_id, status, npoints, i
real*8, allocatable :: particles(:)
integer*8, allocatable :: id(:)
real*8 :: r8val
integer*8 :: i8val
integer*8 :: file, i, status
integer*4, allocatable :: data(:)
! init MPI & H5hut
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
status = h5pt_setstep(file_id, 1_8)
! 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)
call h5_abort_on_error ()
! create fake data
npoints = 99
allocate(particles(npoints), id(npoints))
do i=1,npoints
particles(i) = real(i+npoints*rank)
id(i) = i+npoints*rank
allocate (data (NPOINTS))
do i = 1, NPOINTS
data (i) = i + NPOINTS*rank
enddo
! open the a file for parallel writing and ceate step #0
file = h5_openfile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT)
status = h5_setstep(file, 0_8)
! set the size of the 1D array
status = h5pt_setnpoints(file_id, npoints)
status = h5pt_setnpoints (file, npoints)
! write the particles
status = h5pt_writedata_r8(file_id, "x", particles)
status = h5pt_writedata_i4 (file, "data", data)
! write the ids
status = h5pt_writedata_i8(file_id, "id", id)
! cleanup
status = h5_closefile (file)
deallocate (data)
call mpi_finalize (ierr)
! close the file
status = h5pt_close(file_id)
deallocate(particles, id)
call mpi_finalize(ierr)
end program H5PartTest
end program write_setnparticles
+41 -38
View File
@@ -1,57 +1,60 @@
#include <stdlib.h>
#include <assert.h>
#include <mpi.h>
#include <H5hut.h>
/*
Copyright (c) 2006-2013, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
#define DATASIZE 32
#define ITERS 4
License: see file COPYING in top level of source distribution.
*/
#include <stdlib.h>
#include "H5hut.h"
#define FNAME "example_setview.h5"
#define DATASIZE 32
#define ITERS 4
int main (
int argc, char** argv
) {
int i, rank, nprocs;
h5_int32_t data[ITERS*DATASIZE];
h5_int64_t stat;
h5_int64_t offset;
h5_file_t file;
// initialize MPI
h5_int64_t npoints = ITERS*DATASIZE
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm_rank (MPI_COMM_WORLD, &rank);
MPI_Comm_size (MPI_COMM_WORLD, &nprocs);
MPI_Comm comm = MPI_COMM_WORLD;
int rank = 0;
MPI_Comm_rank (comm, &rank);
H5SetVerbosityLevel(1);
file = H5OpenFile ("test.h5", H5_O_WRONLY, MPI_COMM_WORLD);
assert (file != H5_FAILURE);
stat = H5SetStep(file, 0);
assert (stat == H5_SUCCESS);
stat = H5PartSetNumParticles(file, ITERS*DATASIZE);
assert (stat == H5_SUCCESS);
H5AbortOnError ();
// create fake data
for (i=0; i<ITERS*DATASIZE; i++) {
data[i] = i + rank * ITERS * DATASIZE;
h5_int32_t data[ITERS*DATASIZE];
for (int i = 0; i < npoints; i++) {
data[i] = i + rank*npoints;
}
offset = rank * ITERS * DATASIZE;
// open file and create step #0
h5_file_t file = H5OpenFile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT);
H5SetStep(file, 0);
// iterate over arrays
for (i=0; i<ITERS; i++) {
// before we can start writing, we have to define the number of
// items this processor will write
H5PartSetNumParticles(file, npoints);
// write ITER consecutive blocks of size DATASIZE
h5_int64_t offset = rank * npoints;
for (int i = 0; i < ITERS; i++) {
// set the "view" to select a subset of the dataset
stat = H5PartSetView (file,
offset + i * DATASIZE,
offset + (i+1) * DATASIZE - 1);
assert (stat == H5_SUCCESS);
H5PartSetView (
file,
offset + i * DATASIZE,
offset + (i+1) * DATASIZE - 1);
// write the data
stat = H5PartWriteDataInt32 (file, "data", data + i*DATASIZE);
assert (stat == H5_SUCCESS);
H5PartWriteDataInt32 (file, "data", data + i*DATASIZE);
}
// done
H5CloseFile(file);
MPI_Finalize();
return H5_SUCCESS;
}
+64
View File
@@ -0,0 +1,64 @@
!
! Copyright (c) 2006-2013, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program write_setview
use H5hut
implicit none
include 'mpif.h'
! the file name we want to read
character (len=*), parameter :: FNAME = "example_setview.h5"
integer*8, parameter :: DATASIZE = 32
integer*8, parameter :: ITERS = 4
integer*4, parameter :: npoints = ITERS*DATASIZE
integer :: comm, rank, ierr
integer*8 :: file, status
integer*4 :: i
integer*4, allocatable :: data(:)
integer*8 start, end, offset
! init MPI & H5hut
comm = MPI_COMM_WORLD
call mpi_init(ierr)
call mpi_comm_rank(comm, rank, ierr)
call h5_abort_on_error ()
call h5_set_verbosity_level (-1_8)
! create fake data
allocate (data (npoints))
do i = 1, npoints
data (i) = i + rank*npoints
enddo
! open the a file for parallel writing and ceate step #0
file = h5_openfile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT)
status = h5_setstep(file, 0_8)
! set the size of the 1D array
status = h5pt_setnpoints (file, int8(npoints))
offset = rank*npoints
do i = 1, ITERS
start = offset + 1 + (i-1)*DATASIZE
end = offset + i*DATASIZE
status = h5pt_setview (file, start, end)
! write the particles
status = h5pt_writedata_i4 (file, "data", data ((i-1)*DATASIZE+1))
end do
! cleanup
status = h5_closefile (file)
deallocate (data)
call mpi_finalize (ierr)
end program write_setview
+64
View File
@@ -0,0 +1,64 @@
/*
Copyright (c) 2006-2013, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
#define FNAME "example_strided.h5"
#define NPOINTS 99
int
main (
int argc,
char** argv
) {
// MPI & H5hut init
MPI_Init (&argc, &argv);
int rank;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Comm_rank (comm, &rank);
H5AbortOnError ();
// create fake data
h5_float64_t particles[6*NPOINTS];
h5_int64_t id[NPOINTS];
for (int i = 0; i < NPOINTS; i++) {
particles [6*i + 0] = 0.0 + i + NPOINTS * rank;
particles [6*i + 1] = 0.1 + i + NPOINTS * rank;
particles [6*i + 2] = 0.2 + i + NPOINTS * rank;
particles [6*i + 3] = 0.3 + i + NPOINTS * rank;
particles [6*i + 4] = 0.4 + i + NPOINTS * rank;
particles [6*i + 5] = 0.5 + i + NPOINTS * rank;
id [i] = i + NPOINTS * rank;
}
// open file with MPI_COMM_WORLD and create step #0
h5_file_t file = H5OpenFile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT);
H5SetStep (file, 0);
// define number of items this processor will write and set the
// in-memory striding
H5PartSetNumParticlesStrided (file, NPOINTS, 6);
// write strided data
H5PartWriteDataFloat64 (file, "x", particles+0);
H5PartWriteDataFloat64 (file, "y", particles+1);
H5PartWriteDataFloat64 (file, "z", particles+2);
H5PartWriteDataFloat64 (file, "px", particles+3);
H5PartWriteDataFloat64 (file, "py", particles+4);
H5PartWriteDataFloat64 (file, "pz", particles+5);
// disable striding to write the ID's
H5PartSetNumParticles (file, NPOINTS);
H5PartWriteDataInt64 (file, "id", id);
// cleanup
H5CloseFile (file);
MPI_Finalize ();
return 0;
}
+48 -39
View File
@@ -1,61 +1,70 @@
program H5PartTest
implicit none
!
! Copyright (c) 2006-2013, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program write_stridedf
use H5hut
implicit none
include 'mpif.h'
include 'H5PartF.h'
! the file name we want to read
character (len=*), parameter :: FNAME = "example_strided.h5"
integer*8, parameter :: NPOINTS = 99
integer :: comm, rank, ierr
integer*8 :: file_id, status, npoints, i
integer*8 :: file, i, status
real*8, allocatable :: particles(:)
integer*8, allocatable :: id(:)
! init MPI & H5hut
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_openw_par('test.h5', comm)
! in the Fortran API, steps start at 1
status = h5pt_setstep(file_id, 1_8)
! write an attribute to the file
status = h5pt_writefileattrib_string(file_id, 'desc', 'This is a test.')
call h5_abort_on_error ()
! create fake data
npoints = 99
allocate(particles(6*npoints), id(npoints))
do i=0,npoints-1
particles(6*i+1) = 0.0 + real(i+npoints*rank)
particles(6*i+2) = 0.1 + real(i+npoints*rank)
particles(6*i+3) = 0.2 + real(i+npoints*rank)
particles(6*i+4) = 0.3 + real(i+npoints*rank)
particles(6*i+5) = 0.4 + real(i+npoints*rank)
particles(6*i+6) = 0.5 + real(i+npoints*rank)
id(i+1) = i+npoints*rank
allocate(particles(6*NPOINTS), id(NPOINTS))
do i = 0, NPOINTS-1
particles (6*i + 1) = 0.0 + real (i + NPOINTS*rank)
particles (6*i + 2) = 0.1 + real (i + NPOINTS*rank)
particles (6*i + 3) = 0.2 + real (i + NPOINTS*rank)
particles (6*i + 4) = 0.3 + real (i + NPOINTS*rank)
particles (6*i + 5) = 0.4 + real (i + NPOINTS*rank)
particles (6*i + 6) = 0.5 + real (i + NPOINTS*rank)
id(i+1) = i+NPOINTS*rank
enddo
! set the striding to 6
status = h5pt_setnpoints_strided(file_id, npoints, 6_8)
! open the a file for parallel writing and ceate step #0
file = h5_openfile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT)
status = h5_setstep(file, 0_8)
! write the particles
status = h5pt_writedata_r8(file_id, "x", particles(1))
status = h5pt_writedata_r8(file_id, "y", particles(2))
status = h5pt_writedata_r8(file_id, "z", particles(3))
status = h5pt_writedata_r8(file_id, "px", particles(4))
status = h5pt_writedata_r8(file_id, "py", particles(5))
status = h5pt_writedata_r8(file_id, "pz", particles(6))
! define number of items this processor will write and set the
! in-memory striding
status = h5pt_setnpoints_strided (file, NPOINTS, 6_8)
! disable the striding to write the ids
status = h5pt_setnpoints(file_id, npoints)
status = h5pt_writedata_i8(file_id, "id", id)
! write strided data
status = h5pt_writedata_r8 (file, "x", particles(1))
status = h5pt_writedata_r8 (file, "y", particles(2))
status = h5pt_writedata_r8 (file, "z", particles(3))
status = h5pt_writedata_r8 (file, "px", particles(4))
status = h5pt_writedata_r8 (file, "py", particles(5))
status = h5pt_writedata_r8 (file, "pz", particles(6))
! close the file
status = h5pt_close(file_id)
! disable striding to write the ID's
status = h5pt_setnpoints(file, NPOINTS)
status = h5pt_writedata_i8(file, "id", id)
! cleanup
status = h5_closefile (file)
deallocate(particles, id)
call mpi_finalize(ierr)
end program H5PartTest
end program write_stridedf