Skip to main content
`Ctrl`+`K`

# VecCUDAPlaceArray

Allows one to replace the GPU array in a vector with a GPU array provided by the user.

## Synopsis

    #include <petscvec.h>
    PetscErrorCode VecCUDAPlaceArray(Vec vin, const PetscScalar array[])

Logically Collective; Asynchronous; No Fortran Support

## Input Parameters

- vec - the vector

- array - the GPU array

## Notes

Adding `const` to `array` was an oversight, see notes in `VecPlaceArray()`.

This routine is useful to avoid copying an array into a vector, though 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

Vectors and Parallel Data, `VecPlaceArray()`, `VecGetArray()`, `VecRestoreArray()`, `VecReplaceArray()`, `VecResetArray()`, `VecCUDAResetArray()`, `VecCUDAReplaceArray()`

## Level

advanced

## Location

src/vec/vec/impls/seq/cupm/cuda/vecseqcupm.cu

Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages