Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cmd/ctr/commands/run/run_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
containerd "github.com/containerd/containerd/v2/client"
"github.com/containerd/containerd/v2/cmd/ctr/commands"
"github.com/containerd/containerd/v2/contrib/apparmor"
"github.com/containerd/containerd/v2/contrib/nvidia"
"github.com/containerd/containerd/v2/contrib/seccomp"
"github.com/containerd/containerd/v2/core/containers"
"github.com/containerd/containerd/v2/core/diff"
Expand Down Expand Up @@ -354,8 +353,12 @@ func NewContainer(ctx context.Context, client *containerd.Client, cliContext *cl
Path: nsPath,
}))
}
var cdiDeviceIDs []string
if cliContext.IsSet("gpus") {
opts = append(opts, nvidia.WithGPUs(nvidia.WithDevices(cliContext.IntSlice("gpus")...), nvidia.WithAllCapabilities))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mxpv would you prefer that this be opt-out? (I wanted to ask that before removing the code that this calls).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I have assumed that we don't want to make this opt-out. I have removed the code that is unreachable with this change).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have any backward compatibility promise for contrib/ and we no longer use it in the codebase, so it should be fine to remove it I think.

for _, id := range cliContext.IntSlice("gpus") {
cdiDeviceID := fmt.Sprintf("nvidia.com/gpu=%d", id)
cdiDeviceIDs = append(cdiDeviceIDs, cdiDeviceID)
}
}
if cliContext.IsSet("allow-new-privs") {
opts = append(opts, oci.WithNewPrivileges)
Expand All @@ -368,7 +371,6 @@ func NewContainer(ctx context.Context, client *containerd.Client, cliContext *cl
if limit != 0 {
opts = append(opts, oci.WithMemoryLimit(limit))
}
var cdiDeviceIDs []string
for _, dev := range cliContext.StringSlice("device") {
if parser.IsQualifiedName(dev) {
cdiDeviceIDs = append(cdiDeviceIDs, dev)
Expand Down
221 changes: 0 additions & 221 deletions contrib/nvidia/nvidia.go

This file was deleted.