[petsc-users] syntax for routine in PCMGSetResidual

Timothée Nicolas timothee.nicolas at gmail.com
Sat Nov 14 09:21:13 CST 2015


My bad,

I had carefully set all the levels, but stupidly forgotten to set the
operators on the main KSP... Then the error message makes a lot of sense.

Best

Timothée

2015-11-13 12:00 GMT+09:00 Matthew Knepley <knepley at gmail.com>:

> On Thu, Nov 12, 2015 at 7:56 PM, Timothée Nicolas <
> timothee.nicolas at gmail.com> wrote:
>
>> Mmmh, that's strange because I define my matrices with the command
>>
>> call
>> MatCreateShell(PETSC_COMM_WORLD,lctx(level)%localsize,lctx(level)%localsize,
>> &
>>      &              lctx(level)%ngpdof,lctx(level)%ngpdof,lctx(level),
>>      &              lctx(level)%Mmat,ierr)
>>
>> and at each level I checked that the sizes "localsize" and "ngpdof" are
>> well set.
>>
>
> You should be able to trace back in the debugger to see what is sat as
> pc->mat.
>
>    Matt
>
>
>> Timothee
>>
>> 2015-11-13 10:53 GMT+09:00 Matthew Knepley <knepley at gmail.com>:
>>
>>> On Thu, Nov 12, 2015 at 7:39 PM, Timothée Nicolas <
>>> timothee.nicolas at gmail.com> wrote:
>>>
>>>> Sorry, here is the full error message
>>>>
>>>> [0]PETSC ERROR: Nonconforming object sizes
>>>> [0]PETSC ERROR: Preconditioner number of local rows -1 does not equal
>>>> resulting vector number of rows 71808
>>>> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
>>>> for trouble shooting.
>>>> [0]PETSC ERROR: Petsc Release Version 3.6.0, Jun, 09, 2015
>>>> [0]PETSC ERROR: ./mips_implicit on a arch-linux2-c-opt named helios90
>>>> by tnicolas Fri Nov 13 10:39:14 2015
>>>> [0]PETSC ERROR: Configure options
>>>> --prefix=/csc/softs/anl/petsc-3.6.0/intel-15.0.0.090/bullxmpi-1.2.8.2/real
>>>> --with-debugging=0 --with-x=0 --with-cc=mpicc --with-fc=mpif90
>>>> --with-cxx=mpicxx --with-fortran --known-mpi-shared-libraries=1
>>>> --with-scalar-type=real --with-precision=double --CFLAGS="-g -O3 -mavx
>>>> -mkl" --CXXFLAGS="-g -O3 -mavx -mkl" --FFLAGS="-g -O3 -mavx -mkl"
>>>> [0]PETSC ERROR: #1 PCApply() line 472 in
>>>> /csc/releases/buildlog/anl/petsc-3.6.0/intel-15.0.0.090/bullxmpi-1.2.8.2/real/petsc-3.6.0/src/ksp/pc/interface/precon.c
>>>> [0]PETSC ERROR: #2 KSP_PCApply() line 242 in
>>>> /csc/releases/buildlog/anl/petsc-3.6.0/intel-15.0.0.090/bullxmpi-1.2.8.2/real/petsc-3.6.0/include/petsc/private/kspimpl.h
>>>> [0]PETSC ERROR: #3 KSPInitialResidual() line 63 in
>>>> /csc/releases/buildlog/anl/petsc-3.6.0/intel-15.0.0.090/bullxmpi-1.2.8.2/real/petsc-3.6.0/src/ksp/ksp/interface/itres.c
>>>> [0]PETSC ERROR: #4 KSPSolve_GMRES() line 235 in
>>>> /csc/releases/buildlog/anl/petsc-3.6.0/intel-15.0.0.090/bullxmpi-1.2.8.2/real/petsc-3.6.0/src/ksp/ksp/impls/gmres/gmres.c
>>>> [0]PETSC ERROR: #5 KSPSolve() line 604 in
>>>> /csc/releases/buildlog/anl/petsc-3.6.0/intel-15.0.0.090/bullxmpi-1.2.8.2/real/petsc-3.6.0/src/ksp/ksp/interface/itfunc.c
>>>>
>>>
>>> The PC uses the matrix it gets to determine sizes, and compare to the
>>> input vectors it gets for PCApply(). The
>>> preconditioner matrix is not setup or is not reporting sizes, for
>>> example if its a MATSHELL it does not have any sizes.
>>>
>>>   Matt
>>>
>>>
>>>> 2015-11-13 10:38 GMT+09:00 Matthew Knepley <knepley at gmail.com>:
>>>>
>>>>> On Thu, Nov 12, 2015 at 6:47 PM, Timothée Nicolas <
>>>>> timothee.nicolas at gmail.com> wrote:
>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> In the manual and the documentation, the syntax for the routine to be
>>>>>> given as argument of PCMGSetResidual:
>>>>>>
>>>>>> PCMGSetResidual <http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/PC/PCMGSetResidual.html#PCMGSetResidual>(PC pc,PetscInt <http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Sys/PetscInt.html#PetscInt> l,PetscErrorCode <http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode> (*residual)(Mat <http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Mat/Mat.html#Mat>,Vec <http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Vec/Vec.html#Vec>,Vec <http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Vec/Vec.html#Vec>,Vec <http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Vec/Vec.html#Vec>),Mat <http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Mat/Mat.html#Mat> mat)
>>>>>>
>>>>>>
>>>>>> is not specified. I mean that the order of the vectors is not
>>>>>> specified. I suppose it is something like
>>>>>> residual(Mat,b,x,r) with r = b - Mat*x, but it could as well be any
>>>>>> combination like residual(Mat,r,x,b). There is no example in the
>>>>>> documentation of the usage so I am confused. Does it absolutely need to be
>>>>>> set ? I find the manual a bit confusing on this point. Is it only if
>>>>>> matrix-free matrices are used ?
>>>>>>
>>>>>> In the present situation, I use matrix-free operators in a multigrid
>>>>>> preconditioner (but the interpolation and restriction are not matrix free)
>>>>>> and have not set this residual function yet. I get the following error:
>>>>>>
>>>>>
>>>>> Always always always give the entire error message. We want the stack.
>>>>>
>>>>> The problem here looks like the preconditioner is reporting -1 rows
>>>>> for process 13.
>>>>>
>>>>>   Matt
>>>>>
>>>>>
>>>>>> [13]PETSC ERROR: Preconditioner number of local rows -1 does not
>>>>>> equal resulting vector number of rows 67584
>>>>>>
>>>>>> Could this be related ? By the way, I don't understand what is meant
>>>>>> by the "preconditioner number of local rows". I have separately tested the
>>>>>> operators at each level and they are fine.
>>>>>>
>>>>>> Best
>>>>>>
>>>>>> Timothee
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> What most experimenters take for granted before they begin their
>>>>> experiments is infinitely more interesting than any results to which their
>>>>> experiments lead.
>>>>> -- Norbert Wiener
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> What most experimenters take for granted before they begin their
>>> experiments is infinitely more interesting than any results to which their
>>> experiments lead.
>>> -- Norbert Wiener
>>>
>>
>>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20151115/565d92cc/attachment.html>


More information about the petsc-users mailing list