<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thank you both.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The reason the sequential one was storing multiple datasets was that the vector was created and destroyed each time step, so the name was changing in the hdf5 file as the pointer for the vector was changing.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Neither version originally was ever calling SetTimeStep, which I have since added and it appears to be working as intended.<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Matthew Knepley <knepley@gmail.com><br>
<b>Sent:</b> Tuesday, June 23, 2020 8:15 AM<br>
<b>To:</b> Lucas Banting <bantingl@myumanitoba.ca><br>
<b>Cc:</b> PETSc <petsc-users@mcs.anl.gov><br>
<b>Subject:</b> Re: [petsc-users] Question about HDF5 Viewer and Datasets</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr">On Tue, Jun 23, 2020 at 8:56 AM Lucas Banting <<a href="mailto:bantingl@myumanitoba.ca">bantingl@myumanitoba.ca</a>> wrote:<br>
</div>
<div class="x_gmail_quote">
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hello,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I am trying to use the HDF5 viewer to store the solution of my system at every iteration.
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I am storing the solutions in order to compare two different results, one from an old sequential program and one from a new parallel program that is parallelized using the DMDA structure.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I am using matlab to compare the results.<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
In the sequential program, the vector for the solution is just a simple one dimensional vector made from VecCreate. In the parallel program, the vector is made from DMCreateGlobalVector.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
In both versions of the program, I create the viewer as:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<div style="color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Consolas,"Courier New",monospace; font-weight:normal; font-size:14px; line-height:19px">
<div><span style="color:rgb(175,0,219)">call</span><span> </span><span style="color:rgb(121,94,38)">PetscViewerHDF5Open</span><span>(PETSC_COMM_WORLD,</span><span style="color:rgb(163,21,21)">"filename.hdf5"</span><span>,&</span></div>
<div><span> FILE_MODE_WRITE,hdf5viewer,ierr)</span></div>
<div><span><br>
</span></div>
<div><span style="font-family:calibri,arial,helvetica,sans-serif; font-size:12pt; line-height:normal; color:rgb(0,0,0); background-color:rgba(0,0,0,0)">When I load the files into MATLAB after words, the sequential program creates a new dataset each iteration,
while the parallel version using DMCreateGlobalVector only stores a single dataset.</span><span><br>
</span></div>
<div><span style="font-family:calibri,arial,helvetica,sans-serif; font-size:12pt; line-height:normal; color:rgb(0,0,0); background-color:rgba(0,0,0,0)">Is there a way I can force both viewers to create a new dataset in the same way each time vecview is called?
Or is there someway I can manually create a new dataset?</span></div>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>You can see inside the file using 'h5ls' and 'h5dump'. I believe that the Vec is stored in HDF5 using the name (of the PetscObject). I think</div>
<div>that is happening is that you are not setting the name, which means it defaults to the pointer, and that pointer is the same for your</div>
<div>global vector. I believe if you change the name at each iteration, they will all be saved. You can also use the Timestep mechanism as Barry</div>
<div>suggests.</div>
<div><br>
</div>
<div> Thanks,</div>
<div><br>
</div>
<div> Matt</div>
<div> </div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<div style="color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Consolas,"Courier New",monospace; font-weight:normal; font-size:14px; line-height:19px">
<div><span style="font-family:calibri,arial,helvetica,sans-serif; font-size:12pt; line-height:normal; color:rgb(0,0,0); background-color:rgba(0,0,0,0)">I am using Open MPI 3.1.4, Petsc 3.12.4, Intel Fortran 2019.5, and hdf5/<a href="http://1.10.5." target="_blank">1.10.5.</a></span></div>
<div><span><br>
</span></div>
<div><span style="font-family:calibri,arial,helvetica,sans-serif; font-size:12pt; line-height:normal; color:rgb(0,0,0); background-color:rgba(0,0,0,0)">Thanks,</span></div>
<div><span><br>
</span></div>
<div><span style="font-family:calibri,arial,helvetica,sans-serif; font-size:12pt; line-height:normal; color:rgb(0,0,0); background-color:rgba(0,0,0,0)">Lucas Banting</span><span><br>
</span></div>
</div>
<br>
</div>
</div>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr" class="x_gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>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</div>
<div><br>
</div>
<div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>