<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Florian:</div><div class="gmail_quote">I can reproduce this error.</div><div class="gmail_quote">This is a bug in PETSc library. I'll fix it and get back to you soon.</div><div class="gmail_quote">Hong<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
Am 22.09.2016 um 18:34 schrieb Hong:<br>
> Florian:<br>
> Would it work if replacing MATSBAIJ to MATAIJ or MATMPISBAIJ?<br>
<br>
</span>MATAIJ works, but is not an option for my actual application.<br>
<br>
MATMPISBAIJ does not work. Not very suprisingly, since afaik setting it to MATSBAIJ and executing it on multiple MPI<br>
ranks actually results in MATMPISBAIJ.<br>
<br>
Best,<br>
Florian<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
><br>
> Hong<br>
><br>
> Hey,<br>
><br>
> this code reproduces the error when run with 2 or more ranks.<br>
><br>
> #include <petscmat.h><br>
> #include <petscsys.h><br>
><br>
> int main(int argc, char *argv[])<br>
> {<br>
> PetscInitialize(&argc, &argv, "", NULL);<br>
><br>
> Mat matrix;<br>
> MatCreate(PETSC_COMM_WORLD, &matrix);<br>
> MatSetType(matrix, MATSBAIJ);<br>
> MatSetSizes(matrix, 10, 10, PETSC_DETERMINE, PETSC_DETERMINE);<br>
> MatSetFromOptions(matrix);<br>
> MatSetUp(matrix);<br>
><br>
> MatAssemblyBegin(matrix, MAT_FINAL_ASSEMBLY);<br>
> MatAssemblyEnd(matrix, MAT_FINAL_ASSEMBLY);<br>
><br>
> PetscViewer viewer;<br>
> PetscViewerBinaryOpen(PETSC_<wbr>COMM_WORLD, "test.mat", FILE_MODE_WRITE, &viewer);<br>
> MatView(matrix, viewer);<br>
> PetscViewerDestroy(&viewer);<br>
> MatDestroy(&matrix);<br>
><br>
> PetscFinalize();<br>
> }<br>
><br>
><br>
> The complete output is:<br>
><br>
><br>
> lindnefn@neon /data/scratch/lindnefn/aste (git)-[master] % mpic++ petsc.cpp -lpetsc && mpirun -n 2 ./a.out<br>
><br>
> [0]PETSC ERROR: --------------------- Error Message ------------------------------<wbr>------------------------------<wbr>--<br>
> [0]PETSC ERROR: No support for this operation for this object type<br>
> [0]PETSC ERROR: Cannot get subcomm viewer for binary files or sockets unless SubViewer contains the rank 0 process<br>
> [0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html" rel="noreferrer" target="_blank">http://www.mcs.anl.gov/petsc/<wbr>documentation/faq.html</a><br>
> <<a href="http://www.mcs.anl.gov/petsc/documentation/faq.html" rel="noreferrer" target="_blank">http://www.mcs.anl.gov/petsc/<wbr>documentation/faq.html</a>> for trouble shooting.<br>
> [0]PETSC ERROR: Petsc Release Version 3.7.3, unknown<br>
> [0]PETSC ERROR: ./a.out on a arch-linux2-c-debug named neon by lindnefn Thu Sep 22 16:10:34 2016<br>
> [0]PETSC ERROR: Configure options --with-debugging=1 --download-petsc4py=yes --download-mpi4py=yes<br>
> --download-superlu_dist --download-parmetis --download-metis<br>
> [0]PETSC ERROR: #1 PetscViewerGetSubViewer_<wbr>Binary() line 46 in<br>
> /data/scratch/lindnefn/<wbr>software/petsc/src/sys/<wbr>classes/viewer/impls/binary/<wbr>binv.c<br>
> [0]PETSC ERROR: #2 PetscViewerGetSubViewer() line 43 in<br>
> /data/scratch/lindnefn/<wbr>software/petsc/src/sys/<wbr>classes/viewer/interface/dupl.<wbr>c<br>
> [0]PETSC ERROR: #3 MatView_MPISBAIJ_<wbr>ASCIIorDraworSocket() line 900 in<br>
> /data/scratch/lindnefn/<wbr>software/petsc/src/mat/impls/<wbr>sbaij/mpi/mpisbaij.c<br>
> [0]PETSC ERROR: #4 MatView_MPISBAIJ() line 926 in<br>
> /data/scratch/lindnefn/<wbr>software/petsc/src/mat/impls/<wbr>sbaij/mpi/mpisbaij.c<br>
> [0]PETSC ERROR: #5 MatView() line 901 in /data/scratch/lindnefn/<wbr>software/petsc/src/mat/<wbr>interface/matrix.c<br>
> WARNING! There are options you set that were not used!<br>
> WARNING! could be spelling mistake, etc!<br>
> Option left: name:-ksp_converged_reason (no value)<br>
> Option left: name:-ksp_final_residual (no value)<br>
> Option left: name:-ksp_view (no value)<br>
> [neon:113111] *** Process received signal ***<br>
> [neon:113111] Signal: Aborted (6)<br>
> [neon:113111] Signal code: (-6)<br>
> [neon:113111] [ 0] /lib/x86_64-linux-gnu/libc.so.<wbr>6(+0x36cb0) [0x7feed8958cb0]<br>
> [neon:113111] [ 1] /lib/x86_64-linux-gnu/libc.so.<wbr>6(gsignal+0x37) [0x7feed8958c37]<br>
> [neon:113111] [ 2] /lib/x86_64-linux-gnu/libc.so.<wbr>6(abort+0x148) [0x7feed895c028]<br>
> [neon:113111] [ 3]<br>
> /data/scratch/lindnefn/<wbr>software/petsc/arch-linux2-c-<wbr>debug/lib/libpetsc.so.3.7(<wbr>PetscTraceBackErrorHandler+<wbr>0x563)<br>
> [0x7feed8d8db31]<br>
> [neon:113111] [ 4] /data/scratch/lindnefn/<wbr>software/petsc/arch-linux2-c-<wbr>debug/lib/libpetsc.so.3.7(<wbr>PetscError+0x374)<br>
> [0x7feed8d88750]<br>
> [neon:113111] [ 5] /data/scratch/lindnefn/<wbr>software/petsc/arch-linux2-c-<wbr>debug/lib/libpetsc.so.3.7(+<wbr>0x19b2f6)<br>
> [0x7feed8e822f6]<br>
> [neon:113111] [ 6]<br>
> /data/scratch/lindnefn/<wbr>software/petsc/arch-linux2-c-<wbr>debug/lib/libpetsc.so.3.7(<wbr>PetscViewerGetSubViewer+0x4f1)<br>
> [0x7feed8e803cb]<br>
> [neon:113111] [ 7] /data/scratch/lindnefn/<wbr>software/petsc/arch-linux2-c-<wbr>debug/lib/libpetsc.so.3.7(+<wbr>0x860c95)<br>
> [0x7feed9547c95]<br>
> [neon:113111] [ 8] /data/scratch/lindnefn/<wbr>software/petsc/arch-linux2-c-<wbr>debug/lib/libpetsc.so.3.7(+<wbr>0x861494)<br>
> [0x7feed9548494]<br>
> [neon:113111] [ 9] /data/scratch/lindnefn/<wbr>software/petsc/arch-linux2-c-<wbr>debug/lib/libpetsc.so.3.7(<wbr>MatView+0x12b6)<br>
> [0x7feed971c08f]<br>
> [neon:113111] [10] ./a.out() [0x400b8b]<br>
> [neon:113111] [11] /lib/x86_64-linux-gnu/libc.so.<wbr>6(__libc_start_main+0xf5) [0x7feed8943f45]<br>
> [neon:113111] [12] ./a.out() [0x4009e9]<br>
> [neon:113111] *** End of error message ***<br>
> ------------------------------<wbr>------------------------------<wbr>--------------<br>
> mpirun noticed that process rank 1 with PID 113111 on node neon exited on signal 6 (Aborted).<br>
> ------------------------------<wbr>------------------------------<wbr>--------------<br>
><br>
> Thanks,<br>
> Florian<br>
><br>
><br>
><br>
> Am 22.09.2016 um 13:32 schrieb Matthew Knepley:<br>
> > On Thu, Sep 22, 2016 at 5:42 AM, Florian Lindner <<a href="mailto:mailinglists@xgm.de">mailinglists@xgm.de</a> <mailto:<a href="mailto:mailinglists@xgm.de">mailinglists@xgm.de</a>><br>
</div></div><div class="HOEnZb"><div class="h5">> <mailto:<a href="mailto:mailinglists@xgm.de">mailinglists@xgm.de</a> <mailto:<a href="mailto:mailinglists@xgm.de">mailinglists@xgm.de</a>>>> wrote:<br>
> ><br>
> > 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_<wbr>Binary() line 46 in<br>
> > /data/scratch/lindnefn/<wbr>software/petsc/src/sys/<wbr>classes/viewer/impls/binary/<wbr>binv.c<br>
> ><br>
> ><br>
> > Do not truncate the stack.<br>
> ><br>
> > Run under valgrind.<br>
> ><br>
> > Thanks,<br>
> ><br>
> > Matt<br>
> ><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_<wbr>COMM_WORLD, filename.c_str(), FILE_MODE_WRITE, &viewer); CHKERRV(ierr);<br>
> > MatView(matrix, viewer); CHKERRV(ierr);<br>
> > PetscViewerDestroy(&viewer);<br>
> ><br>
> > Thanks,<br>
> > Florian<br>
> ><br>
> ><br>
> ><br>
> ><br>
> > --<br>
> > What most experimenters take for granted before they begin their experiments is infinitely more interesting than any<br>
> > results to which their experiments lead.<br>
> > -- Norbert Wiener<br>
><br>
><br>
</div></div></blockquote></div><br></div></div>