What I do is<div><br></div><div>MatCreate(comm,&A);</div><div>MatSetSizes(A,...);</div><div>MatSetBlockSize(A,bs);</div><div>MatSetOptionsPrefix(A,"yourchoice_");</div><div>MatSetFromOptions(A);</div><div>MatXAIJSetPreallocation(A,...);</div>
<div><br></div><div>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}.</div><div><br></div><div>
<br></div><div>Devs, is there a reason that block size wasn't added to the convenience constructor? Wasn't there a discussion about adding it?</div><div><br><div class="gmail_quote">On Wed, Jun 13, 2012 at 7:55 PM, Geoffrey Irving <span dir="ltr"><<a href="mailto:irving@naml.us" target="_blank">irving@naml.us</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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>
</blockquote></div><br></div>