[petsc-users] A few questions about hdf5 viewer

Mohamad M. Nasr-Azadani mmnasr at gmail.com
Thu Jan 19 02:50:51 CST 2012


Hi guys,

I have compiled petsc to use HDF5 package.

I like to store the data from a parallel vector(s) (obtained from
structured DA in 3 dimensions) to file using VecView() in conjunction
with PetscViewerHDF5Open().

I followed the example here
http://www.mcs.anl.gov/petsc/petsc-current/src/dm/examples/tutorials/ex10.c.html
and everything looks fine.

However, I had a couple questions:

1- When I am done writing the parallel vector obtained from the DA (and
PETSC_COMM_WORLD),

// Create the HDF5 viewer
PetscViewerHDF5Open<http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerHDF5Open.html#PetscViewerHDF5Open>
(PETSC_COMM_WORLD<http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PETSC_COMM_WORLD.html#PETSC_COMM_WORLD>
,"gauss.h5",FILE_MODE_WRITE,&H5viewer);
// Write the H5 file
   VecView<http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecView.html#VecView>
(gauss,H5viewer);
// Cleaning stage
PetscViewerDestroy<http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerDestroy.html#PetscViewerDestroy>
(&H5viewer);

how can I add data that are just simple 1-D numbers stored on local arrays.
Easier said, I would like to add the structured grid coordinates (first all
x's, then all y's, and then all z's) at the end (or to the beginning) of
each data (*.h5) file. But the grid coordinates are stored locally on each
machine and not derived from any parallel vectors or DA. I was thinking
about creating vectors and viewers using PETSC_COMM_SELF but i am not sure
if that is the right approach since that vector is created on all
processors locally.

2- When using VecView() and HDF5 writer, what is the status of data
compression?
The reason that I am asking is that, I used the same example above and
comparing two files saved via two different PetscViewers, i.e. (just)
Binary and HDF5 (Binary) the size is not reduced in the (*.h5) case.
In fact, it is slightly bigger than pure binary file!!
Is there any command we have to set in Petsc to tell HDF5 viewer to use
data compression?

Thanks for your patience,
Best,
Mohamad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120119/3c7c2fc1/attachment-0001.htm>


More information about the petsc-users mailing list