Provides write access to the CUDA buffer inside a vector.


#include <petscvec.h> 
PetscErrorCode VecCUDAGetArrayWrite(Vec v, PetscScalar **a)

Logically Collective; Asynchronous; No Fortran Support

Input Parameter#

  • v - the vector

Output Parameter#

  • a - the CUDA pointer


The data pointed to by the device pointer is uninitialized. The user may not read from this data. Furthermore, the entire array needs to be filled by the user to obtain well-defined behaviour. The device memory will be allocated by this function if it hasn’t been allocated previously. This is analogous to intent(out) in Fortran.

The device pointer needs to be released with VecCUDARestoreArrayWrite(). When the pointer is released the host data of the vector is marked as out of data. Subsequent access of the host data with e.g. VecGetArray() incurs a device to host data transfer.

See Also#

Vectors and Parallel Data, VecCUDARestoreArrayWrite(), VecCUDAGetArray(), VecCUDAGetArrayRead(), VecCUDAGetArrayWrite(), VecGetArray(), VecGetArrayRead()





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