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

Function get_last_artifact

crates/cuda_builder/src/lib.rs:516–539  ·  view source on GitHub ↗
(out: &str)

Source from the content-addressed store, hash-verified

514}
515
516fn get_last_artifact(out: &str) -> Option<PathBuf> {
517 let last = out
518 .lines()
519 .filter_map(|line| match serde_json::from_str::<RustcOutput>(line) {
520 Ok(line) => Some(line),
521 Err(_) => {
522 // Pass through invalid lines
523 println!("{}", line);
524 None
525 }
526 })
527 .filter(|line| line.reason == "compiler-artifact")
528 .last()
529 .expect("Did not find output file in rustc output");
530
531 let mut filenames = last
532 .filenames
533 .unwrap()
534 .into_iter()
535 .filter(|v| v.ends_with(".ptx"));
536 let filename = filenames.next()?;
537 assert_eq!(filenames.next(), None, "Crate had multiple .ptx artifacts");
538 Some(filename.into())
539}

Callers 1

invoke_rustcFunction · 0.85

Calls 2

expectMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected