By specifing the command-line option -ksp_type and -pc_type, one can change the 
algorithm and preconditioner in M3DP. The SLESSetFromOptions() function can 
automatically take these options from the command-line and override anything 
gave in the code. In order to view the detail, one -sles_view command-line 
option offers the opportunity to see the detail.

SLES options

  -sles_diagonal_scale: Diagonal scale matrix before building preconditioner (SLESSetDiagonalScale)
  -sles_diagonal_scale_fix: Fix diagonaled scaled matrix after solve (SLESSetDiagonalScaleFix)

-ksp_type

cg richardson chebychev gmres tcqmr bcgs cgs tfqmr 
cr lsqr preonly qcg bicg fgmres minres symmlq

-ksp_max_it <10000>: Maximum number of iterations (KSPSetTolerances)
-ksp_rtol <1e-07>: Relative decrease in residual norm (KSPSetTolerances)
-ksp_atol <1e-50>: Absolute value of residual norm (KSPSetTolerances)
-ksp_divtol <10000>: Residual norm increase cause divergence (KSPSetTolerances)
-ksp_norm_type  (one of) none preconditioned unpreconditioned natural
-ksp_cancelmonitors: Remove any hardwired monitor routines (KSPClearMonitor)
-ksp_monitor: Monitor preconditioned residual norm (KSPSetMonitor)
-ksp_vecmonitor: Monitor solution graphically (KSPSetMonitor)
-ksp_truemonitor: Monitor true (unpreconditioned) residual norm (KSPSetMonitor)
-ksp_singmonitor: Monitor singular values (KSPSetMonitor)
-ksp_smonitor: Monitor preconditioned residual norm with fewer digitis (KSPSetMonitor)
-ksp_xmonitor: Monitor graphically preconditioned residual norm (KSPSetMonitor)
-ksp_xtruemonitor: Monitor graphically true residual norm (KSPSetMonitor)

  Pick at most one of -------------
-ksp_left_pc: Use left preconditioning (KSPSetPreconditionerSide)
-ksp_right_pc: Use right preconditioning (KSPSetPreconditionerSide)
-ksp_symmetric_pc: Use symmetric (factorized) preconditioning (KSPSetPreconditionerSide)
-ksp_compute_singularvalues: Compute singular values of preconditioned operator (KSPSetComputeSingularValues)
-ksp_compute_eigenvalues: Compute eigenvalues of preconditioned operator (KSPSetComputeSingularValues)
-ksp_plot_eigenvalues: Scatter plot extreme eigenvalues (KSPSetComputeSingularValues)

-pc_type

none jacobi pbjacobi bjacobi sor lu shell mg eisenstat ilu icc cholesky 
asm sles composite redundant nn milu jacobic multilevel schur

KSP GMRES Options

-ksp_gmres_restart <30>: Number of Krylov search directions (KSPGMRESSetRestart)
-ksp_gmres_haptol <1e-30>: Tolerance for exact convergence (happy ending) (KSPGMRESSetHapTol)
-ksp_gmres_preallocate: Preallocate Krylov vectors (KSPGMRESSetPreAllocateVectors)
  Pick at most one of -------------
-ksp_gmres_unmodifiedgramschmidt: Classical (unmodified) Gram-Schmidt (fast) (KSPGMRESSetOrthogonalization)
-ksp_gmres_modifiedgramschmidt: Modified Gram-Schmidt (slow,more stable) (KSPGMRESSetOrthogonalization)
-ksp_gmres_irorthog: Classical Gram-Schmidt + iterative refinement (KSPGMRESSetOrthogonalization)
-ksp_gmres_krylov_monitor: Plot the Krylov directions (KSPSetMonitor)

KSP flexible GMRES Options

  -ksp_gmres_restart <30>: Number of Krylov search directions (KSPGMRESSetRestart)
  -ksp_gmres_haptol <1e-30>: Tolerance for declaring exact convergence (happy ending) (KSPGMRESSetHapTol)
  -ksp_gmres_preallocate: Preallocate all Krylov vectors (KSPGMRESSetPreAllocateVectors)
  Pick at most one of -------------
    -ksp_gmres_unmodifiedgramschmidt: Use classical (unmodified) Gram-Schmidt (fast) (KSPGMRESSetOrthogonalization)
    -ksp_gmres_modifiedgramschmidt: Use modified Gram-Schmidt (slow but more stable) (KSPGMRESSetOrthogonalization)
    -ksp_gmres_irorthog: Use classical Gram-Schmidt with iterative refinement (KSPGMRESSetOrthogonalization)
  -ksp_gmres_krylov_monitor: Graphically plot the Krylov directions (KSPSetMonitor)
  Pick at most one of -------------
    -ksp_fgmres_modifypcnochange: do not vary the preconditioner (KSPFGMRESSetModifyPC)
    -ksp_fgmres_modifypcsles: vary the SLES based preconditioner (KSPFGMRESSetModifyPC)

