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