allow multi gpu to be specified via ctr
Signed-off-by: Michael Crosby <michael@thepasture.io>
This commit is contained in:
parent
c7e4747cfb
commit
09d78bb6b9
@ -147,7 +147,7 @@ var (
|
|||||||
Name: "pid-file",
|
Name: "pid-file",
|
||||||
Usage: "file path to write the task's pid",
|
Usage: "file path to write the task's pid",
|
||||||
},
|
},
|
||||||
cli.IntFlag{
|
cli.IntSliceFlag{
|
||||||
Name: "gpus",
|
Name: "gpus",
|
||||||
Usage: "add gpus to the container",
|
Usage: "add gpus to the container",
|
||||||
},
|
},
|
||||||
|
@ -250,7 +250,7 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
if context.IsSet("gpus") {
|
if context.IsSet("gpus") {
|
||||||
opts = append(opts, nvidia.WithGPUs(nvidia.WithDevices(context.Int("gpus")), nvidia.WithAllCapabilities))
|
opts = append(opts, nvidia.WithGPUs(nvidia.WithDevices(context.IntSlice("gpus")...), nvidia.WithAllCapabilities))
|
||||||
}
|
}
|
||||||
if context.IsSet("allow-new-privs") {
|
if context.IsSet("allow-new-privs") {
|
||||||
opts = append(opts, oci.WithNewPrivileges)
|
opts = append(opts, oci.WithNewPrivileges)
|
||||||
|
Loading…
Reference in New Issue
Block a user