PC ILU options

  ILU Options
  -pc_ilu_levels <0>: levels of fill (PCILUSetLevels)
  -pc_ilu_in_place: do factorization in place (PCILUSetUseInPlace)
  -pc_ilu_diagonal_fill: Allow fill into empty diagonal entry (PCILUSetAllowDiagonalFill)
  -pc_iludt_reuse_fill: Reuse fill from previous ILUdt (PCILUDTSetReuseFill)
  -pc_ilu_reuse_ordering: Reuse previous reordering (PCILUSetReuseOrdering)
  -pc_ilu_single_precision_solves:  Precision for triangular solves (PCILUSetSinglePrecisionSolves)
  -pc_ilu_damping <0>: Damping added to diagonal (PCILUSetDamping) 
  -pc_ilu_zeropivot <1e-12>: Pivot is considered zero if less than (PCILUSetSetZeroPivot) 
  -pc_ilu_use_drop_tolerance <-2>:  (PCILUSetUseDropTolerance) 
  -pc_ilu_fill <1>: Expected fill in factorization (PCILUSetFill) 
  -pc_ilu_nonzeros_along_diagonal <0>: Reorder to remove zeros from diagonal (MatReorderForNonzeroDiagonal) 
  -pc_ilu_mat_ordering_type Reorder to reduce nonzeros in ILU:(one of) natural nd 1wd rcm qmd rowlength (see manual page PCILUSetMatOrdering)

PC LU options

  -pc_lu_in_place: Form LU in the same memory as the matrix (PCLUSetUseInPlace)
  -pc_lu_fill <5>: Expected non-zeros in LU/non-zeros in matrix (PCLUSetFill)
  -pc_lu_damping <0>: Damping added to diagonal (PCLUSetDamping)
  -pc_lu_zeropivot <1e-12>: Pivot is considered zero if less than (PCLUSetSetZeroPivot)
  -pc_lu_reuse_fill: Use fill from previous factorization (PCLUSetReuseFill)
  -pc_lu_reuse_ordering: Reuse ordering from previous factorization (PCLUSetReuseOrdering)
  -pc_lu_mat_ordering_type Reordering to reduce nonzeros in LU:(one of) natural nd 1wd rcm qmd rowlength (see manual page PCLUSetMatOrdering)
  -pc_lu_nonzeros_along_diagonal <0>: Reorder to remove zeros from diagonal (MatReorderForNonzeroDiagonal)
  -pc_lu_pivoting <0>: Pivoting tolerance (used only for SuperLU) (PCLUSetPivoting)

PC Sor options

  -pc_sor_omega <1>: relaxation factor (0 < omega < 2) (PCSORSetOmega)
  -pc_sor_its <1>: number of inner SOR iterations (PCSORSetIterations)
  -pc_sor_lits <1>: number of local inner SOR iterations (PCSORSetIterations)

  Pick at most one of -------------
    -pc_sor_symmetric: SSOR, not SOR (PCSORSetSymmetric)
    -pc_sor_backward: use backward sweep instead of forward (PCSORSetSymmetric)
    -pc_sor_local_symmetric: use SSOR seperately on each processor (PCSORSetSymmetric)
    -pc_sor_local_backward: use backward sweep locally (PCSORSetSymmetric)
    -pc_sor_local_forward: use forward sweep locally (PCSORSetSymmetric)

PC Jacobi options

-pc_jacobi_rowmax:  Use row maximums for diagonal (PCJacobiSetUseRowMax)

-log_summary

PetscLogStageRegister(&stages[0],"Original Solve");
PetscLogStageRegister(&stages[1],"Second Solve");
/* -------------- Stage 0: Solve Original System ---------------------- */
PetscLogStagePush(stages[0]);
PetscLogStagePop();
compiled with PETSC_USE_LOG

scaling on seaborg -- problem size via user time

gmres
tfqmr

Krylov Subspace Methods and Preconditoner