pub struct Module { /* private fields */ }Implementations§
Source§impl Module
impl Module
pub unsafe fn from_raw(handle: CUmodule, ctx: Arc<Context>) -> Result<Self>
pub const unsafe fn from_borrowed_raw( handle: CUmodule, ctx: Arc<Context>, ) -> Self
Sourcepub fn function(&self, name: &str) -> Result<KernelFunction<'_>>
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.
Sourcepub fn function_count(&self) -> Result<usize>
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.
pub const fn as_raw(&self) -> CUmodule
Sourcepub fn into_raw(self) -> CUmodule
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.
Sourcepub fn global(&self, name: &str) -> Result<Global<'_>>
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.