Skip to main content
`Ctrl`+`K`

# PetscDeviceRegisterMemory

Register a pointer for use with device-aware memory system

## Synopsis

    #include <petscdevice.h>
    PetscErrorCode PetscDeviceRegisterMemory(const void *PETSC_RESTRICT ptr, PetscMemType mtype, std::size_t size)

Not Collective

## Input Parameters

- ptr - The pointer to register

- mtype - The `PetscMemType` of the pointer

- size - The size (in bytes) of the memory region

## Notes

`ptr` need not point to the beginning of the memory range, however the user should register the

It’s OK to re-register the same `ptr` repeatedly (subsequent registrations do nothing) however the given `mtype` and `size` must match the original registration.

`size` may be 0 (in which case this routine does nothing).

## See Also

`PetscDeviceMalloc()`, `PetscDeviceArrayCopy()`, `PetscDeviceFree()`, `PetscDeviceArrayZero()`

## Level

intermediate

## Location

src/sys/objects/device/interface/memory.cxx

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