PetscMemType#

Memory type of a pointer

Synopsis#

#include <petscdevicetypes.h> 
typedef enum {
  PETSC_MEMTYPE_HOST    = 0,
  PETSC_MEMTYPE_DEVICE  = 0x01,
  PETSC_MEMTYPE_CUDA    = 0x01,
  PETSC_MEMTYPE_NVSHMEM = 0x11,
  PETSC_MEMTYPE_HIP     = 0x03,
  PETSC_MEMTYPE_SYCL    = 0x05,
} PetscMemType;

Notes#

PETSC_MEMTYPE_KOKKOS depends on the Kokkos backend configuration

Developer Notes#

This enum uses a function (PetscMemTypeToString()) to convert to string representation so cannot be used in PetscOptionsEnum().

Developer Note#

Encoding of the bitmask in binary: xxxxyyyz

 z = 0                - Host memory
 z = 1                - Device memory
 yyy = 000            - CUDA-related memory
 yyy = 001            - HIP-related memory
 yyy = 010            - SYCL-related memory
 xxxxyyy1 = 0000,0001 - CUDA memory
 xxxxyyy1 = 0001,0001 - CUDA NVSHMEM memory
 xxxxyyy1 = 0000,0011 - HIP memory
 xxxxyyy1 = 0000,0101 - SYCL memory

Other types of memory, e.g., CUDA managed memory, can be added when needed.

See Also#

PetscMemTypeToString(), VecGetArrayAndMemType(), PetscSFBcastWithMemTypeBegin(), PetscSFReduceWithMemTypeBegin()

Level#

intermediate

Location#

include/petscdevicetypes.h


Edit on GitLab

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