Managed (unified) memory resource: one allocation reachable from host and device (GPU::memAllocManaged / GPU::memFree).
More...
#include <EBGeometry_MemoryResource.hpp>
|
|
| ManagedMemoryResource ()=default |
| | Default constructor.
|
| |
|
| ~ManagedMemoryResource () override=default |
| | Destructor.
|
| |
| void * | allocate (size_t a_bytes, size_t a_alignment) override |
| | Allocate a block of managed (unified) memory.
|
| |
| void | deallocate (void *a_ptr, size_t a_bytes, size_t a_alignment) noexcept override |
| | Free a block previously returned by allocate.
|
| |
| bool | isHostAccessible () const noexcept override |
| | Managed blocks are host-accessible.
|
| |
| bool | isDeviceAccessible () const noexcept override |
| | Managed blocks are device-accessible.
|
| |
| void | copy (void *a_dst, const MemoryResource &a_dstResource, const void *a_src, const MemoryResource &a_srcResource, size_t a_bytes) const noexcept override |
| | Copy between host and device memory with the GPU runtime; see MemoryResource::copy.
|
| |
|
| MemoryResource ()=default |
| | Default constructor.
|
| |
|
virtual | ~MemoryResource ()=default |
| | Destructor.
|
| |
|
| MemoryResource (const MemoryResource &)=delete |
| | Copy constructor. Deleted: a resource's identity is meaningful and non-copyable.
|
| |
|
MemoryResource & | operator= (const MemoryResource &)=delete |
| | Copy assignment. Deleted: a resource's identity is meaningful and non-copyable.
|
| |
Managed (unified) memory resource: one allocation reachable from host and device (GPU::memAllocManaged / GPU::memFree).
Compiled only under an offload backend (CUDA/HIP) or for documentation. Blocks are both host- and device-accessible: the same base pointer can be dereferenced by the CPU and passed to a kernel, at the cost of driver-managed page migration.
◆ allocate()
| void * EBGeometry::ManagedMemoryResource::allocate |
( |
size_t |
a_bytes, |
|
|
size_t |
a_alignment |
|
) |
| |
|
overridevirtual |
Allocate a block of managed (unified) memory.
- Parameters
-
| [in] | a_bytes | Number of bytes to allocate. |
| [in] | a_alignment | Required alignment (validated to be <= PoolBaseAlign). |
- Returns
- Managed pointer to the allocated block (never null on success; aborts on failure).
Implements EBGeometry::MemoryResource.
◆ copy()
| void EBGeometry::ManagedMemoryResource::copy |
( |
void * |
a_dst, |
|
|
const MemoryResource & |
a_dstResource, |
|
|
const void * |
a_src, |
|
|
const MemoryResource & |
a_srcResource, |
|
|
size_t |
a_bytes |
|
) |
| const |
|
overridevirtualnoexcept |
Copy between host and device memory with the GPU runtime; see MemoryResource::copy.
Host-to-host is a plain copy; device-to-device aborts, in every build.
- Parameters
-
| [out] | a_dst | Destination block. |
| [in] | a_dstResource | Resource that allocated a_dst. |
| [in] | a_src | Source block. |
| [in] | a_srcResource | Resource that allocated a_src. |
| [in] | a_bytes | Number of bytes to copy. |
Reimplemented from EBGeometry::MemoryResource.
◆ deallocate()
| void EBGeometry::ManagedMemoryResource::deallocate |
( |
void * |
a_ptr, |
|
|
size_t |
a_bytes, |
|
|
size_t |
a_alignment |
|
) |
| |
|
overridevirtualnoexcept |
Free a block previously returned by allocate.
- Parameters
-
| [in] | a_ptr | Managed pointer to free (null is a no-op). |
| [in] | a_bytes | Unused. |
| [in] | a_alignment | Unused. |
Implements EBGeometry::MemoryResource.
◆ isDeviceAccessible()
| bool EBGeometry::ManagedMemoryResource::isDeviceAccessible |
( |
| ) |
const |
|
inlineoverridevirtualnoexcept |
◆ isHostAccessible()
| bool EBGeometry::ManagedMemoryResource::isHostAccessible |
( |
| ) |
const |
|
inlineoverridevirtualnoexcept |
The documentation for this class was generated from the following file: