[petsc-dev] About -pc_factor_levels

Pierre Jolivet pierre.jolivet at enseeiht.fr
Fri Mar 10 16:42:02 CST 2017


Hello,
I don’t know if this is intended, but here is a small example that exhibits an odd behavior.

diff --git a/src/ksp/ksp/examples/tutorials/ex3.c b/src/ksp/ksp/examples/tutorials/ex3.c
index b6e41f2..f1f8860 100644
--- a/src/ksp/ksp/examples/tutorials/ex3.c
+++ b/src/ksp/ksp/examples/tutorials/ex3.c
@@ -139,6 +139,11 @@ int main(int argc,char **args)
   ierr = KSPSetOperators(ksp,A,A);CHKERRQ(ierr);
   ierr = KSPSetInitialGuessNonzero(ksp,PETSC_TRUE);CHKERRQ(ierr);
   ierr = KSPSetFromOptions(ksp);CHKERRQ(ierr);
+  ierr = KSPSetUp(ksp);CHKERRQ(ierr);
+  char right_options[] = "-pc_factor_levels 26";
+  PetscOptionsInsertString(NULL,right_options);
+  ierr = KSPSetFromOptions(ksp);CHKERRQ(ierr);
+  ierr = KSPSetUp(ksp);CHKERRQ(ierr);

$ mpirun -np 1 ./ex3 -ksp_view -pc_type ilu -m 40
[..]
    26 levels of fill
[..]
          total: nonzeros=13849, allocated nonzeros=13849
[..]
Norm of error 6.69508e-06 Iterations 16

$ mpirun -np 1 ./ex3 -ksp_view -pc_type ilu -m 40 -pc_factor_levels 26
[..]
          total: nonzeros=115288, allocated nonzeros=115288
[..]
Norm of error 7.3575e-07 Iterations 2

Is this the expected behavior? I don’t mind setting the option -pc_factor_levels before any call to KSPSetUp, but it seems weird that the number of levels of fill is being changed for the output during -ksp_view.

Thanks,
Pierre





More information about the petsc-dev mailing list