Hi Jose,
Here is the part of the code:
ierr = STSetType(st,STSINVERT);CHKERRQ(ierr);
ierr = STGetKSP(st,&ksp);CHKERRQ(ierr);
ierr = KSPSetType(ksp,KSPPREONLY);CHKERRQ(ierr);
ierr = KSPGetPC(ksp,&pc);CHKERRQ(ierr);
ierr = PCSetType(pc,PCCHOLESKY);CHKERRQ(ierr);
#if defined(PETSC_HAVE_MUMPS)
#if defined(PETSC_USE_COMPLEX)
SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_SUP,"Spectrum slicing with MUMPS is not
available for complex scalars");
#endif
ierr = PetscPrintf(PETSC_COMM_WORLD, "PETSC_HAVE_MUMPS\n");CHKERRQ(ierr);
ierr = EPSKrylovSchurSetDetectZeros(eps,PETSC_TRUE);CHKERRQ(ierr); /*
enforce zero detection */
ierr = PCFactorSetMatSolverPackage(pc,MATSOLVERMUMPS);CHKERRQ(ierr);
/*
Add several MUMPS options (currently there is no better way of setting
this in program):
'-mat_mumps_icntl_13 1': turn off ScaLAPACK for matrix inertia
'-mat_mumps_icntl_24 1': detect null pivots in factorization (for the case
that a shift is equal to an eigenvalue)
'-mat_mumps_cntl_3 <tol>': a tolerance used for null pivot detection (must
be larger than machine epsilon)
Note: depending on the interval, it may be necessary also to increase the
workspace:
'-mat_mumps_icntl_14 <percentage>': increase workspace with a percentage
(50, 100 or more)
*/
ierr = PetscOptionsInsertString(NULL,"-mat_mumps_icntl_13 1
-mat_mumps_icntl_24 1 -mat_mumps_cntl_3 1e-12");CHKERRQ(ierr);
#endif
/*
Set solver parameters at runtime
*/
ierr = EPSSetFromOptions(eps);CHKERRQ(ierr);
I am using MUMPS. Actually it's the example I said before. I didn't modify it
that much.
M Hassan
________________________________
From: Jose E. Roman <[email protected]>
Sent: Sunday, July 24, 2016 1:27:04 PM
To: Hassan Md Mahmudulla
Cc: [email protected]
Subject: Re: [petsc-users] EPSKrylovSchurSetDetectZeros() not working
> El 24 jul 2016, a las 19:50, Hassan Md Mahmudulla <[email protected]>
> escribió:
>
> Hi,
> I am solving a generalized eigenvalue problem using spectrum slicing. I am
> using this example
> (http://slepc.upv.es/documentation/current/src/eps/examples/tutorials/ex25.c.html)
> as it is. Part of the code is:
> ierr =EPSKrylovSchurSetDetectZeros(eps,PETSC_TRUE);CHKERRQ(ierr);
>
> But I am getting the following:
>
> [0]PETSC ERROR: Mismatch between number of values found and information from
> inertia, consider using EPSKrylovSchurSetDetectZeros()
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for
> trouble shooting.
>
> It seems the input PETSC_TRUE is not working for
> EPSKrylovSchurSetDetectZeros(). Any idea?
>
> M Hassan
It seems that you are not using MUMPS. Spectrum slicing can be used with
PETSc's Cholesky, but for guaranteed robustness it is necessary to use MUMPS.
Jose