pub struct Library { /* private fields */ }Expand description
A loaded CUDA library (CUDA 12.0+).
Implementations§
Source§impl Library
impl Library
Sourcepub fn load_raw(image: &[u8]) -> Result<Self>
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.
Sourcepub fn load_ptx(ptx: &str) -> Result<Self>
pub fn load_ptx(ptx: &str) -> Result<Self>
Load a library from a PTX source string (NUL-terminates internally).
Sourcepub fn get_kernel(&self, name: &str) -> Result<Kernel>
pub fn get_kernel(&self, name: &str) -> Result<Kernel>
Look up a kernel entry point by name.
Sourcepub fn kernel_count(&self) -> Result<u32>
pub fn kernel_count(&self) -> Result<u32>
Count of kernels this library exposes (CUDA 12.4+).
Sourcepub fn enumerate_kernels(&self) -> Result<Vec<Kernel>>
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.
Sourcepub fn module_raw(&self) -> Result<CUmodule>
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.
Sourcepub fn get_managed(&self, name: &str) -> Result<(CUdeviceptr, usize)>
pub fn get_managed(&self, name: &str) -> Result<(CUdeviceptr, usize)>
Look up a managed-memory global by name (CUDA 12.2+).
Sourcepub fn get_unified_function(&self, name: &str) -> Result<*mut c_void>
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.
Sourcepub fn get_global(&self, name: &str) -> Result<(CUdeviceptr, usize)>
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.