Provides access to the device buffer inside a vector


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

Logically Collective; Asynchronous; No Fortran Support

Input Parameter#

  • v - the vector

Output Parameter#

  • a - the device buffer


This routine has semantics similar to VecGetArray(); the returned buffer points to a consistent view of the vector data. This may involve copying data from the host to the device if the data on the device is out of date. It is also assumed that the returned buffer is immediately modified, marking the host data out of date. This is similar to intent(inout) in Fortran.

If the user does require strong memory guarantees, they are encouraged to use VecCUDAGetArrayRead() and/or VecCUDAGetArrayWrite() instead.

The user must call VecCUDARestoreArray() when they are finished using the array.

Developer Note#

If the device memory hasn’t been allocated previously it will be allocated as part of this routine.

See Also#

Vectors and Parallel Data, VecCUDARestoreArray(), VecCUDAGetArrayRead(), VecCUDAGetArrayWrite(), VecGetArray(), VecGetArrayRead(), VecGetArrayWrite()





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