<p>Okay, I thought switching to MatCreateAIJ was a good time to add it, bit it's kind of too late now.</p>
<div class="gmail_quote">On Jun 13, 2012 10:06 PM, "Barry Smith" <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On Jun 13, 2012, at 8:03 PM, Jed Brown wrote:<br>
<br>
> What I do is<br>
><br>
> MatCreate(comm,&A);<br>
> MatSetSizes(A,...);<br>
> MatSetBlockSize(A,bs);<br>
> MatSetOptionsPrefix(A,"yourchoice_");<br>
> MatSetFromOptions(A);<br>
> MatXAIJSetPreallocation(A,...);<br>
><br>
> This should work with any matrix type, parallel and sequential, and you can specify it without interfering with any other matrices using -yourchoice_mat_type aij {baij, sbaij}.<br>
><br>
><br>
> Devs, is there a reason that block size wasn't added to the convenience constructor?<br>
<br>
To break less stuff and not make most people change their MatCreateMPIAIJ call()<br>
<br>
> Wasn't there a discussion about adding it?<br>
<br>
Yes<br>
<br>
| What should we do?<br>
<br>
Get rid of convenience constructors?<br>
<br>
Barry<br>
<br>
<br>
><br>
> On Wed, Jun 13, 2012 at 7:55 PM, Geoffrey Irving <<a href="mailto:irving@naml.us">irving@naml.us</a>> wrote:<br>
> Hello,<br>
><br>
> The following code used to work, but breaks after upgrading to 3.3:<br>
><br>
> ....<br>
> CHECK(MatCreateSeqAIJ(comm,3*n,3*n,0,scalar_view(nnz).data(),&mat));<br>
> CHECK(MatSetBlockSize(mat,3));<br>
> ...<br>
><br>
> The error follows. Presumably MatSetBlockSize got more strict, and I<br>
> need to break the single MatCreateSeqAIJ into multiple lines (matrix<br>
> creation followed by preallocation) in order to insert MatSetBlockSize<br>
> in the middle. What are the correct functions to call?<br>
><br>
> Thanks,<br>
> Geoffrey<br>
><br>
> [0]PETSC ERROR: --------------------- Error Message<br>
> ------------------------------------<br>
> [0]PETSC ERROR: Arguments are incompatible!<br>
> [0]PETSC ERROR: Cannot change block size 1 to 3!<br>
> [0]PETSC ERROR:<br>
> ------------------------------------------------------------------------<br>
> [0]PETSC ERROR: Petsc Release Version 3.3.0, Patch 0, Tue Jun 5<br>
> 14:20:42 CDT 2012<br>
> [0]PETSC ERROR: See docs/changes/index.html for recent updates.<br>
> [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.<br>
> [0]PETSC ERROR: See docs/index.html for manual pages.<br>
> [0]PETSC ERROR:<br>
> ------------------------------------------------------------------------<br>
> [0]PETSC ERROR: Unknown Name on a darwin named tile.local by irving<br>
> Wed Jun 13 17:51:34 2012<br>
> [0]PETSC ERROR: Libraries linked from<br>
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_math_petsc/petsc/work/destroot/opt/local/lib/petsc/lib<br>
> [0]PETSC ERROR: Configure run at Wed Jun 13 12:11:05 2012<br>
> [0]PETSC ERROR: Configure options --prefix=/opt/local --with-python<br>
> --with-debugging=0 --with-c-support=1 --with-c++-support=1<br>
> --with-pic=fPIC --with-shared-libraries=0 --with-mpi=1<br>
> --PETSC_ARCH=darwin<br>
> --prefix=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_math_petsc/petsc/work/destroot/opt/local/lib/petsc<br>
> --with-cc=/opt/local/bin/openmpicc<br>
> --with-cxx=/opt/local/bin/openmpicxx<br>
> --with-mpiexec=/opt/local/bin/openmpiexec<br>
> --with-lapack-lib=/usr/lib/liblapack.dylib<br>
> --with-blas-lib=/usr/lib/libblas.dylib --download-umfpack=1<br>
> --download-ml --download-metis --download-parmetis --download-blacs<br>
> --download-scalapack --download-mumps --download-ptscotch<br>
> --with-fc=/opt/local/bin/openmpif90 --LIBS=-lstdc++<br>
> [0]PETSC ERROR:<br>
> ------------------------------------------------------------------------<br>
> [0]PETSC ERROR: PetscLayoutSetBlockSize() line 460 in<br>
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_math_petsc/petsc/work/petsc-3.3-p0/src/vec/vec/impls/mpi/pmap.c<br>
> [0]PETSC ERROR: MatSetBlockSize() line 6691 in<br>
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_math_petsc/petsc/work/petsc-3.3-p0/src/mat/interface/matrix.c<br>
> [0]PETSC ERROR: --------------------- Error Message<br>
> ------------------------------------<br>
> [0]PETSC ERROR: Arguments are incompatible!<br>
> [0]PETSC ERROR: !<br>
> [0]PETSC ERROR:<br>
> ------------------------------------------------------------------------<br>
> [0]PETSC ERROR: Petsc Release Version 3.3.0, Patch 0, Tue Jun 5<br>
> 14:20:42 CDT 2012<br>
> [0]PETSC ERROR: See docs/changes/index.html for recent updates.<br>
> [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.<br>
> [0]PETSC ERROR: See docs/index.html for manual pages.<br>
> [0]PETSC ERROR:<br>
> ------------------------------------------------------------------------<br>
> [0]PETSC ERROR: Unknown Name on a darwin named tile.local by irving<br>
> Wed Jun 13 17:51:34 2012<br>
> [0]PETSC ERROR: Libraries linked from<br>
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_math_petsc/petsc/work/destroot/opt/local/lib/petsc/lib<br>
> [0]PETSC ERROR: Configure run at Wed Jun 13 12:11:05 2012<br>
> [0]PETSC ERROR: Configure options --prefix=/opt/local --with-python<br>
> --with-debugging=0 --with-c-support=1 --with-c++-support=1<br>
> --with-pic=fPIC --with-shared-libraries=0 --with-mpi=1<br>
> --PETSC_ARCH=darwin<br>
> --prefix=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_math_petsc/petsc/work/destroot/opt/local/lib/petsc<br>
> --with-cc=/opt/local/bin/openmpicc<br>
> --with-cxx=/opt/local/bin/openmpicxx<br>
> --with-mpiexec=/opt/local/bin/openmpiexec<br>
> --with-lapack-lib=/usr/lib/liblapack.dylib<br>
> --with-blas-lib=/usr/lib/libblas.dylib --download-umfpack=1<br>
> --download-ml --download-metis --download-parmetis --download-blacs<br>
> --download-scalapack --download-mumps --download-ptscotch<br>
> --with-fc=/opt/local/bin/openmpif90 --LIBS=-lstdc++<br>
> [0]PETSC ERROR:<br>
> ------------------------------------------------------------------------<br>
> [0]PETSC ERROR: PetscSolidMat() line 114 in petsc/ksp.cpp<br>
><br>
<br>
</blockquote></div>