:orphan:
# KSPGMRESSetPreAllocateVectors
Causes GMRES and FGMRES to preallocate all its needed work vectors at initial setup rather than the default, which is to allocate them in chunks when needed. 
## Synopsis
```
#include "petscksp.h"  
PetscErrorCode KSPGMRESSetPreAllocateVectors(KSP ksp)
```
Logically Collective


## Input Parameter

- ***ksp   -*** iterative context obtained from KSPCreate



## Options Database Key

- ***-ksp_gmres_preallocate -*** Activates KSPGmresSetPreAllocateVectors()





## See Also
 [](ch_ksp), `KSPGMRESSetRestart()`, `KSPGMRESSetOrthogonalization()`, `KSPGMRESGetOrthogonalization()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/impls/gmres/gmpre.c.html#KSPGMRESSetPreAllocateVectors">src/ksp/ksp/impls/gmres/gmpre.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/impls/gmres/gmres.c.html#KSPGMRESSetPreAllocateVectors_GMRES">KSPGMRESSetPreAllocateVectors_GMRES in src/ksp/ksp/impls/gmres/gmres.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/ksp/impls/gmres/gmpre.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)  
