Skip to main content

Library

Struct Library 

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

Implementations§

Source§

impl Library

Source

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

Source

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

Returns the handle of the kernel with the given name located in this library. If kernel handle is not found, the call returns crate::error::Status::NotFound.

§Errors

Returns an error if name contains an interior NUL byte, if the CUDA context cannot be bound, if CUDA Driver cannot find the kernel, or if it returns a null handle.

Source

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

Returns the number of kernels in this library.

§Errors

Returns an error if the CUDA context cannot be bound or if CUDA Driver cannot report the kernel count.

Source

pub fn module(&self) -> Result<Module>

Returns the module handle associated with the current context located in this library. If module handle is not found, the call returns crate::error::Status::NotFound.

§Errors

Returns an error if the CUDA context cannot be bound, if CUDA Driver cannot find the module, or if it returns a null handle.

Source

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

Returns the base pointer and size of the global with the given name for the requested library and the current context. If no global for the requested name exists, the call returns crate::error::Status::NotFound.

§Errors

Returns an error if name contains an interior NUL byte, if the CUDA context cannot be bound, or if CUDA Driver cannot find the global.

Source

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

Returns the base pointer and size of the managed memory with the given name for the requested library. If no managed memory with the requested name exists, the call returns crate::error::Status::NotFound. Managed memory for the library is shared across devices and is registered when the library is loaded into at least one context.

§Errors

Returns an error if name contains an interior NUL byte, if the CUDA context cannot be bound, or if CUDA Driver cannot find the managed allocation.

Source

pub fn unified_function(&self, symbol: &str) -> Result<*mut ()>

Returns the pointer to the unified function named by symbol. If no unified function with that name exists, the call returns crate::error::Status::NotFound. If no device in the system supports unified function pointers, the call may return crate::error::Status::NotFound.

§Errors

Returns an error if symbol contains an interior NUL byte, if the CUDA context cannot be bound, or if CUDA Driver cannot find the unified function.

Source

pub const fn as_raw(&self) -> CUlibrary

Source

pub fn into_raw(self) -> CUlibrary

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

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

Trait Implementations§

Source§

impl Debug for Library

Source§

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

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

impl Drop for Library

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

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.