:orphan: # KSPSetOptionsPrefix Sets the prefix used for searching for all `KSP` options in the database. ## Synopsis ``` #include "petscksp.h" PetscErrorCode KSPSetOptionsPrefix(KSP ksp, const char prefix[]) ``` Logically Collective ## Input Parameters - ***ksp -*** the Krylov context - ***prefix -*** the prefix string to prepend to all `KSP` option requests ## Notes A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. For example, to distinguish between the runtime options for two different `KSP` contexts, one could call ```none KSPSetOptionsPrefix(ksp1,"sys1_") KSPSetOptionsPrefix(ksp2,"sys2_") ``` This would enable use of different options for each system, such as ```none -sys1_ksp_type gmres -sys1_ksp_rtol 1.e-3 -sys2_ksp_type bcgs -sys2_ksp_rtol 1.e-4 ``` ## See Also [](ch_ksp), `KSP`, `KSPAppendOptionsPrefix()`, `KSPGetOptionsPrefix()`, `KSPSetFromOptions()` ## Level advanced ## Location src/ksp/ksp/interface/itcl.c ## Examples src/dm/impls/swarm/tutorials/ex1.c
src/dm/impls/swarm/tutorials/ex1f90.F90
src/ksp/ksp/tutorials/ex42.c
src/ksp/ksp/tutorials/ex43.c
src/ksp/ksp/tutorials/ex49.c
src/ksp/ksp/tutorials/ex59.c
src/ksp/ksp/tutorials/ex70.c
src/tao/tutorials/ex3.c
src/ts/utils/dmplexlandau/tutorials/ex1f90.F90
--- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/ksp/interface/itcl.c) [Index of all KSP routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)