MCPcopy Create free account
hub / github.com/Rust-GPU/rust-cuda / from_ptx

Method from_ptx

crates/cust/src/module.rs:286–290  ·  view source on GitHub ↗

Creates a new module from a PTX string, allocating an intermediate buffer for the [`CString`]. The driver will JIT the PTX into arch-specific cubin or pick already-cached cubin if available. # Panics Panics if `string` contains a nul. # Example ``` # use cust::*; # use std::error::Error; # fn main() -> Result<(), Box > { # let _ctx = quick_init()?; use cust::module::Module; let ptx

(string: T, options: &[ModuleJitOption])

Source from the content-addressed store, hash-verified

284 /// # }
285 /// ```
286 pub fn from_ptx<T: AsRef<str>>(string: T, options: &[ModuleJitOption]) -> CudaResult<Module> {
287 let cstr = CString::new(string.as_ref())
288 .expect("string given to Module::from_str contained nul bytes");
289 Self::from_ptx_cstr(cstr.as_c_str(), options)
290 }
291
292 /// Load a module from a normal (rust) string, implicitly making it into
293 /// a cstring.

Callers

nothing calls this directly

Calls 3

newFunction · 0.85
expectMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected