dpctl.memory.MemoryUSMHost
- class dpctl.memory.MemoryUSMHost(nbytes, alignment=0, queue=None, copy=False)
allocates nbytes of USM host memory.
Non-positive alignments are not used (malloc_host is used instead). For the queue=None case the
dpctl.SyclQueue()
is used to allocate memory.MemoryUSMDevice(usm_obj) constructor create instance from usm_obj expected to implement __sycl_usm_array_interface__ protocol and to expose a contiguous block of USM host allocation. Use copy=True to perform a copy if USM type of the allocation represented by the argument is other than ‘host’.
Attributes:
Extent of this USM buffer in bytes.
Reference to the Python object owning this USM buffer.
Extent of this USM buffer in bytes.
dpctl.SyclContext
the USM pointer is bound to.dpctl.SyclDevice
the USM pointer is bound to.dpctl.SyclQueue
withdpctl.SyclContext
the USM allocation is bound to anddpctl.SyclDevice
it was allocated on.Public methods:
Copy SYCL memory underlying the argument object into the memory of the instance
Copy content of Python buffer provided by obj to instance memory.
Copy content of instance's memory into memory of
obj
, or allocate NumPy array ofobj
isNone
.get_usm_type
([syclobj])Returns the type of USM allocation using Sycl context carried by syclobj keyword argument.
get_usm_type(syclobj=None)
Populates this USM allocation with given value.
Constructs bytes object populated with copy of USM memory.
Attributes
- MemoryUSMHost._context
dpctl.SyclContext
the USM pointer is bound to.
- MemoryUSMHost._pointer
USM pointer at the start of this buffer represented in Python integer.
- MemoryUSMHost._queue
dpctl.SyclQueue
withdpctl.SyclContext
the USM allocation is bound to anddpctl.SyclDevice
it was allocated on.
- MemoryUSMHost.nbytes
Extent of this USM buffer in bytes.
- MemoryUSMHost.reference_obj
Reference to the Python object owning this USM buffer.
- MemoryUSMHost.size
Extent of this USM buffer in bytes.
- MemoryUSMHost.sycl_context
dpctl.SyclContext
the USM pointer is bound to.
- MemoryUSMHost.sycl_device
dpctl.SyclDevice
the USM pointer is bound to.
- MemoryUSMHost.sycl_queue
dpctl.SyclQueue
withdpctl.SyclContext
the USM allocation is bound to anddpctl.SyclDevice
it was allocated on.
Public methods
- dpctl.memory.MemoryUSMHost.copy_from_device()
Copy SYCL memory underlying the argument object into the memory of the instance
- dpctl.memory.MemoryUSMHost.copy_from_host()
Copy content of Python buffer provided by obj to instance memory.
- dpctl.memory.MemoryUSMHost.copy_to_host()
Copy content of instance’s memory into memory of
obj
, or allocate NumPy array ofobj
isNone
.
- dpctl.memory.MemoryUSMHost.get_usm_type(syclobj=None)
Returns the type of USM allocation using Sycl context carried by syclobj keyword argument. Value of None is understood to query against self.sycl_context - the context used to create the allocation.
- dpctl.memory.MemoryUSMHost.get_usm_type_enum()
get_usm_type(syclobj=None)
Returns the type of USM allocation using Sycl context carried by syclobj keyword argument. Value of None is understood to query against self.sycl_context - the context used to create the allocation.
- dpctl.memory.MemoryUSMHost.memset()
Populates this USM allocation with given value.
- dpctl.memory.MemoryUSMHost.tobytes()
Constructs bytes object populated with copy of USM memory.