[petsc-users] Issue updating MUMPS ictnl after failed solve

Hong hzhang at mcs.anl.gov
Tue Sep 20 13:01:52 CDT 2016


David :
This is a bug in PETSc. A change
$ git diff ../../../pc/impls/factor/cholesky/cholesky.c
diff --git a/src/ksp/pc/impls/factor/cholesky/cholesky.c
b/src/ksp/pc/impls/factor/cholesky/cholesky.c
index 953d551..cc28369 100644
--- a/src/ksp/pc/impls/factor/cholesky/cholesky.c
+++ b/src/ksp/pc/impls/factor/cholesky/cholesky.c
@@ -141,9 +141,7 @@ static PetscErrorCode PCSetUp_Cholesky(PC pc)

     ierr =
MatCholeskyFactorNumeric(((PC_Factor*)dir)->fact,pc->pmat,&((PC_Factor*)dir)->info);CHKERRQ(ierr);
     ierr = MatFactorGetError(((PC_Factor*)dir)->fact,&err);CHKERRQ(ierr);
-    if (err) { /* FactorNumeric() fails */
-      pc->failedreason = (PCFailedReason)err;
-    }
+    pc->failedreason = (PCFailedReason)err;
   }

fixed the problem. I'll fix this problem in petsc-release, including other
routines.
Thanks for reporting the bug and sending matrix.dat. Let us know whenever
you encounter problem using PETSc.

Hong


On Mon, Sep 19, 2016 at 11:04 PM, Hong <hzhang at mcs.anl.gov> wrote:
>
>> David :
>> I did following:
>>
>>         PC  pc;
>>         Mat F;
>>         ierr = KSPGetPC(ksp,&pc);CHKERRQ(ierr);
>>         ierr = PCReset(pc);CHKERRQ(ierr);
>>         ierr = KSPSetOperators(ksp,A,A);CHKERRQ(ierr);
>>         ierr = PCSetType(pc,PCCHOLESKY);CHKERRQ(ierr);
>>
>>         ierr = PCFactorSetMatSolverPackage(pc
>> ,MATSOLVERMUMPS);CHKERRQ(ierr);
>>         ierr = PCFactorSetUpMatSolverPackage(pc);CHKERRQ(ierr);
>>         ierr = PCFactorGetMatrix(pc,&F);CHKERRQ(ierr);
>>         ierr = MatMumpsSetIcntl(F,14,30);CHKERRQ(ierr);
>>
>>         ierr = KSPSolve(ksp,b,x);CHKERRQ(ierr);
>>
>> Then it resolves the matrix equation with ICNTL(14)=30.
>> Attached is modified petsc/src/ksp/ksp/examples/tutorials/ex10.c.
>> Using in with your matrix.dat, I get
>>
>> mpiexec -n 4 ./ex10 -f0 matrix.dat -rhs 0 -ksp_reason
>> Number of iterations =   0
>> KSPConvergedReason: -11
>>  Reset PC with ICNTL(14)=30 ...
>> KSPConvergedReason: 2
>>
>
> Hong,
>
> Thanks very much for your test code. I get the same output as you when I
> run "mpiexec -n 4 ./ex10 -f0 matrix.dat -rhs 0 -ksp_reason".
>
> However, I used KSPPREONLY in my original test code, and if I
> add KSPSetType(ksp,KSPPREONLY) in your modified exc10.c after the line
> KSPCreate(PETSC_COMM_WORLD,&ksp) then I get the following output:
>
> mpiexec -np 4 ./mumps_test-opt -f0 matrix.dat -rhs 0 -ksp_reason
> Number of iterations =   0
> KSPConvergedReason: -11
>  Reset PC with ICNTL(14)=30 ...
> KSPConvergedReason: -11
>
> So it seems like the icntl data is not being updated when we use PREONLY.
> Do you know how to fix this?
>
> Thanks,
> David
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160920/b0aed163/attachment.html>


More information about the petsc-users mailing list