Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.

Commit cb46972

Browse files
committed
Improve CUDA detection
In Docker 19.03+ NVIDIA Container Toolkit can integrates via an OCI prestart hook instead of requiring to be listed as a separate runtime. Signed-off-by: Emily Casey <[email protected]>
1 parent 89e512d commit cb46972

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/gpu/gpu.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package gpu
22

33
import (
44
"context"
5+
"os/exec"
56

67
"github.com/docker/docker/client"
78
)
@@ -25,5 +26,11 @@ func ProbeGPUSupport(ctx context.Context, dockerClient client.SystemAPIClient) (
2526
if _, hasNvidia := info.Runtimes["nvidia"]; hasNvidia {
2627
return GPUSupportCUDA, nil
2728
}
29+
30+
// If nvidia runtime is not listed, try searching for nvidia-container-runtime on PATH
31+
if _, err := exec.LookPath("nvidia-container-runtime"); err == nil {
32+
return GPUSupportCUDA, nil
33+
}
34+
2835
return GPUSupportNone, nil
2936
}

0 commit comments

Comments
 (0)