[petsc-users] MatColoring for non square matrices
Barry Smith
bsmith at mcs.anl.gov
Fri Jan 27 13:21:10 CST 2017
Definitely not suppose to work. We never thought about supporting nonsquare matrices.
I do not know if this is just due to bugs in the code like using assuming the number of rows is the same the number of columns or deeper issues like the algorithms requiring the matrices being square. You need to look directly at the implementations to see if they can be "fixed" for nonsquare matrices.
Barry
> On Jan 27, 2017, at 10:48 AM, Tim Steinhoff <kandanovian at gmail.com> wrote:
>
> Hi,
>
> are the MatColoring routines supposed to work with non square
> matrices? It depends on the matrix and the coloring algorithms, that
> sometimes seem to give a valid coloring, sometimes gives totally wrong
> results and sometimes crashes.
> Here is a small fortran sample code snipped, that crashes:
>
> Mat :: c
> MatColoring :: color
> ISColoring :: isColor
> call MatCreate(PETSC_COMM_WORLD, c, ierr)
> call MatSetSizes(c,PETSC_DECIDE,PETSC_DECIDE,3,5,ierr)
> call MatSetFromOptions(c,ierr)
> call MatSetUp(c, ierr)
> if (myrank .eq. 0) then
> call MatSetValue(c, 0, 0, 1d0, INSERT_VALUES, ierr)
> call MatSetValue(c, 0, 1, 0d0, INSERT_VALUES, ierr)
> call MatSetValue(c, 0, 2, 2d0, INSERT_VALUES, ierr)
> call MatSetValue(c, 0, 4, 0d0, INSERT_VALUES, ierr)
> call MatSetValue(c, 1, 0, 0d0, INSERT_VALUES, ierr)
> call MatSetValue(c, 1, 1, 0d0, INSERT_VALUES, ierr)
> call MatSetValue(c, 1, 2, 0d0, INSERT_VALUES, ierr)
> call MatSetValue(c, 1, 3, 0d0, INSERT_VALUES, ierr)
> call MatSetValue(c, 2, 0, 3d0, INSERT_VALUES, ierr)
> call MatSetValue(c, 2, 2, 4d0, INSERT_VALUES, ierr)
> call MatSetValue(c, 2, 3, 1d0, INSERT_VALUES, ierr)
> end if
> call MatAssemblyBegin(c,MAT_FINAL_ASSEMBLY,ierr)
> call MatAssemblyEnd(c,MAT_FINAL_ASSEMBLY,ierr)
>
> call MatColoringCreate(c, color, ierr)
> call MatColoringSetType(color, MATCOLORINGGREEDY, ierr)
> call MatColoringSetFromOptions(color, ierr)
> call MatColoringApply(color, isColor, ierr)
>
>
>
> [1]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation,
> probably memory access out of range
> #9 0x00007fb1b242b407 in GreedyColoringLocalDistanceTwo_Private
> (mc=0x97da50, wts=0x97f640, lperm=0x982980, colors=0x982fe0) at
> /fsgarwinhpc/133/petsc/sources/petsc-3.7.5/src/mat/color/impls/greedy/greedy.c:349
> #10 0x00007fb1b242ebdc in MatColoringApply_Greedy (mc=0x97da50,
> iscoloring=0x7ffcedf22698) at
> /fsgarwinhpc/133/petsc/sources/petsc-3.7.5/src/mat/color/impls/greedy/greedy.c:580
> #11 0x00007fb1b240e3de in MatColoringApply (mc=0x97da50,
> coloring=0x7ffcedf22698) at
> /fsgarwinhpc/133/petsc/sources/petsc-3.7.5/src/mat/color/interface/matcoloring.c:382
> #12 0x00007fb1b2410f37 in matcoloringapply_ (mc=0x7ffcedf22690,
> coloring=0x7ffcedf22698, __ierr=0x6475e8 <nut_petsc_intern_mp_ierr_>)
> at /fsgarwinhpc/133/petsc/sources/petsc-3.7.5/src/mat/color/interface/ftn-auto/matcoloringf.c:115
>
>
>
> Thanks and kind regards,
>
> Volker
More information about the petsc-users
mailing list