Skip to main content

IpcMemoryHandle

Struct IpcMemoryHandle 

Source
pub struct IpcMemoryHandle(/* private fields */);

Implementations§

Source§

impl IpcMemoryHandle

Source

pub const unsafe fn from_raw(handle: cudaIpcMemHandle_t) -> Self

Source

pub const fn zeroed() -> Self

Source

pub const fn as_raw(&self) -> cudaIpcMemHandle_t

Source

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:

§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

Source§

fn clone(&self) -> IpcMemoryHandle

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for IpcMemoryHandle

Source§

impl Debug for IpcMemoryHandle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for IpcMemoryHandle

Source§

impl Hash for IpcMemoryHandle

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for IpcMemoryHandle

Source§

fn eq(&self, other: &IpcMemoryHandle) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for IpcMemoryHandle

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.