VecCreateSeqHIPWithArrays#
Creates a sequential, array-style vector using HIP, where the user provides the complete array space to store the vector values.
Synopsis#
#include <petscvec.h>
PetscErrorCode VecCreateSeqHIPWithArrays(MPI_Comm comm, PetscInt bs, PetscInt n, const PetscScalar cpuarray[], const PetscScalar gpuarray[], Vec *v)
Collective, Possibly Synchronous
Input Parameters#
comm - the communicator, must be
PETSC_COMM_SELF
bs - the block size
n - the local vector length
cpuarray - CPU memory where the vector elements are to be stored (or
NULL
)gpuarray - GPU memory where the vector elements are to be stored (or
NULL
)
Output Parameter#
v - the vector
Notes#
If the user-provided array is NULL
, then VecHIPPlaceArray()
can be used at a later stage to
SET the array for storing the vector values. Otherwise, the array must be allocated on the
device.
If both cpuarray
and gpuarray
are provided, the provided arrays must have identical
values.
The arrays are NOT freed when the vector is destroyed via VecDestroy()
. The user must free
them themselves, but not until the vector is destroyed.
This function may initialize PetscDevice
, which may incur a device synchronization.
See Also#
Vectors and Parallel Data, PetscDeviceInitialize()
, VecCreate()
, VecCreateSeqWithArray()
, VecCreateSeqHIP()
,
VecCreateSeqHIPWithArray()
, VecCreateMPIHIP()
, VecCreateMPIHIPWithArray()
,
VecCreateMPIHIPWithArrays()
, VecHIPPlaceArray()
C@*/
PetscErrorCode VecCreateSeqHIPWithArrays(MPI_Comm comm, PetscInt bs, PetscInt n, const PetscScalar cpuarray[], const PetscScalar gpuarray[], Vec *v)
{
PetscFunctionBegin;
PetscCall(VecCreateSeqCUPMWithArraysAsyncDeviceType::HIP(comm, bs, n, cpuarray, gpuarray, v));
PetscFunctionReturn(PETSC_SUCCESS);
}
// PetscClangLinter pragma disable: -fdoc-internal-linkage /*@C VecCreateSeqHIPWithArray - Creates a sequential, array-style vector using HIP, where the user provides the device array space to store the vector values.
Collective, Possibly Synchronous
Input Parameters#
comm - the communicator, must be
PETSC_COMM_SELF
bs - the block size
n - the vector length
gpuarray - GPU memory where the vector elements are to be stored (or
NULL
)
Output Parameter#
v - the vector
Notes#
If the user-provided array is NULL
, then VecHIPPlaceArray()
can be used at a later stage to
SET the array for storing the vector values. Otherwise, the array must be allocated on the
device.
The array is NOT freed when the vector is destroyed via VecDestroy()
. The user must free the
array themselves, but not until the vector is destroyed.
Use VecDuplicate()
or VecDuplicateVecs()
to form additional vectors of the same type as an
existing vector.
This function may initialize PetscDevice
, which may incur a device synchronization.
See Also#
Vectors and Parallel Data, PetscDeviceInitialize()
, VecCreate()
, VecCreateSeq()
, VecCreateSeqWithArray()
,
VecCreateMPIWithArray()
, VecCreateSeqHIP()
, VecCreateMPIHIPWithArray()
, VecHIPPlaceArray()
,
VecDuplicate()
, VecDuplicateVecs()
, VecCreateGhost()
Level#
intermediate
Location#
src/vec/vec/impls/seq/cupm/hip/vecseqcupm.hip.cpp
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages