pub struct IpcMemoryHandle(/* private fields */);Implementations§
Source§impl IpcMemoryHandle
impl IpcMemoryHandle
pub const unsafe fn from_raw(handle: cudaIpcMemHandle_t) -> Self
pub const fn zeroed() -> Self
pub const fn as_raw(&self) -> cudaIpcMemHandle_t
Sourcepub fn create_mapping<T>(
self,
flags: IpcMemoryFlags,
) -> Result<OpenedIpcMemory<T>>
pub fn create_mapping<T>( self, flags: IpcMemoryFlags, ) -> Result<OpenedIpcMemory<T>>
Maps memory exported from another process with DeviceMemory::ipc_handle into the current device address space.
For contexts on different devices, IpcMemoryHandle::create_mapping can attempt to enable peer access between the devices as if Device::enable_peer_access had been called.
This behavior is controlled by IpcMemoryFlags::LAZY_ENABLE_PEER_ACCESS.
Device::can_access_peer can determine if a mapping is possible.
IpcMemoryHandle::create_mapping can open handles to devices that may not be visible in the current process.
Imported memory handles from each device in a given process may only be opened by one context per device per other process.
If the memory handle has already been opened by the current context, the reference count on the handle is incremented by 1 and the existing device pointer is returned.
Memory returned from IpcMemoryHandle::create_mapping must be freed with OpenedIpcMemory::close.
Calling DeviceMemory::free on an
exported memory region before calling OpenedIpcMemory::close in the
importing context results in undefined behavior.
IPC is restricted to devices with support for unified addressing on Linux and Windows operating systems.
IPC on Windows is supported for compatibility, but is not recommended
because it has a performance cost.
Check device IPC support through the device properties exposed by this crate, for example DeviceProperties::ipc_event_supported.
Additional CUDA diagnostics:
- This call may also return
crate::error::Status::NotInitialized,crate::error::Status::CallRequiresNewerDriver, orcrate::error::Status::NoDeviceif it initializes internal CUDA runtime state. - Callbacks must not call CUDA functions; see
Stream::add_callback.crate::error::Status::NotPermittedmay, but is not guaranteed to, be returned as a diagnostic in that case. - No guarantees are made about the address returned. In particular, multiple processes may not receive the same address for the same handle.
§Errors
Returns an error if CUDA Runtime cannot open the IPC handle, if the current device cannot access the allocation, or if CUDA returns a null mapped pointer.
Trait Implementations§
Source§impl Clone for IpcMemoryHandle
impl Clone for IpcMemoryHandle
Source§fn clone(&self) -> IpcMemoryHandle
fn clone(&self) -> IpcMemoryHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for IpcMemoryHandle
Source§impl Debug for IpcMemoryHandle
impl Debug for IpcMemoryHandle
impl Eq for IpcMemoryHandle
Source§impl Hash for IpcMemoryHandle
impl Hash for IpcMemoryHandle
Source§impl PartialEq for IpcMemoryHandle
impl PartialEq for IpcMemoryHandle
Source§fn eq(&self, other: &IpcMemoryHandle) -> bool
fn eq(&self, other: &IpcMemoryHandle) -> bool
self and other values to be equal, and is used by ==.