<div dir="ltr"><div>Thank you so much Lisandro!</div><div><br></div><div>That was very helpful actually and what I was looking for, but now it still requires an intermediate step of a short python script where I have to use byteswap() on the data to get it to work on other platforms.</div><div>Would you happen to know any way of byteswapping in petsc? I was reading and it seems PetscBinaryWrite does byteswapping but I am not sure it would work in my case as there are no examples with it writing a petsc vector.</div><div><br></div><div>Thanks and all the best<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Dec 2, 2018 at 10:01 AM Lisandro Dalcin <<a href="mailto:dalcinl@gmail.com">dalcinl@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr">Use PetscViewerBinarySetSkipHeader(viewer, PETSC_TRUE) before VecView().</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, 29 Nov 2018 at 18:50, Sal Am via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Is there a way to write the solution from the system Ax=b in raw binary instead of PETSc binary format?</div><div><br></div><div>Currently I am doing:<br>  ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD, "../../python/petscpy/Vector_x_petsc.dat", FILE_MODE_WRITE, &viewer);CHKERRQ(ierr);<br>  ierr = VecView(x,viewer);CHKERRQ(ierr);CHKERRQ(ierr);<br>  ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr);</div><div><br></div><div>And then use PetscBinaryIO to read it back and save it using write('newformat', 'wb') to get to raw... however this approach is not good it seems as there are some troubles with little/big endian when using the resulting converted file on other systems for post-processing. <br></div><div><br></div><div>Thanks,</div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="m_7261480720457572894gmail_signature" data-smartmail="gmail_signature">Lisandro Dalcin<br>============<br>Research Scientist<br>Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)<br>Extreme Computing Research Center (ECRC)<br>King Abdullah University of Science and Technology (KAUST)<br><a href="http://ecrc.kaust.edu.sa/" target="_blank">http://ecrc.kaust.edu.sa/</a><br><br>4700 King Abdullah University of Science and Technology<br>al-Khawarizmi Bldg (Bldg 1), Office # 0109<br>Thuwal 23955-6900, Kingdom of Saudi Arabia<br><a href="http://www.kaust.edu.sa" target="_blank">http://www.kaust.edu.sa</a><br><br>Office Phone: +966 12 808-0459</div>
</blockquote></div>