Update to go-nvlib v0.3.0 and go-nvml v0.12.0-4

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar
2024-04-18 15:01:03 +02:00
parent ddeeca392c
commit 2019cd6f0a
56 changed files with 28425 additions and 5824 deletions

View File

@@ -25,7 +25,7 @@ import (
"github.com/NVIDIA/go-nvml/pkg/dl"
)
// Interface provides the API to the info package
// Interface provides the API to the info package.
type Interface interface {
HasDXCore() (bool, string)
HasNvml() (bool, string)
@@ -50,7 +50,7 @@ func (i *infolib) HasDXCore() (bool, string) {
return true, "found DXCore library"
}
// HasNvml returns true if NVML is detected on the system
// HasNvml returns true if NVML is detected on the system.
func (i *infolib) HasNvml() (bool, string) {
const (
libraryName = "libnvidia-ml.so.1"
@@ -62,7 +62,7 @@ func (i *infolib) HasNvml() (bool, string) {
return true, "found NVML library"
}
// IsTegraSystem returns true if the system is detected as a Tegra-based system
// IsTegraSystem returns true if the system is detected as a Tegra-based system.
func (i *infolib) IsTegraSystem() (bool, string) {
tegraReleaseFile := filepath.Join(i.root, "/etc/nv_tegra_release")
tegraFamilyFile := filepath.Join(i.root, "/sys/devices/soc0/family")
@@ -87,7 +87,7 @@ func (i *infolib) IsTegraSystem() (bool, string) {
return false, fmt.Sprintf("%v has no 'tegra' prefix", tegraFamilyFile)
}
// assertHasLibrary returns an error if the specified library cannot be loaded
// assertHasLibrary returns an error if the specified library cannot be loaded.
func assertHasLibrary(libraryName string) error {
const (
libraryLoadFlags = dl.RTLD_LAZY

View File

@@ -16,10 +16,10 @@
package info
// Option defines a function for passing options to the New() call
// Option defines a function for passing options to the New() call.
type Option func(*infolib)
// New creates a new instance of the 'info' interface
// New creates a new instance of the 'info' interface.
func New(opts ...Option) Interface {
i := &infolib{}
for _, opt := range opts {
@@ -31,7 +31,7 @@ func New(opts ...Option) Interface {
return i
}
// WithRoot provides a Option to set the root of the 'info' interface
// WithRoot provides a Option to set the root of the 'info' interface.
func WithRoot(root string) Option {
return func(i *infolib) {
i.root = root