[petsc-users] MatSetBlockSize no longer works after MatCreateSeqAIJ

Geoffrey Irving irving at naml.us
Thu Jun 14 13:24:17 CDT 2012


Thanks, that works.  MatSetOptionsPrefix is convenient.

Geoffrey

On Wed, Jun 13, 2012 at 6:03 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> What I do is
>
> MatCreate(comm,&A);
> MatSetSizes(A,...);
> MatSetBlockSize(A,bs);
> MatSetOptionsPrefix(A,"yourchoice_");
> MatSetFromOptions(A);
> MatXAIJSetPreallocation(A,...);
>
> 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}.
>
>
> Devs, is there a reason that block size wasn't added to the convenience
> constructor? Wasn't there a discussion about adding it?
>
> On Wed, Jun 13, 2012 at 7:55 PM, Geoffrey Irving <irving at naml.us> wrote:
>>
>> Hello,
>>
>> The following code used to work, but breaks after upgrading to 3.3:
>>
>>    ....
>>    CHECK(MatCreateSeqAIJ(comm,3*n,3*n,0,scalar_view(nnz).data(),&mat));
>>    CHECK(MatSetBlockSize(mat,3));
>>    ...
>>
>> The error follows.  Presumably MatSetBlockSize got more strict, and I
>> need to break the single MatCreateSeqAIJ into multiple lines (matrix
>> creation followed by preallocation) in order to insert MatSetBlockSize
>> in the middle.  What are the correct functions to call?
>>
>> Thanks,
>> Geoffrey
>>
>> [0]PETSC ERROR: --------------------- Error Message
>> ------------------------------------
>> [0]PETSC ERROR: Arguments are incompatible!
>> [0]PETSC ERROR: Cannot change block size 1 to 3!
>> [0]PETSC ERROR:
>> ------------------------------------------------------------------------
>> [0]PETSC ERROR: Petsc Release Version 3.3.0, Patch 0, Tue Jun  5
>> 14:20:42 CDT 2012
>> [0]PETSC ERROR: See docs/changes/index.html for recent updates.
>> [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
>> [0]PETSC ERROR: See docs/index.html for manual pages.
>> [0]PETSC ERROR:
>> ------------------------------------------------------------------------
>> [0]PETSC ERROR: Unknown Name on a darwin named tile.local by irving
>> Wed Jun 13 17:51:34 2012
>> [0]PETSC ERROR: Libraries linked from
>>
>> /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
>> [0]PETSC ERROR: Configure run at Wed Jun 13 12:11:05 2012
>> [0]PETSC ERROR: Configure options --prefix=/opt/local --with-python
>> --with-debugging=0 --with-c-support=1 --with-c++-support=1
>> --with-pic=fPIC --with-shared-libraries=0 --with-mpi=1
>> --PETSC_ARCH=darwin
>>
>> --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
>> --with-cc=/opt/local/bin/openmpicc
>> --with-cxx=/opt/local/bin/openmpicxx
>> --with-mpiexec=/opt/local/bin/openmpiexec
>> --with-lapack-lib=/usr/lib/liblapack.dylib
>> --with-blas-lib=/usr/lib/libblas.dylib --download-umfpack=1
>> --download-ml --download-metis --download-parmetis --download-blacs
>> --download-scalapack --download-mumps --download-ptscotch
>> --with-fc=/opt/local/bin/openmpif90 --LIBS=-lstdc++
>> [0]PETSC ERROR:
>> ------------------------------------------------------------------------
>> [0]PETSC ERROR: PetscLayoutSetBlockSize() line 460 in
>>
>> /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
>> [0]PETSC ERROR: MatSetBlockSize() line 6691 in
>>
>> /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
>> [0]PETSC ERROR: --------------------- Error Message
>> ------------------------------------
>> [0]PETSC ERROR: Arguments are incompatible!
>> [0]PETSC ERROR:  !
>> [0]PETSC ERROR:
>> ------------------------------------------------------------------------
>> [0]PETSC ERROR: Petsc Release Version 3.3.0, Patch 0, Tue Jun  5
>> 14:20:42 CDT 2012
>> [0]PETSC ERROR: See docs/changes/index.html for recent updates.
>> [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
>> [0]PETSC ERROR: See docs/index.html for manual pages.
>> [0]PETSC ERROR:
>> ------------------------------------------------------------------------
>> [0]PETSC ERROR: Unknown Name on a darwin named tile.local by irving
>> Wed Jun 13 17:51:34 2012
>> [0]PETSC ERROR: Libraries linked from
>>
>> /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
>> [0]PETSC ERROR: Configure run at Wed Jun 13 12:11:05 2012
>> [0]PETSC ERROR: Configure options --prefix=/opt/local --with-python
>> --with-debugging=0 --with-c-support=1 --with-c++-support=1
>> --with-pic=fPIC --with-shared-libraries=0 --with-mpi=1
>> --PETSC_ARCH=darwin
>>
>> --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
>> --with-cc=/opt/local/bin/openmpicc
>> --with-cxx=/opt/local/bin/openmpicxx
>> --with-mpiexec=/opt/local/bin/openmpiexec
>> --with-lapack-lib=/usr/lib/liblapack.dylib
>> --with-blas-lib=/usr/lib/libblas.dylib --download-umfpack=1
>> --download-ml --download-metis --download-parmetis --download-blacs
>> --download-scalapack --download-mumps --download-ptscotch
>> --with-fc=/opt/local/bin/openmpif90 --LIBS=-lstdc++
>> [0]PETSC ERROR:
>> ------------------------------------------------------------------------
>> [0]PETSC ERROR: PetscSolidMat() line 114 in petsc/ksp.cpp
>
>


More information about the petsc-users mailing list