:orphan:
# PCGASMGetSubKSP
Gets the local `KSP` contexts for all subdomains on this MPI rank.
## Synopsis
```
#include "petscpc.h"
PetscErrorCode PCGASMGetSubKSP(PC pc, PetscInt *n_local, PetscInt *first_local, KSP *ksp[])
```
Collective iff first_local is requested
## Input Parameter
- ***pc -*** the preconditioner context
## Output Parameters
- ***n_local -*** the number of blocks on this MPI rank or `NULL`
- ***first_local -*** the global number of the first block on this rank or `NULL`,
all ranks must request or all must pass `NULL`
- ***ksp -*** the array of `KSP` contexts
## Note
After `PCGASMGetSubKSP()` the array of `KSP`es is not to be freed
Currently for some matrix implementations only 1 block per MPI process
is supported.
You must call `KSPSetUp()` before calling `PCGASMGetSubKSP()`.
## See Also
`PCGASM`, `PCGASMSetSubdomains()`, `PCGASMSetOverlap()`,
`PCGASMCreateSubdomains2D()`,
## Level
advanced
## Location
src/ksp/pc/impls/gasm/gasm.c
## Examples
src/ksp/ksp/tutorials/ex62.c
## Implementations
PCGASMGetSubKSP_GASM in src/ksp/pc/impls/gasm/gasm.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/pc/impls/gasm/gasm.c)
[Index of all PC routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)