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

Function sandbox_gpu_lines

e2e/rust/tests/gpu/device_selection.rs:302–319  ·  view source on GitHub ↗
(gpu_device: Option<&str>)

Source from the content-addressed store, hash-verified

300}
301
302async fn sandbox_gpu_lines(gpu_device: Option<&str>) -> Vec<String> {
303 let mut args = vec!["--gpu"];
304 let driver_config_json;
305 if let Some(gpu_device) = gpu_device {
306 driver_config_json = cdi_devices_driver_config_json(&[gpu_device]);
307 args.push("--driver-config-json");
308 args.push(driver_config_json.as_str());
309 }
310 args.extend(["--", "sh", "-lc", "nvidia-smi -L"]);
311
312 let mut guard = SandboxGuard::create(&args)
313 .await
314 .expect("GPU sandbox create should succeed");
315
316 let lines = gpu_lines(&guard.create_output);
317 guard.cleanup().await;
318 lines
319}
320
321async fn sandbox_create_output(args: &[&str]) -> String {
322 let mut cmd = openshell_cmd();

Calls 5

gpu_linesFunction · 0.85
pushMethod · 0.80
cleanupMethod · 0.80
as_strMethod · 0.45

Tested by

no test coverage detected