<br><br>On Thursday, 22 September 2016, Florian Lindner <<a href="javascript:_e(%7B%7D,'cvml','mailinglists@xgm.de');" target="_blank">mailinglists@xgm.de</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I want to write a MATSBAIJ to a file in binary, so that I can load it later using MatLoad.<br>
<br>
However, I keep getting the error:<br>
<br>
[5]PETSC ERROR: No support for this operation for this object type!<br>
[5]PETSC ERROR: Cannot get subcomm viewer for binary files or sockets unless SubViewer contains the rank 0 process<br>
[6]PETSC ERROR: PetscViewerGetSubViewer_Binary<wbr>() line 46 in<br>
/data/scratch/lindnefn/softwar<wbr>e/petsc/src/sys/classes/<wbr>viewer/impls/binary/binv.c<br>
<br>
The rank 0 is included, as you can see below, I use PETSC_COMM_WORLD and the matrix is also created like that.<br>
<br>
The code looks like:<br>
<br>
PetscErrorCode ierr = 0;<br>
PetscViewer viewer;<br>
PetscViewerBinaryOpen(PETSC_CO<wbr>MM_WORLD, filename.c_str(), FILE_MODE_WRITE, &viewer); CHKERRV(ierr);<br>
MatView(matrix, viewer); CHKERRV(ierr);<br>
PetscViewerDestroy(&viewer);</blockquote><div><br></div><div>The code snippet looks weird.</div><div><br></div>The error could be related to your usage of the error checking macros, Eg the fact you set ierr to zero rather than assigning it to the return value of your petsc function calls.<div><br></div><div>You should do</div><div>ierr = petscfunc();CHQERRQ(ierr);</div><div><br></div><div>And why do you use CHQERRV and not CHKERRQ?</div><div><br></div><div>Thanks </div><div> Dave<br><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks,<br>
Florian<br>
</blockquote></div>