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

Add changes for usage of nvsandboxutils #629

Merged
merged 5 commits into from
Sep 25, 2024

Conversation

sananya12
Copy link
Contributor

@sananya12 sananya12 commented Aug 5, 2024

This request adds all the changes related to the usage of the new library libnvidia-sandboxutils (Sandboxutils) to obtain the file system information in CDI spec generation.

@sananya12 sananya12 force-pushed the nvsandboxutils-sananya branch from fa059e6 to 4a6f079 Compare August 6, 2024 17:27
@sananya12 sananya12 changed the title Add changes for usage of nvsandboxutils [WIP] Add changes for usage of nvsandboxutils Aug 6, 2024
@sananya12 sananya12 force-pushed the nvsandboxutils-sananya branch from 4cc7018 to 0953627 Compare August 22, 2024 00:26
@sananya12 sananya12 changed the title [WIP] Add changes for usage of nvsandboxutils Add changes for usage of nvsandboxutils Aug 22, 2024
@elezar elezar self-requested a review August 27, 2024 07:44
@elezar elezar self-assigned this Aug 27, 2024
Copy link
Member

@elezar elezar left a comment

Choose a reason for hiding this comment

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

Thanks @sananya12.

I have some minor comments. I don't think any of them are blockers for getting this merged though.

internal/nvsandboxutils/gpu-resources.go Outdated Show resolved Hide resolved
internal/nvsandboxutils/gpu-resources.go Show resolved Hide resolved
pkg/nvcdi/lib.go Show resolved Hide resolved
internal/platform-support/dgpu/dgpu.go Outdated Show resolved Hide resolved
@sananya12 sananya12 force-pushed the nvsandboxutils-sananya branch from 0953627 to 8dc67b7 Compare August 28, 2024 07:02
@sananya12 sananya12 force-pushed the nvsandboxutils-sananya branch from 8dc67b7 to 4e1d772 Compare September 17, 2024 05:37
This change adds a script and related files to generate the internal
bindings for Sandboxutils library with the help of c-for-go.
This can be used to update the bindings when the header file is modified
with reference to how they are generated with the Makefile in go-nvml.

Run: ./update-bindings.sh

Signed-off-by: Evan Lezar <[email protected]>
Signed-off-by: Huy Nguyen <[email protected]>
Signed-off-by: Sananya Majumder <[email protected]>
This change adds the internal bindings for Sandboxutils, some of which
have been automatically generated with the help of c-for-go. The format
followed is similar to what is used in go-nvml. These would need to be
regenerated when the header file is modified and new APIs are added.

Signed-off-by: Evan Lezar <[email protected]>
Signed-off-by: Huy Nguyen <[email protected]>
Signed-off-by: Sananya Majumder <[email protected]>
This change adds manual wrappers around the generated bindings to make
them into more user-friendly APIs for the caller. Some helper functions
are also added.
The APIs that are currently present in the library and implemented here
are:
nvSandboxUtilsInit
nvSandboxUtilsShutdown
nvSandboxUtilsGetDriverVersion
nvSandboxUtilsGetGpuResource
nvSandboxUtilsGetFileContent

Signed-off-by: Evan Lezar <[email protected]>
Signed-off-by: Huy Nguyen <[email protected]>
Signed-off-by: Sananya Majumder <[email protected]>
This change includes the usage of Sandboxutils GetDriverVersion API to
retrieve the CUDA driver version. If the library is not available on the
system or the API call fails for some other reason, it will fallback to
the NVML API to return the driver version.

Signed-off-by: Evan Lezar <[email protected]>
Signed-off-by: Huy Nguyen <[email protected]>
Signed-off-by: Sananya Majumder <[email protected]>
This change adds a new discoverer for Sandboxutils to report the file
system paths and associated symbolic links using GetGpuResource and
GetFileContent APIs. Both GPU and MIG devices are supported. If the
Sandboxutils discoverer fails, the NVML discoverer is used to report
the file system information.

Signed-off-by: Evan Lezar <[email protected]>
Signed-off-by: Huy Nguyen <[email protected]>
Signed-off-by: Sananya Majumder <[email protected]>
@sananya12 sananya12 force-pushed the nvsandboxutils-sananya branch from c4d12b7 to 563db0e Compare September 24, 2024 17:13
@elezar elezar merged commit 0e68f60 into NVIDIA:main Sep 25, 2024
8 checks passed
@sananya12 sananya12 deleted the nvsandboxutils-sananya branch September 25, 2024 17:18
@sananya12 sananya12 restored the nvsandboxutils-sananya branch September 25, 2024 20:43
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.

2 participants