:orphan:
# VecCUDAGetArray
Provides access to the device buffer inside a vector 
## Synopsis
```
#include <petscvec.h> 
PetscErrorCode VecCUDAGetArray(Vec v, PetscScalar **a)
```
Not Collective; Asynchronous; No Fortran Support


## Input Parameter

- ***v -*** the vector



## Output Parameter

- ***a -*** the device buffer





## Notes
This routine has semantics similar to `VecGetArray()`; the returned buffer points to a
consistent view of the vector data. This may involve copying data from the host to the device
if the data on the device is out of date. It is also assumed that the returned buffer is
immediately modified, marking the host data out of date. This is similar to intent(inout) in
Fortran.

If the user does require strong memory guarantees, they are encouraged to use
`VecCUDAGetArrayRead()` and/or `VecCUDAGetArrayWrite()` instead.

The user must call `VecCUDARestoreArray()` when they are finished using the array.


## Developer Note
If the device memory hasn't been allocated previously it will be allocated as part of this
routine.


## See Also
 [](ch_vectors), `VecCUDARestoreArray()`, `VecCUDAGetArrayRead()`, `VecCUDAGetArrayWrite()`, `VecGetArray()`,
`VecGetArrayRead()`, `VecGetArrayWrite()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/impls/seq/cupm/cuda/vecseqcupm.cu.html#VecCUDAGetArray">src/vec/vec/impls/seq/cupm/cuda/vecseqcupm.cu</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/vec/impls/seq/cupm/cuda/vecseqcupm.cu)


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