Skip to content

Commit 09d78bb

Browse files
committed
allow multi gpu to be specified via ctr
Signed-off-by: Michael Crosby <[email protected]>
1 parent c7e4747 commit 09d78bb

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

cmd/ctr/commands/commands.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ var (
147147
Name: "pid-file",
148148
Usage: "file path to write the task's pid",
149149
},
150-
cli.IntFlag{
150+
cli.IntSliceFlag{
151151
Name: "gpus",
152152
Usage: "add gpus to the container",
153153
},

cmd/ctr/commands/run/run_unix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
250250
}))
251251
}
252252
if context.IsSet("gpus") {
253-
opts = append(opts, nvidia.WithGPUs(nvidia.WithDevices(context.Int("gpus")), nvidia.WithAllCapabilities))
253+
opts = append(opts, nvidia.WithGPUs(nvidia.WithDevices(context.IntSlice("gpus")...), nvidia.WithAllCapabilities))
254254
}
255255
if context.IsSet("allow-new-privs") {
256256
opts = append(opts, oci.WithNewPrivileges)

0 commit comments

Comments
 (0)