pub trait HostMemTraitConst {
Show 20 methods fn as_raw_HostMem(&self) -> *const c_void; fn flags(&self) -> i32 { ... } fn rows(&self) -> i32 { ... } fn cols(&self) -> i32 { ... } fn step(&self) -> size_t { ... } fn dataend(&self) -> *const u8 { ... } fn alloc_type(&self) -> HostMem_AllocType { ... } fn try_clone(&self) -> Result<HostMem> { ... } fn reshape(&self, cn: i32, rows: i32) -> Result<HostMem> { ... } fn create_mat_header(&self) -> Result<Mat> { ... } fn create_gpu_mat_header(&self) -> Result<GpuMat> { ... } fn is_continuous(&self) -> Result<bool> { ... } fn elem_size(&self) -> Result<size_t> { ... } fn elem_size1(&self) -> Result<size_t> { ... } fn typ(&self) -> Result<i32> { ... } fn depth(&self) -> Result<i32> { ... } fn channels(&self) -> Result<i32> { ... } fn step1(&self) -> Result<size_t> { ... } fn size(&self) -> Result<Size> { ... } fn empty(&self) -> Result<bool> { ... }
}
Expand description

Class with reference counting wrapping special memory type allocation functions from CUDA.

Its interface is also Mat-like but with additional memory type parameters.

  • PAGE_LOCKED sets a page locked memory type used commonly for fast and asynchronous uploading/downloading data from/to GPU.
  • SHARED specifies a zero copy memory allocation that enables mapping the host memory to GPU address space, if supported.
  • WRITE_COMBINED sets the write combined buffer that is not cached by CPU. Such buffers are used to supply GPU with data when GPU only reads it. The advantage is a better CPU cache utilization.

Note: Allocation size of such memory types is usually limited. For more details, see CUDA 2.2 Pinned Memory APIs document or CUDA C Programming Guide.

Required Methods§

Provided Methods§

returns deep copy of the matrix, i.e. the data is copied

creates alternative HostMem header for the same data, with different number of channels and/or different number of rows

C++ default parameters
  • rows: 0

returns matrix header with disabled reference counting for HostMem data.

Maps CPU memory to GPU address space and creates the cuda::GpuMat header without reference counting for it.

This can be done only if memory was allocated with the SHARED flag and if it is supported by the hardware. Laptops often share video and CPU memory, so address spaces can be mapped, which eliminates an extra copy.

Implementors§