# VecCreateSeqCUDAWithArrays
Creates a CUDA sequential array-style vector, where the user provides the array space to store the vector values. 
## Synopsis
```
#include <petscvec.h> 
PetscErrorCode VecCreateSeqCUDAWithArrays(MPI_Comm comm, PetscInt bs, PetscInt n, const PetscScalar cpuarray[], const PetscScalar gpuarray[], Vec *V)
```
Collective


## Input Parameters

- ***comm -*** the communicator, should be PETSC_COMM_SELF
- ***bs -*** the block size
- ***n -*** the vector length
- ***cpuarray -*** CPU memory where the vector elements are to be stored.


- ***gpuarray -*** GPU memory where the vector elements are to be stored.



## Output Parameter

- ***V -*** the vector



## Notes
If both cpuarray and gpuarray are provided, the caller must ensure that
the provided arrays have identical values.

PETSc does NOT free the provided arrays when the vector is destroyed via
VecDestroy(). The user should not free the array until the vector is
destroyed.




## See Also
 `VecCreateMPICUDAWithArrays()`, `VecCreate()`, `VecCreateSeqWithArray()`,
`VecCUDAPlaceArray()`, `VecCreateSeqCUDAWithArray()`,
`VecCUDAAllocateCheckHost()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/impls/seq/seqcuda/veccuda.c.html#VecCreateSeqCUDAWithArrays">src/vec/vec/impls/seq/seqcuda/veccuda.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/vec/impls/seq/seqcuda/veccuda.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)  
