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


## Input Parameters

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





## Notes
You can return to the original GPU array with a call to `VecCUDAResetArray()`
It is not possible to use `VecCUDAPlaceArray()` and `VecPlaceArray()` at the
same time on the same vector.

`vec` does not take ownership of `array` in any way. The user must free `array` themselves
but be careful not to do so before the vector has either been destroyed, had its original
array restored with `VecCUDAResetArray()` or permanently replaced with
`VecCUDAReplaceArray()`.


## See Also
 [](chapter_vectors), `Vec`, `VecPlaceArray()`, `VecGetArray()`, `VecRestoreArray()`, `VecReplaceArray()`, `VecResetArray()`, `VecCUDAResetArray()`, `VecCUDAReplaceArray()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/interface/rvector.c.html#VecCUDAPlaceArray">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)  
