pub struct HostMem { /* private fields */ }
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.
Implementations§
source§impl HostMem
impl HostMem
sourcepub fn new(alloc_type: HostMem_AllocType) -> Result<HostMem>
pub fn new(alloc_type: HostMem_AllocType) -> Result<HostMem>
C++ default parameters
- alloc_type: HostMem::AllocType::PAGE_LOCKED
pub fn copy(m: &HostMem) -> Result<HostMem>
sourcepub fn new_1(
rows: i32,
cols: i32,
typ: i32,
alloc_type: HostMem_AllocType
) -> Result<HostMem>
pub fn new_1( rows: i32, cols: i32, typ: i32, alloc_type: HostMem_AllocType ) -> Result<HostMem>
C++ default parameters
- alloc_type: HostMem::AllocType::PAGE_LOCKED
sourcepub fn new_2(
size: Size,
typ: i32,
alloc_type: HostMem_AllocType
) -> Result<HostMem>
pub fn new_2( size: Size, typ: i32, alloc_type: HostMem_AllocType ) -> Result<HostMem>
C++ default parameters
- alloc_type: HostMem::AllocType::PAGE_LOCKED
sourcepub fn new_3(
arr: &dyn ToInputArray,
alloc_type: HostMem_AllocType
) -> Result<HostMem>
pub fn new_3( arr: &dyn ToInputArray, alloc_type: HostMem_AllocType ) -> Result<HostMem>
creates from host memory with coping data
C++ default parameters
- alloc_type: HostMem::AllocType::PAGE_LOCKED
Trait Implementations§
source§impl Boxed for HostMem
impl Boxed for HostMem
source§impl HostMemTrait for HostMem
impl HostMemTrait for HostMem
fn as_raw_mut_HostMem(&mut self) -> *mut c_void
fn set_flags(&mut self, val: i32)
fn set_rows(&mut self, val: i32)
fn set_cols(&mut self, val: i32)
fn set_step(&mut self, val: size_t)
fn data(&mut self) -> *mut u8
unsafe fn set_data(&mut self, val: *mut u8)
fn refcount(&mut self) -> *mut i32
unsafe fn set_refcount(&mut self, val: *mut i32)
fn datastart(&mut self) -> *mut u8
unsafe fn set_datastart(&mut self, val: *mut u8)
fn set_alloc_type(&mut self, val: HostMem_AllocType)
source§fn create(&mut self, rows: i32, cols: i32, typ: i32) -> Result<()>
fn create(&mut self, rows: i32, cols: i32, typ: i32) -> Result<()>
allocates new matrix data unless the matrix already has specified size and type.
fn create_1(&mut self, size: Size, typ: i32) -> Result<()>
source§impl HostMemTraitConst for HostMem
impl HostMemTraitConst for HostMem
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
source§fn try_clone(&self) -> Result<HostMem>
fn try_clone(&self) -> Result<HostMem>
returns deep copy of the matrix, i.e. the data is copied
source§fn reshape(&self, cn: i32, rows: i32) -> Result<HostMem>
fn reshape(&self, cn: i32, rows: i32) -> Result<HostMem>
creates alternative HostMem header for the same data, with different
number of channels and/or different number of rows Read more
source§fn create_mat_header(&self) -> Result<Mat>
fn create_mat_header(&self) -> Result<Mat>
returns matrix header with disabled reference counting for HostMem data.
source§fn create_gpu_mat_header(&self) -> Result<GpuMat>
fn create_gpu_mat_header(&self) -> Result<GpuMat>
Maps CPU memory to GPU address space and creates the cuda::GpuMat header without reference counting
for it. Read more