[petsc-users] PetscBinaryRead fails

Yuyun Yang yyang85 at stanford.edu
Mon Feb 18 21:23:49 CST 2019


I used FILE_MODE_READ. Please see attached file (the function is part of another file therefore all the other include statements; I've extracted it here). The test file only contains one number. My directory is hard-coded into the main function.

Thanks a lot!
Yuyun

-----Original Message-----
From: Smith, Barry F. <bsmith at mcs.anl.gov> 
Sent: Monday, February 18, 2019 6:41 PM
To: Yuyun Yang <yyang85 at stanford.edu>
Cc: petsc-users at mcs.anl.gov
Subject: Re: [petsc-users] PetscBinaryRead fails


  Send program and data file if you cannot get it to work.


> On Feb 18, 2019, at 8:08 PM, Yuyun Yang via petsc-users <petsc-users at mcs.anl.gov> wrote:
> 
> Hello,
>  
> I am writing a very simple function just to read in a single value from an input file (which also just contains one single scalar value). Using PetscBinaryRead(fd, &value, 1, PETSC_SCALAR) gives me the following error. Could you help me figure out why?
>  
> [0]PETSC ERROR: --------------------- Error Message 
> --------------------------------------------------------------
> [0]PETSC ERROR: Read from file failed
> [0]PETSC ERROR: Read past end of file
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
> [0]PETSC ERROR: Petsc Release Version 3.10.3, unknown [0]PETSC ERROR: 
> ./output on a arch-linux2-c-debug named DESKTOP-02K82L1.stanford.edu 
> by yyy910805 Mon Feb 18 17:58:30 2019 [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ --with-shared-libraries=1 --download-hdf5 --download-metis --download-parmetis --download-hypre --download-superlu --download-mumps --download-scalapack --download-mpich --download-mpich-configure-arguments="--enable-error-messages=all --enable-g"
> [0]PETSC ERROR: #1 PetscBinaryRead() line 276 in 
> /home/yyy910805/petsc/src/sys/fileio/sysio.c
> 0.000000
>  
> Thanks a lot!
> Yuyun

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: testCheckpointLoadVal.cpp
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190219/12bf74f2/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: _test
Type: application/octet-stream
Size: 6 bytes
Desc: _test
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190219/12bf74f2/attachment.obj>


More information about the petsc-users mailing list