cupy.cuda.texture.CUDAarray#

class cupy.cuda.texture.CUDAarray(ChannelFormatDescriptor desc, size_t width, size_t height=0, size_t depth=0, unsigned int flags=0)[source]#

Allocate a CUDA array (cudaArray_t) that can be used as texture memory. Depending on the input, either 1D, 2D, or 3D CUDA array is returned.

Parameters:
  • desc (ChannelFormatDescriptor) – an instance of ChannelFormatDescriptor.

  • width (int) – the width (in elements) of the array.

  • height (int, optional) – the height (in elements) of the array.

  • depth (int, optional) – the depth (in elements) of the array.

  • flags (int, optional) – the flag for extensions. Use one of the values in cudaArray*, such as cupy.cuda.runtime.cudaArrayDefault.

Warning

The memory allocation of CUDAarray is done outside of CuPy’s memory management (enabled by default) due to CUDA’s limitation. Users of CUDAarray should be cautious about any out-of-memory possibilities.

Methods

copy_from(self, in_arr, stream=None)#

Copy data from device or host array to CUDA array.

Parameters:

Note

For CUDA arrays with different dimensions, the requirements for the shape of the input array are given as follows:

  • 1D: (nch * width,)

  • 2D: (height, nch * width)

  • 3D: (depth, height, nch * width)

where nch is the number of channels specified in desc.

copy_to(self, out_arr, stream=None)#

Copy data from CUDA array to device or host array.

Parameters:

Note

For CUDA arrays with different dimensions, the requirements for the shape of the output array are given as follows:

  • 1D: (nch * width,)

  • 2D: (height, nch * width)

  • 3D: (depth, height, nch * width)

where nch is the number of channels specified in desc.

__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

depth#
desc#
flags#
height#
ndim#
ptr#
width#