Skip to main content

Library

Struct Library 

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

A loaded CUDA library (CUDA 12.0+).

Implementations§

Source§

impl Library

Source

pub fn load_raw(image: &[u8]) -> Result<Self>

Load a library from a raw image (CUBIN, fatbin, or null-terminated PTX) with no JIT/library options.

Source

pub fn load_ptx(ptx: &str) -> Result<Self>

Load a library from a PTX source string (NUL-terminates internally).

Source

pub fn get_kernel(&self, name: &str) -> Result<Kernel>

Look up a kernel entry point by name.

Source

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

Count of kernels this library exposes (CUDA 12.4+).

Source

pub fn enumerate_kernels(&self) -> Result<Vec<Kernel>>

Enumerate every kernel in the library (CUDA 12.4+). Allocates the result vector at the count reported by Self::kernel_count.

Source

pub fn module_raw(&self) -> Result<CUmodule>

Retrieve the underlying CUmodule backing this library, if any (CUDA 12.4+). Not all libraries have an addressable module — some ship compiled-kernel images only.

Source

pub fn get_managed(&self, name: &str) -> Result<(CUdeviceptr, usize)>

Look up a managed-memory global by name (CUDA 12.2+).

Source

pub fn get_unified_function(&self, name: &str) -> Result<*mut c_void>

Look up a unified-function pointer by name (CUDA 12.4+). Returns the raw host-side function pointer; the caller is responsible for casting it to the right signature before calling.

Source

pub fn get_global(&self, name: &str) -> Result<(CUdeviceptr, usize)>

Look up a __device__ global variable by name across contexts. Returns (device_ptr, size_in_bytes). The returned pointer is valid in whatever context is current when the caller dereferences it.

Source

pub fn as_raw(&self) -> CUlibrary

Raw CUlibrary handle. Use with care.

Trait Implementations§

Source§

impl Clone for Library

Source§

fn clone(&self) -> Library

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 Debug for Library

Source§

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

Formats the value using the given formatter. 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<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> 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.