petsc-3.15.0 2021-04-05
Report Typos and Errors


Creates a parallel, array-style vector, where the user provides the GPU array space to store the vector values.


#include "petscvec.h"   
PetscErrorCode  VecCreateMPICUDAWithArrays(MPI_Comm comm,PetscInt bs,PetscInt n,PetscInt N,const PetscScalar cpuarray[],const PetscScalar gpuarray[],Vec *vv)

Input Parameters

comm - the MPI communicator to use
bs - block size, same meaning as VecSetBlockSize()
n - local vector length, cannot be PETSC_DECIDE
N - global vector length (or PETSC_DECIDE to have calculated)
cpuarray - the user provided CPU array to store the vector values
gpuarray - the user provided GPU array to store the vector values

Output Parameter

vv - the vector


If both cpuarray and gpuarray are provided, the caller must ensure that the provided arrays have identical values.

Use VecDuplicate() or VecDuplicateVecs() to form additional vectors of the same type as an existing vector.

PETSc does NOT free the provided arrays when the vector is destroyed via VecDestroy(). The user should not free the array until the vector is destroyed.

See Also

VecCreateSeqCUDAWithArrays(), VecCreateMPIWithArray(), VecCreateSeqWithArray(),
VecCreate(), VecDuplicate(), VecDuplicateVecs(), VecCreateGhost(), VecCreateMPI(), VecCreateGhostWithArray(), VecCUDAPlaceArray(), VecPlaceArray(), VecCUDAAllocateCheckHost()




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