# VecCUDAReplaceArray
Allows one to replace the GPU array in a vector with a GPU array provided by the user. This is useful to avoid copying a GPU array into a vector. 
## Synopsis
```
#include "petscvec.h"   
PetscErrorCode VecCUDAReplaceArray(Vec vin, const PetscScalar a[])
```
Not Collective


## Input Parameters

- ***vec -*** the vector
- ***array -*** the GPU array



## Notes
This permanently replaces the GPU array and frees the memory associated
with the old GPU array.

The memory passed in CANNOT be freed by the user. It will be freed
when the vector is destroyed.

Not supported from Fortran




## See Also
 `VecGetArray()`, `VecRestoreArray()`, `VecPlaceArray()`, `VecResetArray()`, `VecCUDAResetArray()`, `VecCUDAPlaceArray()`, `VecReplaceArray()`


## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/interface/rvector.c.html#VecCUDAReplaceArray">src/vec/vec/interface/rvector.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/vec/interface/rvector.c)


[Index of all Vec routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
