[petsc-dev] MATSBAIJ MatChop MAT_GETROW_UPPERTRIANGULAR

Jed Brown jed at jedbrown.org
Tue Apr 14 17:22:16 CDT 2020


Jacob Faibussowitsch <jacob.fai at gmail.com> writes:

> Hello All,
>
> When using MATSBAIJ and MatChop you get the following error:
>
> [0]PETSC ERROR: No support for this operation for this object type
> [0]PETSC ERROR: MatGetRow is not supported for SBAIJ matrix format. Getting the upper triangular part of row, run with -mat_getrow_uppertriangular, call MatSetOption(mat,MAT_GETROW_UPPERTRIANGULAR,PETSC_TRUE) or MatGetRowUpperTriangular()
> [0]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
> [0]PETSC ERROR: Petsc Development GIT revision: v3.13-108-ga86b3fd671  GIT Date: 2020-04-10 15:27:46 -0500
> [0]PETSC ERROR: ./tightbinding on a arch-slepc-lammps named Jacobs-MacBook-Pro.local by jacobfaibussowitsch Tue Apr 14 16:57:07 2020
> [0]PETSC ERROR: Configure options --download-slepc --with-blaslapack --with-debugging=yes --with-mpi-dir=/Users/jacobfaibussowitsch/NoSync/petscpackages PETSC_ARCH=arch-slepc-lammps
> [0]PETSC ERROR: #1 MatGetRow_SeqSBAIJ() line 294 in /Users/jacobfaibussowitsch/NoSync/petsc/src/mat/impls/sbaij/seq/sbaij.c
> [0]PETSC ERROR: #2 MatGetRow() line 563 in /Users/jacobfaibussowitsch/NoSync/petsc/src/mat/interface/matrix.c
> [0]PETSC ERROR: #3 MatChop() line 488 in /Users/jacobfaibussowitsch/NoSync/petsc/src/mat/utils/axpy.c
> [0]PETSC ERROR: #4 CreateHamiltonian() line 425 in /Users/jacobfaibussowitsch/NoSync/TB/tightbinding.c
> [0]PETSC ERROR: #5 main() line 458 in /Users/jacobfaibussowitsch/NoSync/TB/tightbinding.c
>
> But if you follow the instructions above, i.e. running with -mat_getrow_uppertriangular true then this works without a hitch. 
>
> Since MATSBAIJ is always symmetric and upper triangular by design, then shouldn’t this MatOption be enabled by default? Or maybe MatChop should check MatType and use the correct MatGetRow impls.

MatChop should handle it, but MatGetRow() needs to get the whole row (or fail, as in this case), otherwise many algorithms will break in confusing ways when someone lobs in -dm_mat_type sbaij.


More information about the petsc-dev mailing list