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

Function has_gpu_devices

crates/openshell-sandbox/src/lib.rs:746–748  ·  view source on GitHub ↗

Returns true if GPU devices are present in the container. Checks both the native Linux NVIDIA control device (`/dev/nvidiactl`) and the WSL2 DXG device (`/dev/dxg`). CDI injects exactly one of these depending on the host kernel; the other will not exist.

()

Source from the content-addressed store, hash-verified

744/// the WSL2 DXG device (`/dev/dxg`). CDI injects exactly one of these
745/// depending on the host kernel; the other will not exist.
746fn has_gpu_devices() -> bool {
747 std::path::Path::new("/dev/nvidiactl").exists() || std::path::Path::new("/dev/dxg").exists()
748}
749
750/// Enumerate per-GPU device nodes (`/dev/nvidia0`, `/dev/nvidia1`, …).
751fn enumerate_gpu_device_nodes() -> Vec<String> {

Calls 1

existsMethod · 0.80