Merge pull request #5636 from crosbymichael/multi-gpus

allow multi gpu to be specified via ctr
This commit is contained in:
Fu Wei
2021-06-23 00:08:48 +08:00
committed by GitHub
2 changed files with 2 additions and 2 deletions

View File

@@ -147,7 +147,7 @@ var (
Name: "pid-file",
Usage: "file path to write the task's pid",
},
cli.IntFlag{
cli.IntSliceFlag{
Name: "gpus",
Usage: "add gpus to the container",
},

View File

@@ -251,7 +251,7 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
}))
}
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") {
opts = append(opts, oci.WithNewPrivileges)