VecCreateMPIWithArrayAndMemType#
Creates a parallel array-style vector using a user-provided array with the specified memory type
Synopsis#
#include "petscvec.h"
PetscErrorCode VecCreateMPIWithArrayAndMemType(MPI_Comm comm, PetscMemType mtype, PetscInt bs, PetscInt n, PetscInt N, const PetscScalar array[], Vec *V)
Collective
Input Parameters#
comm - the MPI communicator to use
mtype - the memory type of
array, which must be the same on all processes incommbs - block size, same meaning as
VecSetBlockSize()n - local vector length, cannot be
PETSC_DECIDEN - global vector length (or
PETSC_DETERMINEto have calculated)array - memory where the vector elements are to be stored
Output Parameter#
V - the vector
Notes#
mtype determines whether the resulting vector is a standard, CUDA, or HIP vector. Since PETSC_MEMTYPE_DEVICE and
PETSC_MEMTYPE_CUDA have the same value, that value creates a CUDA vector when CUDA is configured and otherwise creates
a HIP vector when HIP is configured.
mtype alone does not identify the Kokkos implementation, and native SYCL vectors are not supported, so this function does
not create Kokkos or SYCL vectors.
array remains owned by the caller and is not freed when the vector is destroyed via VecDestroy().
See Also#
VecCreateMPIWithArray(), VecCreateSeqWithArrayAndMemType(), VecCreateMPICUDAWithArray(), VecCreateMPIHIPWithArray(), PetscMemType
Level#
intermediate
Location#
src/vec/vec/utils/veccreatememtype.c
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages