cuda.core.experimental.LegacyPinnedMemoryResource#

class cuda.core.experimental.LegacyPinnedMemoryResource#

Create a pinned memory resource that uses legacy cuMemAllocHost/cudaMallocHost APIs.

Methods

__init__(self)#
allocate(
self,
size_t size,
stream: Stream = None,
) Buffer#

Allocate a buffer of the requested size.

Parameters:
  • size (int) – The size of the buffer to allocate, in bytes.

  • stream (Stream, optional) – Currently ignored

Returns:

The allocated buffer object, which is accessible on both host and device.

Return type:

Buffer

deallocate(
self,
ptr: DevicePointerT,
size_t size,
stream: Stream = None,
)#

Deallocate a buffer previously allocated by this resource.

Parameters:
  • ptr (DevicePointerT) – The pointer or handle to the buffer to deallocate.

  • size (int) – The size of the buffer to deallocate, in bytes.

  • stream (Stream, optional) – The stream on which to perform the deallocation asynchronously. If None, no synchronization would happen.

Attributes

property device_id: int#

This memory resource is not bound to any GPU.

property is_device_accessible: bool#

this memory resource provides device-accessible buffers.

Type:

bool

property is_host_accessible: bool#

this memory resource provides host-accessible buffers.

Type:

bool