MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / runtime_gpu_lines

Function runtime_gpu_lines

e2e/rust/tests/gpu/device_selection.rs:260–300  ·  view source on GitHub ↗
(gpu_device: &str)

Source from the content-addressed store, hash-verified

258}
259
260fn runtime_gpu_lines(gpu_device: &str) -> Vec<String> {
261 let engine = container_engine();
262 let image = gpu_probe_image();
263 let output = engine
264 .command()
265 .args([
266 "run",
267 "--rm",
268 "--device",
269 gpu_device,
270 image.as_str(),
271 "nvidia-smi",
272 "-L",
273 ])
274 .output()
275 .unwrap_or_else(|err| {
276 panic!(
277 "failed to run {} GPU probe container with image {image}: {err}",
278 engine.name()
279 )
280 });
281
282 let stdout = String::from_utf8_lossy(&output.stdout);
283 let stderr = String::from_utf8_lossy(&output.stderr);
284 let combined = format!("{stdout}{stderr}");
285 assert!(
286 output.status.success(),
287 "{} GPU probe failed for {gpu_device} with image {image} and status {:?}:\n{}",
288 engine.name(),
289 output.status.code(),
290 combined
291 );
292
293 let lines = gpu_lines(&stdout);
294 assert!(
295 !lines.is_empty(),
296 "{} GPU probe for {gpu_device} did not report any GPU lines with image {image}:\n{combined}",
297 engine.name()
298 );
299 lines
300}
301
302async fn sandbox_gpu_lines(gpu_device: Option<&str>) -> Vec<String> {
303 let mut args = vec!["--gpu"];

Calls 5

container_engineFunction · 0.85
gpu_probe_imageFunction · 0.85
gpu_linesFunction · 0.85
commandMethod · 0.80
as_strMethod · 0.45

Tested by

no test coverage detected