# MatDenseCUDAGetArrayRead
Provides read-only access to the CUDA buffer inside a `MATDENSECUDA` matrix. The array must be restored with `MatDenseCUDARestoreArrayRead()` when no longer needed. 
## Synopsis
```
#include "petscmat.h"  
PetscErrorCode MatDenseCUDAGetArrayRead(Mat A, const PetscScalar **a)
```
Not Collective


## Input Parameters

- ***A -*** the matrix


Output Parameters

- ***array -*** the GPU array in column major order



## Note
Data can be copied to the GPU due to operations done on the CPU. If you need write only access, use `MatDenseCUDAGetArrayWrite()`.




## See Also
 `MATDENSECUDA`, `MatDenseCUDAGetArray()`, `MatDenseCUDARestoreArray()`, `MatDenseCUDARestoreArrayWrite()`, `MatDenseCUDAGetArrayWrite()`, `MatDenseCUDARestoreArrayRead()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/dense/mpi/mpidense.c.html#MatDenseCUDAGetArrayRead">src/mat/impls/dense/mpi/mpidense.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/dense/mpi/mpidense.c.html#MatDenseCUDAGetArrayRead_MPIDenseCUDA">MatDenseCUDAGetArrayRead_MPIDenseCUDA in src/mat/impls/dense/mpi/mpidense.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/dense/seq/cuda/densecuda.cu.html#MatDenseCUDAGetArrayRead_SeqDenseCUDA">MatDenseCUDAGetArrayRead_SeqDenseCUDA in src/mat/impls/dense/seq/cuda/densecuda.cu</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/impls/dense/mpi/mpidense.c)


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