fn memory_type<T>(ptr: *const T) -> MemoryType {
    match get_attr(ptr, CUpointer_attribute::CU_POINTER_ATTRIBUTE_MEMORY_TYPE) {
        Ok(CUmemorytype_enum::CU_MEMORYTYPE_HOST) => MemoryType::PageLocked,
        Ok(CUmemorytype_enum::CU_MEMORYTYPE_DEVICE) => MemoryType::Device,
        Ok(CUmemorytype_enum::CU_MEMORYTYPE_ARRAY) => MemoryType::Array,
        Ok(CUmemorytype_enum::CU_MEMORYTYPE_UNIFIED) => {
            unreachable!("CU_POINTER_ATTRIBUTE_MEMORY_TYPE never be UNIFED")
        }
        Err(_) => {
            // unmanaged by CUDA memory system, i.e. host memory
            MemoryType::Host
        }
    }
}
/// Determine actual memory type dynamically
///
/// Because `Continuous` memories can be treated as a slice,
/// input slice may represents any type of memory.
Determine actual memory type dynamically
Because `Continuous` memories can be treated as a slice,
input slice may represents any type of memory.
Determine actual memory type dynamically Because ` Continuous ` memories can be treated as a slice input slice may represents any type of memory .
fn memory_type<T>(ptr: *const T) -> MemoryType {
    match get_attr(ptr, CUpointer_attribute::CU_POINTER_ATTRIBUTE_MEMORY_TYPE) {
        Ok(CUmemorytype_enum::CU_MEMORYTYPE_HOST) => MemoryType::PageLocked,
        Ok(CUmemorytype_enum::CU_MEMORYTYPE_DEVICE) => MemoryType::Device,
        Ok(CUmemorytype_enum::CU_MEMORYTYPE_ARRAY) => MemoryType::Array,
        Ok(CUmemorytype_enum::CU_MEMORYTYPE_UNIFIED) => {
            unreachable!("CU_POINTER_ATTRIBUTE_MEMORY_TYPE never be UNIFED")
        }
        Err(_) => {
            // unmanaged by CUDA memory system, i.e. host memory
            MemoryType::Host
        }
    }
}
fn memory_type < T > ( ptr : * const T ) -> MemoryType { match get_attr ( ptr , CUpointer_attribute :: CU_POINTER_ATTRIBUTE_MEMORY_TYPE ) { Ok ( CUmemorytype_enum :: CU_MEMORYTYPE_HOST ) => MemoryType :: PageLocked , Ok ( CUmemorytype_enum :: CU_MEMORYTYPE_DEVICE ) => MemoryType :: Device , Ok ( CUmemorytype_enum :: CU_MEMORYTYPE_ARRAY ) => MemoryType :: Array , Ok ( CUmemorytype_enum :: CU_MEMORYTYPE_UNIFIED ) => { unreachable ! ( " " ) } Err ( _ ) => { // unmanaged by CUDA memory system, i.e. host memory MemoryType :: Host } } }
Determine actual memory type dynamically
Because `Continuous` memories can be treated as a slice,
input slice may represents any type of memory.
Determine actual memory type dynamically Because ` Continuous ` memories can be treated as a slice input slice may represents any type of memory .
ptr
*const T
ptr
*const T