On Thu, Jan 19, 2012 at 2:50 AM, Mohamad M. Nasr-Azadani <span dir="ltr"><<a href="mailto:mmnasr@gmail.com">mmnasr@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi guys, <div><br></div><div>I have compiled petsc to use HDF5 package. </div><div><br></div><div>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 <span style="font-family:monospace;white-space:pre-wrap"><font size="4">PetscViewerHDF5Open(). </font></span></div>
<div>I followed the example here <a href="http://www.mcs.anl.gov/petsc/petsc-current/src/dm/examples/tutorials/ex10.c.html" target="_blank">http://www.mcs.anl.gov/petsc/petsc-current/src/dm/examples/tutorials/ex10.c.html</a></div>
<div>and everything looks fine. </div>
<div><br></div><div>However, I had a couple questions: </div><div><br></div><div>1- When I am done writing the parallel vector obtained from the DA (and PETSC_COMM_WORLD), </div><div><span style="white-space:pre-wrap;font-family:monospace"><br>
</span></div><div><span style="white-space:pre-wrap;font-family:monospace">// Create the HDF5 viewer</span></div><div><span style="white-space:pre-wrap;font-family:monospace"> </span><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerHDF5Open.html#PetscViewerHDF5Open" style="white-space:pre-wrap;font-family:monospace" target="_blank">PetscViewerHDF5Open</a><span style="white-space:pre-wrap;font-family:monospace">(</span><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PETSC_COMM_WORLD.html#PETSC_COMM_WORLD" style="white-space:pre-wrap;font-family:monospace" target="_blank">PETSC_COMM_WORLD</a><span style="white-space:pre-wrap;font-family:monospace">,</span><font color="#666666" style="white-space:pre-wrap;font-family:monospace">"gauss.h5"</font><span style="white-space:pre-wrap;font-family:monospace">,FILE_MODE_WRITE,&H5viewer);</span></div>
<div><span style="white-space:pre-wrap;font-family:monospace">// Write the H5 file</span></div><div> <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecView.html#VecView" style="white-space:pre-wrap;font-family:monospace" target="_blank">VecView</a><span style="white-space:pre-wrap;font-family:monospace">(gauss,H5viewer);</span></div>
<div><span style="white-space:pre-wrap;font-family:monospace">// Cleaning stage</span></div><div><span style="white-space:pre-wrap;font-family:monospace"> </span><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerDestroy.html#PetscViewerDestroy" style="white-space:pre-wrap;font-family:monospace" target="_blank">PetscViewerDestroy</a><span style="white-space:pre-wrap;font-family:monospace">(&H5viewer);</span></div>
<div><span style="white-space:pre-wrap;font-family:monospace"><br></span></div><div>how can I add data that are just simple 1-D numbers stored on local arrays. </div>
<div>
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. </div>
</blockquote><div><br></div><div>Use the DA coordinate mechanism and you can get the coordinates as a parallel Vec.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>2- When using VecView() and HDF5 writer, what is the status of data compression? </div><div>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. </div>
<div>In fact, it is slightly bigger than pure binary file!!</div><div>Is there any command we have to set in Petsc to tell HDF5 viewer to use data compression? </div></blockquote><div><br></div><div>We do not support it. We are happy to take patches that enable this.</div>
<div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Thanks for your patience, </div>
<div>
Best, </div><span class="HOEnZb"><font color="#888888"><div>Mohamad</div><div><br></div><div><br></div><div><br></div>
<div><br></div>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener<br>