VecGetArrayWriteAndMemTypeAsync#

Returns a pointer to this MPI process’s portion of the vector data for writing without preserving its contents.

Synopsis#

Logically Collective; No Fortran Support

Input Parameter#

  • x - the vector

Output Parameters#

  • a - pointer to this MPI process’s portion of the vector data, borrowed from the vector

  • mtype - memory type of the array, or NULL if not needed

Notes#

For CUDA and HIP vectors that are not bound to the CPU, this routine always returns a device pointer without copying the old contents or waiting for the current PetscDeviceContext. The caller must order subsequent accesses after that context’s work, for example with PetscDeviceContextSynchronize(). Device allocation may still block.

Other vector types, including vectors bound to the CPU, use VecGetArrayWriteAndMemType() and retain its synchronization behavior.

The old contents are not preserved. Initialize every entry that will subsequently be read. The pointer is borrowed until VecRestoreArrayWriteAndMemType() is called. Complete external asynchronous work before restoring the array. Do not replace the vector’s storage or change its type or CPU binding while the array is acquired.

See Also#

Vectors and Parallel Data, Vec, VecGetArrayWriteAndMemType(), VecRestoreArrayWriteAndMemType(), VecGetArrayAndMemTypeAsync(), VecGetArrayReadAndMemTypeAsync(), PetscDeviceContextGetCurrentContext(), PetscDeviceContextSynchronize()

Level#

advanced

Location#

src/vec/vec/interface/rvector.c

Examples#

src/vec/vec/tests/ex65.c


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