cupy.cuda.MemoryPointer — CuPy 13.4.1 documentation (original) (raw)

class cupy.cuda.MemoryPointer(BaseMemory mem, ptrdiff_t offset)[source]#

Pointer to a point on a device memory.

An instance of this class holds a reference to the original memory buffer and a pointer to a place within this buffer.

Parameters:

Variables:

Methods

copy_from(self, mem, size_t size)#

Copies a memory sequence from a (possibly different) device or host.

This function is a useful interface that selects appropriate one fromcopy_from_device() andcopy_from_host().

Parameters:

Warning

This function always uses the legacy default stream and does not honor the current stream. Use copy_from_async instead if you are using streams in your code, or have PTDS enabled.

copy_from_async(self, mem, size_t size, stream=None)#

Copies a memory sequence from an arbitrary place asynchronously.

This function is a useful interface that selects appropriate one fromcopy_from_device_async() andcopy_from_host_async().

Parameters:

copy_from_device(self, MemoryPointer src, size_t size)#

Copies a memory sequence from a (possibly different) device.

Parameters:

Warning

This function always uses the legacy default stream and does not honor the current stream. Use copy_from_device_async instead if you are using streams in your code, or have PTDS enabled.

copy_from_device_async(self, MemoryPointer src, size_t size, stream=None)#

Copies a memory from a (possibly different) device asynchronously.

Parameters:

copy_from_host(self, mem, size_t size)#

Copies a memory sequence from the host memory.

Parameters:

Warning

This function always uses the legacy default stream and does not honor the current stream. Use copy_from_host_async instead if you are using streams in your code, or have PTDS enabled.

copy_from_host_async(self, mem, size_t size, stream=None)#

Copies a memory sequence from the host memory asynchronously.

Parameters:

copy_to_host(self, mem, size_t size)#

Copies a memory sequence to the host memory.

Parameters:

Warning

This function always uses the legacy default stream and does not honor the current stream. Use copy_to_host_async instead if you are using streams in your code, or have PTDS enabled.

copy_to_host_async(self, mem, size_t size, stream=None)#

Copies a memory sequence to the host memory asynchronously.

Parameters:

memset(self, int value, size_t size)#

Fills a memory sequence by constant byte value.

Parameters:

Warning

This function always uses the legacy default stream and does not honor the current stream. Use memset_async instead if you are using streams in your code, or have PTDS enabled.

memset_async(self, int value, size_t size, stream=None)#

Fills a memory sequence by constant byte value asynchronously.

Parameters:

__eq__(value, /)#

Return self==value.

__ne__(value, /)#

Return self!=value.

__lt__(value, /)#

Return self<value.

__le__(value, /)#

Return self<=value.

__gt__(value, /)#

Return self>value.

__ge__(value, /)#

Return self>=value.

Attributes

device#

device_id#

mem#

ptr#