[petsc-users] Loading Binary file problem

Jed Brown jedbrown at mcs.anl.gov
Tue Jun 26 18:01:46 CDT 2012


On Tue, Jun 26, 2012 at 1:09 PM, Jin, Shuangshuang <
Shuangshuang.Jin at pnnl.gov> wrote:

>  Hello everyone,
>
>      I created a 4*3 matrix A in matlab, saved it to binary file “myA.dat”
> using PetscBinaryWrite(‘myA.dat’,sparse(A)). Everything seems fine to me
> because I can read the binary file ‘myA.dat’ by PetscBinaryRead('myA.dat'
> )correctly.
>
> A = [1     2     0;
>      2     0     5;
>      0     3     0;
>      1     4     1]
> PetscBinaryWrite('myA.dat',sparse(A))
> PetscBinaryRead('myA.dat')
>
> However, when I tried to load the binary file “myA.dat” in PETSc using the
> example code “ex12.c” under “petsc-3.3-p0/src/mat/examples/tutorials”, I
> got error message below:
>
> [d3m956 at olympus tutorials]$ ./ex12 -f0 myA.dat
>

This program expects a matrix followed by a vector in the file. You can use
-rhs 0 to skip reading the right hand side vector from the file, it will
use a vector of all ones.


> [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.3.0, Patch 0, Tue Jun  5 14:20:42
> CDT 2012
> [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: ./ex12 on a arch-linu named olympus.local by d3m956 Tue
> Jun 26 13:51:28 2012
> [0]PETSC ERROR: Libraries linked from
> /pic/projects/mca/ss/PETSC/petsc-3.3-p0/arch-linux2-c-debug/lib
> [0]PETSC ERROR: Configure run at Thu Jun 14 17:00:19 2012
> [0]PETSC ERROR: Configure options --with-cc=gcc --with-fc=gfortran
> --download-f-blas-lapack --download-mpich
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: PetscBinaryRead() line 271 in src/sys/fileio/sysio.c
> [0]PETSC ERROR: PetscBinarySynchronizedRead() line 558 in
> src/sys/fileio/sysio.c
> [0]PETSC ERROR: PetscViewerBinaryRead() line 764 in
> src/sys/viewer/impls/binary/binv.c
> [0]PETSC ERROR: PetscViewerBinaryReadVecHeader_Private() line 24 in
> src/vec/vec/utils/vecio.c
> [0]PETSC ERROR: VecLoad_Binary() line 97 in src/vec/vec/utils/vecio.c
> [0]PETSC ERROR: VecLoad_Default() line 348 in src/vec/vec/utils/vecio.c
> [0]PETSC ERROR: VecLoad() line 1111 in src/vec/vec/interface/vector.c
> [0]PETSC ERROR: main() line 92 in src/mat/examples/tutorials/ex12.c
>
> It said “Read from file failed! Read past end of file!” Anything wrong? I
> was using the example code without changing anything. Please help me to
> figure out the problem.
>
> Thanks,
> Shuangshuang
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120626/24f23585/attachment-0001.html>


More information about the petsc-users mailing list