Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cdi mode resolution #428

Merged
merged 2 commits into from
May 21, 2024
Merged

Fix cdi mode resolution #428

merged 2 commits into from
May 21, 2024

Conversation

elezar
Copy link
Member

@elezar elezar commented Mar 26, 2024

This change incorporates the changes from NVIDIA/go-nvlib#28 to make the mode resolution consistent.

This ensures that CDI spec generation works on Tegra-based systems where nvml is present.

switch nvinfo.ResolvePlatform() {
case info.PlatformNVML, info.PlatformWSL:
return "legacy"
case info.PlatformTegra:
Copy link
Contributor

Choose a reason for hiding this comment

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

Question -- this case aligns with the original conditional because usesNVGPUModule will only be true on a Tegra platform, correct?

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, the logic for checking the use of the nvgpu module has been pulled into the platform check. PlatformTegra now means that either the Tegra sysfs files are present and NVML is not, or NVML is present and the nvgpu module is used.

@elezar elezar marked this pull request as ready for review May 21, 2024 10:04
Copy link
Collaborator

@ArangoGutierrez ArangoGutierrez left a comment

Choose a reason for hiding this comment

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

Just a couple comments, looks good

pkg/nvcdi/lib.go Outdated
@@ -180,30 +185,23 @@ func (m *wrapper) GetCommonEdits() (*cdi.ContainerEdits, error) {

// resolveMode resolves the mode for CDI spec generation based on the current system.
func (l *nvcdilib) resolveMode() (rmode string) {
if l.mode != ModeAuto {
if l.mode != "auto" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why moving away from a const var, isn't that preferred?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated.

@@ -23,6 +23,8 @@ import (
testlog "github.com/sirupsen/logrus/hooks/test"
"github.com/stretchr/testify/require"

"github.com/NVIDIA/go-nvlib/pkg/nvlib/info"

Copy link
Collaborator

Choose a reason for hiding this comment

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

is this extra line wanted/needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right. It isn't.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Copy link
Collaborator

@ArangoGutierrez ArangoGutierrez left a comment

Choose a reason for hiding this comment

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

Looks good to me

@elezar elezar merged commit edda11d into NVIDIA:main May 21, 2024
8 checks passed
@elezar elezar deleted the fix-cdi-mode-resolution branch May 21, 2024 11:22
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.

None yet

3 participants