Skip to main content

Module

Struct Module 

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

Implementations§

Source§

impl Module

Source

pub unsafe fn from_raw(handle: CUmodule, ctx: Arc<Context>) -> Result<Self>

Source

pub const unsafe fn from_borrowed_raw( handle: CUmodule, ctx: Arc<Context>, ) -> Self

Source

pub fn function(&self, name: &str) -> Result<KernelFunction<'_>>

Returns the kernel function with the given name from the module.

§Errors

Returns crate::error::Status::NotFound if the module has no kernel function named name. Also returns an error if name contains an interior NUL byte, the module context cannot be bound, CUDA rejects the lookup, or a previous asynchronous launch reports an error.

Source

pub fn function_count(&self) -> Result<usize>

Returns the number of functions in this module.

§Errors

Returns an error if CUDA Driver cannot report the function count.

Source

pub const fn as_raw(&self) -> CUmodule

Source

pub fn into_raw(self) -> CUmodule

Consumes the module and returns the raw CUDA module handle without unloading it.

The caller becomes responsible for eventually unloading the returned handle with CUDA.

Source

pub fn global(&self, name: &str) -> Result<Global<'_>>

Returns the base pointer and size of the global with the given name located in the module.

The returned Global borrows this module, so the module remains loaded for at least as long as the global reference is usable.

§Errors

Returns crate::error::Status::NotFound if the module has no global variable named name. Also returns an error if name contains an interior NUL byte, the module context cannot be bound, CUDA rejects the lookup, or a previous asynchronous launch reports an error.

Trait Implementations§

Source§

impl Debug for Module

Source§

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

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

impl Drop for Module

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 Module

Source§

impl Sync for Module

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.