pub struct Module { /* private fields */ }Expand description
A loaded CUDA module (e.g. compiled PTX).
Implementations§
Source§impl Module
impl Module
Sourcepub fn load_raw(context: &Context, image: &[u8]) -> Result<Self>
pub fn load_raw(context: &Context, image: &[u8]) -> Result<Self>
Load a module from a raw binary image (CUBIN, fatbin, or PTX text with a trailing NUL).
For PTX, the bytes must be a null-terminated UTF-8 string matching the
ptx file on disk. Module::load_ptx is a convenience wrapper that
adds the NUL for you.
Sourcepub fn load_ptx(context: &Context, ptx_source: &str) -> Result<Self>
pub fn load_ptx(context: &Context, ptx_source: &str) -> Result<Self>
Load a module from a PTX source string.
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. Returns
(device_ptr, size_in_bytes).
Sourcepub fn get_function(&self, name: &str) -> Result<Function>
pub fn get_function(&self, name: &str) -> Result<Function>
Look up a kernel entry point by name.
Sourcepub fn loading_mode() -> Result<i32>
pub fn loading_mode() -> Result<i32>
Return the current process-wide module loading mode (eager vs. lazy).
Compare against
baracuda_cuda_sys::types::CUmoduleLoadingMode constants.
Sourcepub unsafe fn load_data_ex(
context: &Context,
image: &[u8],
options: &mut [i32],
option_values: &mut [*mut c_void],
) -> Result<Self>
pub unsafe fn load_data_ex( context: &Context, image: &[u8], options: &mut [i32], option_values: &mut [*mut c_void], ) -> Result<Self>
Load a module from a raw image with extra JIT compiler options —
the typical use is capturing the JIT log when a PTX module
fails to compile. options and option_values are parallel
arrays whose entries follow the CUjit_option ABI (see the
CUDA driver reference). For PTX, the bytes must be a
null-terminated UTF-8 string.
§Safety
Each option_value must point at a value of the type the
matching CUjit_option expects (some are pointers, some are
integers cast to *mut c_void). The arrays must have the same
length.