I sent this yesterday! What is going on with petsc-main mail?<div><br></div><div> Matt<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Matthew Knepley</b> <span dir="ltr"><<a href="mailto:petsc-maint@mcs.anl.gov">petsc-maint@mcs.anl.gov</a>></span><br>
Date: Tue, Feb 21, 2012 at 12:44 PM<br>Subject: Re: [petsc-maint #106588] ascii reader<br>To: <a href="mailto:petsc-maint@mcs.anl.gov">petsc-maint@mcs.anl.gov</a>, jliu <<a href="mailto:jliu@ices.utexas.edu">jliu@ices.utexas.edu</a>><br>
<br><br>On Mon, Feb 20, 2012 at 10:05 PM, jliu <<a href="mailto:jliu@ices.utexas.edu">jliu@ices.utexas.edu</a>> wrote:<br>
<br>
> The length seems to be wrong ...<br>
><br>
<br>
This is unhelpful. I can't understand how someone would be expected to<br>
debug something<br>
with the statement "this value seems to be wrong"? Here are things that<br>
would be helpful<br>
<br>
a) What is the original vector size and ghost size?<br>
<br>
b) What is the size in the file?<br>
<br>
If you want this fixed, I would give us the information you would need to<br>
understand it.<br>
<br>
Matt<br>
<br>
What do you mean by corrupt? The code I use to write the vector is:<br>
><br>
<br>
<br>
<br>
<br>
> void PDNSolution::WriteBinary(const char * file_name)<br>
<div class="im">> {<br>
> PetscViewer viewer;<br>
> PetscViewerCreate(PETSC_COMM_WORLD, &viewer);<br>
> PetscViewerSetType(viewer, PETSCVIEWERBINARY);<br>
> PetscViewerFileSetMode(viewer, FILE_MODE_WRITE);<br>
> PetscViewerBinarySetMPIIO(viewer);<br>
> PetscViewerBinarySkipInfo(viewer);<br>
> PetscViewerFileSetName(viewer, file_name);<br>
><br>
> VecView(solution, viewer);<br>
> PetscViewerDestroy(&viewer);<br>
</div>> };<br>
><br>
> The input solution is a parallel vector with ghost component. I am not<br>
> sure if that's enough for debugging.<br>
<div class="HOEnZb"><div class="h5">><br>
><br>
><br>
><br>
> On 02/20/2012 09:59 PM, Matthew Knepley wrote:<br>
> > On Mon, Feb 20, 2012 at 9:50 PM, jliu <<a href="mailto:jliu@ices.utexas.edu">jliu@ices.utexas.edu</a><br>
> > <mailto:<a href="mailto:jliu@ices.utexas.edu">jliu@ices.utexas.edu</a>>> wrote:<br>
> ><br>
> ><br>
> > OK.<br>
> ><br>
> > This is my read code:<br>
> ><br>
> > 159 ierr = PetscViewerBinaryOpen(PETSC_COMM_SELF,<br>
> > "Nonlinear_Diff_temp_900000000",<br>
> > 160 FILE_MODE_READ, &view_in);<br>
> > 161 CHKERRQ(ierr);<br>
> > 162<br>
> > 163 ierr = VecLoad(sol, view_in); CHKERRQ(ierr);<br>
> ><br>
> ><br>
> > The file now is clearly corrupt. So we can debug this if you make a<br>
> > small example code<br>
> > and send it. You can debug it with this code if you go into the<br>
> > debugger and check the<br>
> > size it reads in at the top of the file, and compare to the length of<br>
> > the vector you wrote.<br>
> ><br>
> > Matt<br>
> ><br>
> ><br>
> ><br>
> > I get error message:<br>
> > [0]PETSC ERROR: --------------------- Error Message<br>
> > ------------------------------------<br>
> > [0]PETSC ERROR: Read from file failed!<br>
> > [0]PETSC ERROR: Read past end of file!<br>
> > [0]PETSC ERROR:<br>
> ><br>
> ------------------------------------------------------------------------<br>
> > [0]PETSC ERROR: Petsc Release Version 3.2.0, Patch 5, Sat Oct 29<br>
> > 13:45:54 CDT 2011<br>
> > [0]PETSC ERROR: See docs/changes/index.html for recent updates.<br>
> > [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.<br>
> > [0]PETSC ERROR: See docs/index.html for manual pages.<br>
> > [0]PETSC ERROR:<br>
> ><br>
> ------------------------------------------------------------------------<br>
> > [0]PETSC ERROR: ./postprocess_error on a linux-gnu named hahn by jliu<br>
> > Mon Feb 20 21:49:44 2012<br>
> > [0]PETSC ERROR: Libraries linked from<br>
> > /org/groups/hughes/opt/lin/petsc-3.2-p5/linux-gnu-c-debug/lib<br>
> > [0]PETSC ERROR: Configure run at Fri Feb 3 15:33:57 2012<br>
> > [0]PETSC ERROR: Configure options --with-cc=gcc --with-fc=gfortran<br>
> > --download-f-blas-lapack=1 --download-mpich=1<br>
> > [0]PETSC ERROR:<br>
> ><br>
> ------------------------------------------------------------------------<br>
> > [0]PETSC ERROR: PetscBinaryRead() line 271 in<br>
> > /org/groups/hughes/opt/lin/petsc-3.2-p5/src/sys/fileio/sysio.c<br>
> > [0]PETSC ERROR: VecLoad_Binary() line 123 in<br>
> > /org/groups/hughes/opt/lin/petsc-3.2-p5/src/vec/vec/utils/vecio.c<br>
> > [0]PETSC ERROR: VecLoad_Default() line 359 in<br>
> > /org/groups/hughes/opt/lin/petsc-3.2-p5/src/vec/vec/utils/vecio.c<br>
> > [0]PETSC ERROR: VecLoad() line 1081 in<br>
> ><br>
> /org/groups/hughes/opt/lin/petsc-3.2-p5/src/vec/vec/interface/vector.c<br>
> > [0]PETSC ERROR: User provided function() line 163 in<br>
> > "unknowndirectory/"/h1/jliu/IsoPETSc/trunk/postprocess_error.cpp<br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> > On 02/20/2012 09:43 PM, Matthew Knepley wrote:<br>
> > > On Mon, Feb 20, 2012 at 9:36 PM, jliu <<a href="mailto:jliu@ices.utexas.edu">jliu@ices.utexas.edu</a><br>
> > <mailto:<a href="mailto:jliu@ices.utexas.edu">jliu@ices.utexas.edu</a>><br>
> > > <mailto:<a href="mailto:jliu@ices.utexas.edu">jliu@ices.utexas.edu</a> <mailto:<a href="mailto:jliu@ices.utexas.edu">jliu@ices.utexas.edu</a>>>><br>
> wrote:<br>
> > ><br>
> > > On 02/20/2012 09:31 PM, Jed Brown wrote:<br>
> > > > Always include petsc-maint.<br>
> > > ><br>
> > > > On Mon, Feb 20, 2012 at 21:28, jliu <<a href="mailto:jliu@ices.utexas.edu">jliu@ices.utexas.edu</a><br>
> > <mailto:<a href="mailto:jliu@ices.utexas.edu">jliu@ices.utexas.edu</a>><br>
> > > <mailto:<a href="mailto:jliu@ices.utexas.edu">jliu@ices.utexas.edu</a> <mailto:<a href="mailto:jliu@ices.utexas.edu">jliu@ices.utexas.edu</a>>><br>
> > > > <mailto:<a href="mailto:jliu@ices.utexas.edu">jliu@ices.utexas.edu</a> <mailto:<a href="mailto:jliu@ices.utexas.edu">jliu@ices.utexas.edu</a>><br>
> > <mailto:<a href="mailto:jliu@ices.utexas.edu">jliu@ices.utexas.edu</a> <mailto:<a href="mailto:jliu@ices.utexas.edu">jliu@ices.utexas.edu</a>>>>> wrote:<br>
> > > ><br>
> > > > I tried binary, but I always get an error:<br>
> > > ><br>
> > > > [0]PETSC ERROR: Read from file failed!<br>
> > > > [0]PETSC ERROR: Read past end of file!<br>
> > > ><br>
> > > > I do not know what's wrong with the binary reader..<br>
> > > ><br>
> > > > You have not explained what you wrote to the file or how you<br>
> > > tried to<br>
> > > > read the file.<br>
> > > Oh,<br>
> > ><br>
> > > I write my binary file as:<br>
> > ><br>
> > > PetscViewer viewer;<br>
> > > PetscViewerCreate(PETSC_COMM_WORLD, &viewer);<br>
> > > PetscViewerSetType(viewer, PETSCVIEWERBINARY);<br>
> > > PetscViewerFileSetMode(viewer, FILE_MODE_WRITE);<br>
> > > PetscViewerBinarySetMPIIO(viewer);<br>
> > > PetscViewerBinarySkipInfo(viewer);<br>
> > > PetscViewerFileSetName(viewer, file_name);<br>
> > ><br>
> > > VecView(solution, viewer);<br>
> > > PetscViewerDestroy(&viewer);<br>
> > ><br>
> > ><br>
> > > As I said, check all return values so I can see the stack. How<br>
> > hard is<br>
> > ><br>
> > > ierr = VecLoad(); CHKERRQ(ierr);<br>
> > ><br>
> > > Matt<br>
> > ><br>
> > ><br>
> > ><br>
> > > and I tried to read the saved file with:<br>
> > ><br>
> > > PetscViewerBinaryOpen(PETSC_COMM_SELF,<br>
> > > "Nonlinear_Diff_temp_900000000",<br>
> > > FILE_MODE_READ, &view_in);<br>
> > > PetscViewerBinaryGetDescriptor(view_in,&fd);<br>
> > > PetscBinaryRead(fd,&sz,1,PETSC_INT);<br>
> > > cout<<sz<<endl;<br>
> > > PetscBinaryRead(fd,sol,100,PETSC_SCALAR);<br>
> > > VecLoad(sol, view_in);<br>
> > ><br>
> > ><br>
> > > I vector saved is a parallel ghost vector. I don't know if<br>
> > that is an<br>
> > > issue. Else, I can not see what is the problem...<br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > > --<br>
> > > What most experimenters take for granted before they begin their<br>
> > > experiments is infinitely more interesting than any results to<br>
> which<br>
> > > their experiments lead.<br>
> > > -- Norbert Wiener<br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> > --<br>
> > What most experimenters take for granted before they begin their<br>
> > experiments is infinitely more interesting than any results to which<br>
> > their experiments lead.<br>
> > -- Norbert Wiener<br>
><br>
><br>
><br>
<br>
<br>
--<br>
What most experimenters take for granted before they begin their<br>
experiments is infinitely more interesting than any results to which their<br>
experiments lead.<br>
-- Norbert Wiener<br>
<br>
</div></div></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>
</div>