MatDenseCUDAPlaceArray — PETSc 3.25.2 documentation

Skip to main content
`Ctrl`+`K`

# MatDenseCUDAPlaceArray

Allows one to replace the GPU array in a `MATDENSECUDA` matrix with an array provided by the user. This is useful to avoid copying an array into a matrix.

## Synopsis

    PetscErrorCode MatDenseCUDAPlaceArray(Mat mat, const PetscScalar *array)

Not Collective

## Input Parameters

- mat - the matrix

- array - the array in column major order

## Note

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

You can return to the original array with a call to `MatDenseCUDAResetArray()`. The user is responsible for freeing this array; it will not be freed when the matrix is destroyed. The array must have been allocated with `cudaMalloc()`.

## See Also

`MATDENSECUDA`, `MatDenseCUDAGetArray()`, `MatDenseCUDAResetArray()`, `MatDenseCUDAReplaceArray()`

## Level

developer

## Location

src/mat/impls/dense/mpi/cupm/cuda/matmpidensecuda.cu

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