Skip to main content

ExternalMemory

Struct ExternalMemory 

Source
pub struct ExternalMemory { /* private fields */ }

Implementations§

Source§

impl ExternalMemory

Source

pub unsafe fn import_opaque_file_descriptor( fd: RawFd, size: usize, flags: ExternalMemoryFlags, ) -> Result<Self>

Imports an opaque file descriptor as CUDA external memory.

§Safety

fd must reference a valid external memory object of size bytes. CUDA takes ownership of the descriptor on a successful import.

Source

pub unsafe fn import_opaque_win32_handle( handle: *mut c_void, size: usize, flags: ExternalMemoryFlags, ) -> Result<Self>

Imports an opaque Win32 shared handle as CUDA external memory.

§Safety

handle must be a valid shared handle for a memory object of size bytes and must remain valid according to CUDA’s external-memory import rules.

Source

pub unsafe fn import_opaque_win32_name( name: *const c_void, size: usize, flags: ExternalMemoryFlags, ) -> Result<Self>

Imports an opaque named Win32 shared object as CUDA external memory.

§Safety

name must point to a valid null-terminated Win32 object name for a memory object of size bytes and remain valid for the import call.

Source

pub fn map_buffer<T: DeviceRepr>( &self, offset_bytes: usize, length: usize, ) -> Result<MappedBuffer<'_, T>>

Source

pub const fn byte_len(&self) -> usize

Source

pub const fn as_raw(&self) -> CUexternalMemory

Source

pub unsafe fn from_raw(handle: CUexternalMemory, size: usize) -> Result<Self>

Takes ownership of a raw CUDA external-memory handle.

§Safety

handle must be a valid CUexternalMemory that is not owned by any other wrapper, and size must match the imported memory object’s byte size so mapped ranges can be bounds-checked correctly.

Source

pub fn into_raw(self) -> CUexternalMemory

Transfers ownership of the raw CUDA external-memory handle to the caller without destroying it.

The caller becomes responsible for eventually destroying the returned handle with cuDestroyExternalMemory.

Trait Implementations§

Source§

impl Debug for ExternalMemory

Source§

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

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

impl Drop for ExternalMemory

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for ExternalMemory

Source§

impl Sync for ExternalMemory

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> 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, 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.