Skip to content

Conversation

@elezar
Copy link
Member

@elezar elezar commented Oct 14, 2024

This allows IMEX channels to be requested as volume mounts in addition to the NVIDIA_IMEX_CHANNELS environment variable.

See NVIDIA/k8s-device-plugin#985 where this is used in the NVIDIA Device Plugin when the deviceListStrategy is set to volume-mounts.

Copy link
Contributor

@klueska klueska left a comment

Choose a reason for hiding this comment

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

Minor comments, otherwise looks good

@elezar elezar force-pushed the imex-by-volume-mount branch from bac3e25 to b05b68c Compare October 16, 2024 12:18
@elezar elezar requested a review from klueska October 16, 2024 13:33
This change allows IMEX channels to be requested using the
volume mount mechanism.

A mount from /dev/null to /var/run/nvidia-container-devices/imex/{{ .ChannelID }}
is equivalent to including {{ .ChannelID }} in the NVIDIA_IMEX_CHANNELS
envvironment variables.

Signed-off-by: Evan Lezar <[email protected]>
@elezar elezar force-pushed the imex-by-volume-mount branch from b05b68c to 2e6712d Compare October 17, 2024 14:56
Comment on lines -123 to +133
if len(nvidia.Devices) > 0 {
args = append(args, fmt.Sprintf("--device=%s", nvidia.Devices))
if devicesString := strings.Join(nvidia.Devices, ","); len(devicesString) > 0 {
args = append(args, fmt.Sprintf("--device=%s", devicesString))
}
if len(nvidia.MigConfigDevices) > 0 {
args = append(args, fmt.Sprintf("--mig-config=%s", nvidia.MigConfigDevices))
}
if len(nvidia.MigMonitorDevices) > 0 {
args = append(args, fmt.Sprintf("--mig-monitor=%s", nvidia.MigMonitorDevices))
}
if len(nvidia.ImexChannels) > 0 {
args = append(args, fmt.Sprintf("--imex-channel=%s", nvidia.ImexChannels))
if imexString := strings.Join(nvidia.ImexChannels, ","); len(imexString) > 0 {
args = append(args, fmt.Sprintf("--imex-channel=%s", imexString))
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor comment -- not worth fixing in this PR -- but it would be nice to keep all of these consistent -- MigConfigDevices and MigMonitorDevices are still just strings rather than a list it looks like...

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. I will update in a follow-up.

@elezar elezar merged commit 2987c4d into NVIDIA:main Oct 17, 2024
10 checks passed
@elezar elezar deleted the imex-by-volume-mount branch November 7, 2024 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants