File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ import (
2929 specs "github.com/opencontainers/runtime-spec/specs-go"
3030)
3131
32- const nvidiaCLI = "nvidia-container-cli"
32+ // NvidiaCLI is the path to the Nvidia helper binary
33+ const NvidiaCLI = "nvidia-container-cli"
3334
3435// Capability specifies capabilities for the gpu inside the container
3536// Detailed explanation of options can be found:
@@ -51,13 +52,16 @@ const (
5152 Display Capability = "display"
5253)
5354
54- var allCaps = []Capability {
55- Compute ,
56- Compat32 ,
57- Graphics ,
58- Utility ,
59- Video ,
60- Display ,
55+ // AllCaps returns the complete list of supported Nvidia capabilties.
56+ func AllCaps () []Capability {
57+ return []Capability {
58+ Compute ,
59+ Compat32 ,
60+ Graphics ,
61+ Utility ,
62+ Video ,
63+ Display ,
64+ }
6165}
6266
6367// WithGPUs adds NVIDIA gpu support to a container
@@ -76,7 +80,7 @@ func WithGPUs(opts ...Opts) oci.SpecOpts {
7680 }
7781 c .OCIHookPath = path
7882 }
79- nvidiaPath , err := exec .LookPath (nvidiaCLI )
83+ nvidiaPath , err := exec .LookPath (NvidiaCLI )
8084 if err != nil {
8185 return err
8286 }
@@ -166,7 +170,7 @@ func WithAllDevices(c *config) error {
166170
167171// WithAllCapabilities adds all capabilities to the container for the gpus
168172func WithAllCapabilities (c * config ) error {
169- c .Capabilities = allCaps
173+ c .Capabilities = AllCaps ()
170174 return nil
171175}
172176
You can’t perform that action at this time.
0 commit comments