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)¶ 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 ascupy.cuda.runtime.cudaArrayDefault.
Warning
The memory allocation of
CUDAarrayis done outside of CuPy’s memory management (enabled by default) due to CUDA’s limitation. Users ofCUDAarrayshould be cautious about any out-of-memory possibilities.See also
Methods
-
copy_from(self, in_arr, stream=None)¶ Copy data from device or host array to CUDA array.
- Parameters
in_arr (cupy.ndarray or numpy.ndarray) –
stream (cupy.cuda.Stream) – if not
None, an asynchronous copy is performed.
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
nchis the number of channels specified indesc.
-
copy_to(self, out_arr, stream=None)¶ Copy data from CUDA array to device or host array.
- Parameters
out_arr (cupy.ndarray or numpy.ndarray) –
stream (cupy.cuda.Stream) – if not
None, an asynchronous copy is performed.
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
nchis the number of channels specified indesc.
-
__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¶