<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri, sans-serif" size="2">
<div>Hello everyone, </div>
<div> </div>
<div> 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 <font face="Courier New, monospace" size="2">PetscBinaryRead(</font><font face="Courier New, monospace" size="2" color="#A020F0">'myA.dat'</font><font face="Courier New, monospace" size="2">)correctly.</font></div>
<div><font face="Times New Roman, serif"> </font></div>
<div><font face="Courier New, monospace" size="2">A = [1 2 0;</font></div>
<div><font face="Courier New, monospace" size="2"> 2 0 5;</font></div>
<div><font face="Courier New, monospace" size="2"> 0 3 0;</font></div>
<div><font face="Courier New, monospace" size="2"> 1 4 1]</font></div>
<div><font face="Courier New, monospace" size="2">PetscBinaryWrite(<font color="#A020F0">'myA.dat'</font>,sparse(A))</font></div>
<div><font face="Courier New, monospace" size="2">PetscBinaryRead(<font color="#A020F0">'myA.dat'</font>)</font></div>
<div><font face="Times New Roman, serif"> </font></div>
<div style="text-indent: 9pt; ">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:</div>
<div style="text-indent: 9pt; "> </div>
<div style="text-indent: 9pt; ">[d3m956@olympus tutorials]$ ./ex12 -f0 myA.dat</div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: --------------------- Error Message ------------------------------------</div>
<div style="text-indent: 9pt; "><font color="#FF0000">[0]PETSC ERROR: Read from file failed!</font></div>
<div style="text-indent: 9pt; "><font color="#FF0000">[0]PETSC ERROR: Read past end of file!</font></div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: ------------------------------------------------------------------------</div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: Petsc Release Version 3.3.0, Patch 0, Tue Jun 5 14:20:42 CDT 2012</div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: See docs/changes/index.html for recent updates.</div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.</div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: See docs/index.html for manual pages.</div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: ------------------------------------------------------------------------</div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: ./ex12 on a arch-linu named olympus.local by d3m956 Tue Jun 26 13:51:28 2012</div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: Libraries linked from /pic/projects/mca/ss/PETSC/petsc-3.3-p0/arch-linux2-c-debug/lib</div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: Configure run at Thu Jun 14 17:00:19 2012</div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: Configure options --with-cc=gcc --with-fc=gfortran --download-f-blas-lapack --download-mpich</div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: ------------------------------------------------------------------------</div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: PetscBinaryRead() line 271 in src/sys/fileio/sysio.c</div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: PetscBinarySynchronizedRead() line 558 in src/sys/fileio/sysio.c</div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: PetscViewerBinaryRead() line 764 in src/sys/viewer/impls/binary/binv.c</div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: PetscViewerBinaryReadVecHeader_Private() line 24 in src/vec/vec/utils/vecio.c</div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: VecLoad_Binary() line 97 in src/vec/vec/utils/vecio.c</div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: VecLoad_Default() line 348 in src/vec/vec/utils/vecio.c</div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: VecLoad() line 1111 in src/vec/vec/interface/vector.c</div>
<div style="text-indent: 9pt; ">[0]PETSC ERROR: main() line 92 in src/mat/examples/tutorials/ex12.c</div>
<div style="text-indent: 9pt; "> </div>
<div style="text-indent: 9pt; ">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.</div>
<div style="text-indent: 9pt; "> </div>
<div style="text-indent: 9pt; ">Thanks,</div>
<div style="text-indent: 9pt; ">Shuangshuang</div>
<div><font face="Times New Roman, serif"> </font></div>
<div><font face="Times New Roman, serif"> </font></div>
</font>
</body>
</html>