[petsc-users] PCSHELL does not support getting factor matrix
Jose E. Roman
jroman at dsic.upv.es
Fri Nov 19 07:11:37 CST 2021
Yes, spectrum slicing needs computing the inertia, and also it uses the KSPSolve interface. Furthermore, the current implementation is single vector only, no blocks.
The only part of SLEPc that uses PCApply directly are Davidson solvers. I could try to adapt them to use PCMatApply(). Thanks for the suggestion.
Jose
> El 19 nov 2021, a las 13:46, Stefano Zampini <stefano.zampini at gmail.com> escribió:
>
> Oh, I see the stack trace now. This requires to compute the inertia?
>
>> On Nov 19, 2021, at 3:45 PM, Stefano Zampini <stefano.zampini at gmail.com> wrote:
>>
>> Jose
>>
>> Now that we have the PCMatApply interface, you could switch to use that inside SLEPc. I guess you are using MatSolve, right?
>> If not, the alternative is to have a PCFactorGetMatrix with creates on the fly an object that behaves like it. The problem is that we do not have a matching restore, and the new object created will be leaked.
>> What do you think?
>>
>>
>>> On Nov 19, 2021, at 12:41 PM, Jose E. Roman <jroman at dsic.upv.es> wrote:
>>>
>>> It is trying to call PCFactorGetMatrix() on your PC, but this operation is not supported by PCSHELL and it is not possible to set it via PetscObjectComposeFunction(). PCSHELL uses the PCShellSet* interface, that is restricted to a limited number of operations.
>>>
>>> Jose
>>>
>>>
>>>> El 19 nov 2021, a las 6:30, Sam Guo <sam.guo at cd-adapco.com> escribió:
>>>>
>>>> Dear PETSc dev team,
>>>> I am implementing SLEPc interval option using shell matrix as follows:
>>>>
>>>> EPSGetST(eps, &st);
>>>> STSetType(st, STSINVERT);
>>>> STGetKSP(st, &ksp);
>>>> KSPSetOperators(ksp, A, A);
>>>> KSPSetType(ksp, KSPPREONLY);
>>>> KSPGetPC(ksp, &pc);
>>>> KSPGetPC(ksp, &pc)
>>>> MatSetOption(A, MAT_SPD, PETSC_TRUE);
>>>> PCSetType(pc, PCSHELL);
>>>> PCShellSetContext(pc, &appCtx);
>>>> PCShellSetApply(pc, applyPreconditioner);
>>>> PetscObjectComposeFunction((PetscObject)pc,"PCFactorGetZeroPivot_C",PCFactorGetZeroPivot_C);
>>>>
>>>> When I run it, I get the following error. Any idea what I did wrong? Thanks a lot for your help.
>>>>
>>>> [0]PETSC ERROR: No support for this operation for this object type
>>>> [0]PETSC ERROR: PC type does not support getting factor matrix
>>>> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
>>>> [0]PETSC ERROR: Petsc Release Version 3.11.3, Jun, 26, 2019
>>>> [0]PETSC ERROR: Unknown Name on a arch-starccmplus_serial_real named pl2usbvu0037pc.net.plm.eds.com by cd4hhv Thu Nov 18 21:11:45 2021
>>>> Number of iterations of the method: 0
>>>> [0]PETSC ERROR: Configure options --with-x=0 --with-fc=0 --with-debugging=1 --with-blaslapack-dir=/u/cd4hhv/dev2/mkl/2017.2-cda-001/linux/lib/intel64/../.. --with-mpi=0 -CFLAGS=-g -CXXFLAGS=-g --with-clean=1 --force --with-scalar-type=real
>>>> [0]PETSC ERROR: #1 PCFactorGetMatrix() line 1332 in ../../../petsc/src/ksp/pc/interface/precon.c
>>>> [0]PETSC ERROR: #2 EPSSliceGetInertia() line 340 in ../../../slepc/src/eps/impls/krylov/krylovschur/ks-slice.c
>>>> [0]PETSC ERROR: #3 EPSSetUp_KrylovSchur_Slice() line 467 in ../../../slepc/src/eps/impls/krylov/krylovschur/ks-slice.c
>>>> [0]PETSC ERROR: #4 EPSSetUp_KrylovSchur() line 146 in ../../../slepc/src/eps/impls/krylov/krylovschur/krylovschur.c
>>>> [0]PETSC ERROR: #5 EPSSetUp() line 173 in ../../../slepc/src/eps/interface/epssetup.c
>>>> Solution method: krylovschur
>>>> [0]PETSC ERROR: #6 EPSSliceGetEPS() line 306 in ../../../slepc/src/eps/impls/krylov/krylovschur/ks-slice.c
>>>> [0]PETSC ERROR: #7 EPSSetUp_KrylovSchur_Slice() line 416 in ../../../slepc/src/eps/impls/krylov/krylovschur/ks-slice.c
>>>> [0]PETSC ERROR: #8 EPSSetUp_KrylovSchur() line 146 in ../../../slepc/src/eps/impls/krylov/krylovschur/krylovschur.c
>>>> [0]PETSC ERROR: #9 EPSSetUp() line 173 in ../../../slepc/src/eps/interface/epssetup.c
>>>
>>
>
More information about the petsc-users
mailing list