> On Dec 5, 2018, at 12:40 PM, Sajid Ali <[email protected]> > wrote: > > Exactly. > > When I run ex10 and inspect it with cat, I get garbage since the data is in > binary : > > [sajid@xrm temp]$ cat vector.dat > {N?�@@@@▒@@ @"@$@&@(@*@,@.@0@1@2@3[sajid@xrm temp]$ > > > But doing a binary dump shows the data : > [sajid@xrm temp]$ xxd -b vector.dat > 0000000: 00000000 00010010 01111011 01001110 00000000 00000000 ..{N.. > 0000006: 00000000 00010100 00000000 00000000 00000000 00000000 ...... > 000000c: 00000000 00000000 00000000 00000000 00111111 11110000 ....?. > 0000012: 00000000 00000000 00000000 00000000 00000000 00000000 ...... > 0000018: 01000000 00000000 00000000 00000000 00000000 00000000 @..... > 000001e: 00000000 00000000 01000000 00001000 00000000 00000000 ..@... > 0000024: 00000000 00000000 00000000 00000000 01000000 00010000 ....@. > 000002a: 00000000 00000000 00000000 00000000 00000000 00000000 ...... > 0000030: 01000000 00010100 00000000 00000000 00000000 00000000 @..... > 0000036: 00000000 00000000 01000000 00011000 00000000 00000000 ..@... > 000003c: 00000000 00000000 00000000 00000000 01000000 00011100 ....@. > 0000042: 00000000 00000000 00000000 00000000 00000000 00000000 ...... > 0000048: 01000000 00100000 00000000 00000000 00000000 00000000 @ .... > 000004e: 00000000 00000000 01000000 00100010 00000000 00000000 ..@".. > 0000054: 00000000 00000000 00000000 00000000 01000000 00100100 ....@$ > 000005a: 00000000 00000000 00000000 00000000 00000000 00000000 ...... > 0000060: 01000000 00100110 00000000 00000000 00000000 00000000 @&.... > 0000066: 00000000 00000000 01000000 00101000 00000000 00000000 ..@(.. > 000006c: 00000000 00000000 00000000 00000000 01000000 00101010 ....@* > 0000072: 00000000 00000000 00000000 00000000 00000000 00000000 ...... > 0000078: 01000000 00101100 00000000 00000000 00000000 00000000 @,.... > 000007e: 00000000 00000000 01000000 00101110 00000000 00000000 ..@... > 0000084: 00000000 00000000 00000000 00000000 01000000 00110000 ....@0 > 000008a: 00000000 00000000 00000000 00000000 00000000 00000000 ...... > 0000090: 01000000 00110001 00000000 00000000 00000000 00000000 @1.... > 0000096: 00000000 00000000 01000000 00110010 00000000 00000000 ..@2.. > 000009c: 00000000 00000000 00000000 00000000 01000000 00110011 ....@3 > 00000a2: 00000000 00000000 00000000 00000000 00000000 00000000 ...... > > I think that the special characters on the right are just an attempt at > converting the binary data to ascii so they're not relevant to us. > > I've created the same file as per the format specified in this thread, i.e. > VEC_FILE_CLASSID, num_elements followed by the elements in ieee-754 64-bit > format.
How did you create this file? Can you send us the code that creates the file and writes out the data? Barry > > I've saved everything as 1's and 0's in a file as shown above. If it were > indeed a binary file, doing a cat on it should output garbage as it did for > the file above. But it instead interprets each 0 and 1 as an ascii character. > > The specific error is : > [sajid@xrm temp]$ ./ex10 -binary > reading vector in binary from vector.dat ... > [0]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [0]PETSC ERROR: Invalid argument > [0]PETSC ERROR: Not a vector next in 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.2, unknown > [0]PETSC ERROR: ./ex10 on a named xrm by sajid Wed Dec 5 12:39:40 2018 > [0]PETSC ERROR: Configure options > --prefix=/raid/home/sajid/packages/spack/opt/spack/linux-rhel7-x86_64/gcc-7.3.0/petsc-3.10.2.1-xnahapbbgtr1 > [0]PETSC ERROR: #1 PetscViewerBinaryReadVecHeader_Private() line 26 in > /tmp/sajid/spack-stage/spack-stage-7h2QI3/petsc/src/vec/vec/utils/vecc > [0]PETSC ERROR: #2 VecLoad_Binary() line 84 in > /tmp/sajid/spack-stage/spack-stage-7h2QI3/petsc/src/vec/vec/utils/vecio.c > [0]PETSC ERROR: #3 VecLoad_Default() line 516 in > /tmp/sajid/spack-stage/spack-stage-7h2QI3/petsc/src/vec/vec/utils/vecio.c > [0]PETSC ERROR: #4 VecLoad() line 933 in > /tmp/sajid/spack-stage/spack-stage-7h2QI3/petsc/src/vec/vec/interface/vector.c > [0]PETSC ERROR: #5 main() line 155 in > /raid/home/sajid/packages/xwp_petsc/temp/ex10.c > [0]PETSC ERROR: PETSc Option Table entries: > [0]PETSC ERROR: -binary > [0]PETSC ERROR: -vecload_block_size 1 > [0]PETSC ERROR: ----------------End of Error Message -------send entire error > message to [email protected] > application called MPI_Abort(MPI_COMM_WORLD, 62) - process 0 > [unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=62 > : > system msg for write_line failure : Bad file descriptor > >
