mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-26 18:18:24 +00:00
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:
4
go.mod
4
go.mod
@@ -3,8 +3,8 @@ module github.com/NVIDIA/nvidia-container-toolkit
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
github.com/NVIDIA/go-nvlib v0.2.0
|
||||
github.com/NVIDIA/go-nvml v0.12.0-3
|
||||
github.com/NVIDIA/go-nvlib v0.3.0
|
||||
github.com/NVIDIA/go-nvml v0.12.0-4
|
||||
github.com/fsnotify/fsnotify v1.7.0
|
||||
github.com/opencontainers/runtime-spec v1.2.0
|
||||
github.com/pelletier/go-toml v1.9.5
|
||||
|
||||
8
go.sum
8
go.sum
@@ -1,7 +1,7 @@
|
||||
github.com/NVIDIA/go-nvlib v0.2.0 h1:roq+SDstbP1fcy2XVH7wB2Gz2/Ud7Q+NGQYOcVITVrA=
|
||||
github.com/NVIDIA/go-nvlib v0.2.0/go.mod h1:kFuLNTyD1tF6FbRFlk+/EdUW5BrkE+v1Y3A3/9zKSjA=
|
||||
github.com/NVIDIA/go-nvml v0.12.0-3 h1:QwfjYxEqIQVRhl8327g2Y3ZvKResPydpGSKtCIIK9jE=
|
||||
github.com/NVIDIA/go-nvml v0.12.0-3/go.mod h1:SOufGc5Wql+cxrIZ8RyJwVKDYxfbs4WPkHXqadcbfvA=
|
||||
github.com/NVIDIA/go-nvlib v0.3.0 h1:vd7jSOthJTqzqIWZrv317xDr1+Mnjoy5X4N69W9YwQM=
|
||||
github.com/NVIDIA/go-nvlib v0.3.0/go.mod h1:NasUuId9hYFvwzuOHCu9F2X6oTU2tG0JHTfbJYuDAbA=
|
||||
github.com/NVIDIA/go-nvml v0.12.0-4 h1:BvPjnjJr6qje0zov57Md7TwEA8i/12kZeUQIpyWzTEE=
|
||||
github.com/NVIDIA/go-nvml v0.12.0-4/go.mod h1:8Llmj+1Rr+9VGGwZuRer5N/aCjxGuR5nPb/9ebBiIEQ=
|
||||
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
|
||||
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
|
||||
|
||||
14
vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/api.go
generated
vendored
14
vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/api.go
generated
vendored
@@ -17,10 +17,10 @@
|
||||
package device
|
||||
|
||||
import (
|
||||
"github.com/NVIDIA/go-nvlib/pkg/nvml"
|
||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
)
|
||||
|
||||
// Interface provides the API to the 'device' package
|
||||
// Interface provides the API to the 'device' package.
|
||||
type Interface interface {
|
||||
AssertValidMigProfileFormat(profile string) error
|
||||
GetDevices() ([]Device, error)
|
||||
@@ -46,7 +46,7 @@ type devicelib struct {
|
||||
|
||||
var _ Interface = &devicelib{}
|
||||
|
||||
// New creates a new instance of the 'device' interface
|
||||
// New creates a new instance of the 'device' interface.
|
||||
func New(opts ...Option) Interface {
|
||||
d := &devicelib{}
|
||||
for _, opt := range opts {
|
||||
@@ -68,21 +68,21 @@ func New(opts ...Option) Interface {
|
||||
return d
|
||||
}
|
||||
|
||||
// WithNvml provides an Option to set the NVML library used by the 'device' interface
|
||||
// WithNvml provides an Option to set the NVML library used by the 'device' interface.
|
||||
func WithNvml(nvml nvml.Interface) Option {
|
||||
return func(d *devicelib) {
|
||||
d.nvml = nvml
|
||||
}
|
||||
}
|
||||
|
||||
// WithVerifySymbols provides an option to toggle whether to verify select symbols exist in dynamic libraries before calling them
|
||||
// WithVerifySymbols provides an option to toggle whether to verify select symbols exist in dynamic libraries before calling them.
|
||||
func WithVerifySymbols(verify bool) Option {
|
||||
return func(d *devicelib) {
|
||||
d.verifySymbols = &verify
|
||||
}
|
||||
}
|
||||
|
||||
// WithSkippedDevices provides an Option to set devices to be skipped by model name
|
||||
// WithSkippedDevices provides an Option to set devices to be skipped by model name.
|
||||
func WithSkippedDevices(names ...string) Option {
|
||||
return func(d *devicelib) {
|
||||
if d.skippedDevices == nil {
|
||||
@@ -94,5 +94,5 @@ func WithSkippedDevices(names ...string) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// 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(*devicelib)
|
||||
|
||||
46
vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/device.go
generated
vendored
46
vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/device.go
generated
vendored
@@ -19,10 +19,10 @@ package device
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/NVIDIA/go-nvlib/pkg/nvml"
|
||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
)
|
||||
|
||||
// Device defines the set of extended functions associated with a device.Device
|
||||
// Device defines the set of extended functions associated with a device.Device.
|
||||
type Device interface {
|
||||
nvml.Device
|
||||
GetArchitectureAsString() (string, error)
|
||||
@@ -44,12 +44,12 @@ type device struct {
|
||||
|
||||
var _ Device = &device{}
|
||||
|
||||
// NewDevice builds a new Device from an nvml.Device
|
||||
// NewDevice builds a new Device from an nvml.Device.
|
||||
func (d *devicelib) NewDevice(dev nvml.Device) (Device, error) {
|
||||
return d.newDevice(dev)
|
||||
}
|
||||
|
||||
// NewDeviceByUUID builds a new Device from a UUID
|
||||
// NewDeviceByUUID builds a new Device from a UUID.
|
||||
func (d *devicelib) NewDeviceByUUID(uuid string) (Device, error) {
|
||||
dev, ret := d.nvml.DeviceGetHandleByUUID(uuid)
|
||||
if ret != nvml.SUCCESS {
|
||||
@@ -58,12 +58,12 @@ func (d *devicelib) NewDeviceByUUID(uuid string) (Device, error) {
|
||||
return d.newDevice(dev)
|
||||
}
|
||||
|
||||
// newDevice creates a device from an nvml.Device
|
||||
// newDevice creates a device from an nvml.Device.
|
||||
func (d *devicelib) newDevice(dev nvml.Device) (*device, error) {
|
||||
return &device{dev, d, nil}, nil
|
||||
}
|
||||
|
||||
// GetArchitectureAsString returns the Device architecture as a string
|
||||
// GetArchitectureAsString returns the Device architecture as a string.
|
||||
func (d *device) GetArchitectureAsString() (string, error) {
|
||||
arch, ret := d.GetArchitecture()
|
||||
if ret != nvml.SUCCESS {
|
||||
@@ -92,7 +92,7 @@ func (d *device) GetArchitectureAsString() (string, error) {
|
||||
return "", fmt.Errorf("error interpreting device architecture as string: %v", arch)
|
||||
}
|
||||
|
||||
// GetBrandAsString returns the Device architecture as a string
|
||||
// GetBrandAsString returns the Device architecture as a string.
|
||||
func (d *device) GetBrandAsString() (string, error) {
|
||||
brand, ret := d.GetBrand()
|
||||
if ret != nvml.SUCCESS {
|
||||
@@ -140,7 +140,7 @@ func (d *device) GetBrandAsString() (string, error) {
|
||||
return "", fmt.Errorf("error interpreting device brand as string: %v", brand)
|
||||
}
|
||||
|
||||
// GetCudaComputeCapabilityAsString returns the Device's CUDA compute capability as a version string
|
||||
// GetCudaComputeCapabilityAsString returns the Device's CUDA compute capability as a version string.
|
||||
func (d *device) GetCudaComputeCapabilityAsString() (string, error) {
|
||||
major, minor, ret := d.GetCudaComputeCapability()
|
||||
if ret != nvml.SUCCESS {
|
||||
@@ -149,7 +149,7 @@ func (d *device) GetCudaComputeCapabilityAsString() (string, error) {
|
||||
return fmt.Sprintf("%d.%d", major, minor), nil
|
||||
}
|
||||
|
||||
// IsMigCapable checks if a device is capable of having MIG paprtitions created on it
|
||||
// IsMigCapable checks if a device is capable of having MIG paprtitions created on it.
|
||||
func (d *device) IsMigCapable() (bool, error) {
|
||||
if !d.lib.hasSymbol("nvmlDeviceGetMigMode") {
|
||||
return false, nil
|
||||
@@ -166,7 +166,7 @@ func (d *device) IsMigCapable() (bool, error) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// IsMigEnabled checks if a device has MIG mode currently enabled on it
|
||||
// IsMigEnabled checks if a device has MIG mode currently enabled on it.
|
||||
func (d *device) IsMigEnabled() (bool, error) {
|
||||
if !d.lib.hasSymbol("nvmlDeviceGetMigMode") {
|
||||
return false, nil
|
||||
@@ -183,7 +183,7 @@ func (d *device) IsMigEnabled() (bool, error) {
|
||||
return (mode == nvml.DEVICE_MIG_ENABLE), nil
|
||||
}
|
||||
|
||||
// VisitMigDevices walks a top-level device and invokes a callback function for each MIG device configured on it
|
||||
// VisitMigDevices walks a top-level device and invokes a callback function for each MIG device configured on it.
|
||||
func (d *device) VisitMigDevices(visit func(int, MigDevice) error) error {
|
||||
capable, err := d.IsMigCapable()
|
||||
if err != nil {
|
||||
@@ -221,7 +221,7 @@ func (d *device) VisitMigDevices(visit func(int, MigDevice) error) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// VisitMigProfiles walks a top-level device and invokes a callback function for each unique MIG Profile that can be configured on it
|
||||
// VisitMigProfiles walks a top-level device and invokes a callback function for each unique MIG Profile that can be configured on it.
|
||||
func (d *device) VisitMigProfiles(visit func(MigProfile) error) error {
|
||||
capable, err := d.IsMigCapable()
|
||||
if err != nil {
|
||||
@@ -283,7 +283,7 @@ func (d *device) VisitMigProfiles(visit func(MigProfile) error) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMigDevices gets the set of MIG devices associated with a top-level device
|
||||
// GetMigDevices gets the set of MIG devices associated with a top-level device.
|
||||
func (d *device) GetMigDevices() ([]MigDevice, error) {
|
||||
var migs []MigDevice
|
||||
err := d.VisitMigDevices(func(j int, m MigDevice) error {
|
||||
@@ -296,7 +296,7 @@ func (d *device) GetMigDevices() ([]MigDevice, error) {
|
||||
return migs, nil
|
||||
}
|
||||
|
||||
// GetMigProfiles gets the set of unique MIG profiles associated with a top-level device
|
||||
// GetMigProfiles gets the set of unique MIG profiles associated with a top-level device.
|
||||
func (d *device) GetMigProfiles() ([]MigProfile, error) {
|
||||
// Return the cached list if available
|
||||
if d.migProfiles != nil {
|
||||
@@ -313,7 +313,7 @@ func (d *device) GetMigProfiles() ([]MigProfile, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// And cache it before returning
|
||||
// And cache it before returning.
|
||||
d.migProfiles = profiles
|
||||
return profiles, nil
|
||||
}
|
||||
@@ -332,7 +332,7 @@ func (d *device) isSkipped() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// VisitDevices visits each top-level device and invokes a callback function for it
|
||||
// VisitDevices visits each top-level device and invokes a callback function for it.
|
||||
func (d *devicelib) VisitDevices(visit func(int, Device) error) error {
|
||||
count, ret := d.nvml.DeviceGetCount()
|
||||
if ret != nvml.SUCCESS {
|
||||
@@ -365,7 +365,7 @@ func (d *devicelib) VisitDevices(visit func(int, Device) error) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// VisitMigDevices walks a top-level device and invokes a callback function for each MIG device configured on it
|
||||
// VisitMigDevices walks a top-level device and invokes a callback function for each MIG device configured on it.
|
||||
func (d *devicelib) VisitMigDevices(visit func(int, Device, int, MigDevice) error) error {
|
||||
err := d.VisitDevices(func(i int, dev Device) error {
|
||||
err := dev.VisitMigDevices(func(j int, mig MigDevice) error {
|
||||
@@ -386,7 +386,7 @@ func (d *devicelib) VisitMigDevices(visit func(int, Device, int, MigDevice) erro
|
||||
return nil
|
||||
}
|
||||
|
||||
// VisitMigProfiles walks a top-level device and invokes a callback function for each unique MIG profile found on them
|
||||
// VisitMigProfiles walks a top-level device and invokes a callback function for each unique MIG profile found on them.
|
||||
func (d *devicelib) VisitMigProfiles(visit func(MigProfile) error) error {
|
||||
visited := make(map[string]bool)
|
||||
err := d.VisitDevices(func(i int, dev Device) error {
|
||||
@@ -414,7 +414,7 @@ func (d *devicelib) VisitMigProfiles(visit func(MigProfile) error) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetDevices gets the set of all top-level devices
|
||||
// GetDevices gets the set of all top-level devices.
|
||||
func (d *devicelib) GetDevices() ([]Device, error) {
|
||||
var devs []Device
|
||||
err := d.VisitDevices(func(i int, dev Device) error {
|
||||
@@ -427,7 +427,7 @@ func (d *devicelib) GetDevices() ([]Device, error) {
|
||||
return devs, nil
|
||||
}
|
||||
|
||||
// GetMigDevices gets the set of MIG devices across all top-level devices
|
||||
// GetMigDevices gets the set of MIG devices across all top-level devices.
|
||||
func (d *devicelib) GetMigDevices() ([]MigDevice, error) {
|
||||
var migs []MigDevice
|
||||
err := d.VisitMigDevices(func(i int, dev Device, j int, m MigDevice) error {
|
||||
@@ -440,7 +440,7 @@ func (d *devicelib) GetMigDevices() ([]MigDevice, error) {
|
||||
return migs, nil
|
||||
}
|
||||
|
||||
// GetMigProfiles gets the set of unique MIG profiles across all top-level devices
|
||||
// GetMigProfiles gets the set of unique MIG profiles across all top-level devices.
|
||||
func (d *devicelib) GetMigProfiles() ([]MigProfile, error) {
|
||||
// Return the cached list if available
|
||||
if d.migProfiles != nil {
|
||||
@@ -457,7 +457,7 @@ func (d *devicelib) GetMigProfiles() ([]MigProfile, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// And cache it before returning
|
||||
// And cache it before returning.
|
||||
d.migProfiles = profiles
|
||||
return profiles, nil
|
||||
}
|
||||
@@ -469,5 +469,5 @@ func (d *devicelib) hasSymbol(symbol string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
return d.nvml.Lookup(symbol) == nil
|
||||
return d.nvml.Extensions().LookupSymbol(symbol) == nil
|
||||
}
|
||||
|
||||
12
vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/identifier.go
generated
vendored
12
vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/identifier.go
generated
vendored
@@ -27,7 +27,7 @@ import (
|
||||
// This includes a device index or UUID.
|
||||
type Identifier string
|
||||
|
||||
// IsGpuIndex checks if an identifier is a full GPU index
|
||||
// IsGpuIndex checks if an identifier is a full GPU index.
|
||||
func (i Identifier) IsGpuIndex() bool {
|
||||
if _, err := strconv.ParseUint(string(i), 10, 0); err != nil {
|
||||
return false
|
||||
@@ -35,7 +35,7 @@ func (i Identifier) IsGpuIndex() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsMigIndex checks if an identifier is a MIG index
|
||||
// IsMigIndex checks if an identifier is a MIG index.
|
||||
func (i Identifier) IsMigIndex() bool {
|
||||
split := strings.Split(string(i), ":")
|
||||
if len(split) != 2 {
|
||||
@@ -49,13 +49,13 @@ func (i Identifier) IsMigIndex() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsUUID checks if an identifier is a UUID
|
||||
// IsUUID checks if an identifier is a UUID.
|
||||
func (i Identifier) IsUUID() bool {
|
||||
return i.IsGpuUUID() || i.IsMigUUID()
|
||||
}
|
||||
|
||||
// IsGpuUUID checks if an identifier is a GPU UUID
|
||||
// A GPU UUID must be of the form GPU-b1028956-cfa2-0990-bf4a-5da9abb51763
|
||||
// IsGpuUUID checks if an identifier is a GPU UUID.
|
||||
// A GPU UUID must be of the form GPU-b1028956-cfa2-0990-bf4a-5da9abb51763.
|
||||
func (i Identifier) IsGpuUUID() bool {
|
||||
if !strings.HasPrefix(string(i), "GPU-") {
|
||||
return false
|
||||
@@ -64,7 +64,7 @@ func (i Identifier) IsGpuUUID() bool {
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// IsMigUUID checks if an identifier is a MIG UUID
|
||||
// IsMigUUID checks if an identifier is a MIG UUID.
|
||||
// A MIG UUID can be of one of two forms:
|
||||
// - MIG-b1028956-cfa2-0990-bf4a-5da9abb51763
|
||||
// - MIG-GPU-b1028956-cfa2-0990-bf4a-5da9abb51763/3/0
|
||||
|
||||
10
vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/mig_device.go
generated
vendored
10
vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/mig_device.go
generated
vendored
@@ -19,10 +19,10 @@ package device
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/NVIDIA/go-nvlib/pkg/nvml"
|
||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
)
|
||||
|
||||
// MigDevice defines the set of extended functions associated with a MIG device
|
||||
// MigDevice defines the set of extended functions associated with a MIG device.
|
||||
type MigDevice interface {
|
||||
nvml.Device
|
||||
GetProfile() (MigProfile, error)
|
||||
@@ -36,7 +36,7 @@ type migdevice struct {
|
||||
|
||||
var _ MigDevice = &migdevice{}
|
||||
|
||||
// NewMigDevice builds a new MigDevice from an nvml.Device
|
||||
// NewMigDevice builds a new MigDevice from an nvml.Device.
|
||||
func (d *devicelib) NewMigDevice(handle nvml.Device) (MigDevice, error) {
|
||||
isMig, ret := handle.IsMigDeviceHandle()
|
||||
if ret != nvml.SUCCESS {
|
||||
@@ -48,7 +48,7 @@ func (d *devicelib) NewMigDevice(handle nvml.Device) (MigDevice, error) {
|
||||
return &migdevice{handle, d, nil}, nil
|
||||
}
|
||||
|
||||
// NewMigDeviceByUUID builds a new MigDevice from a UUID
|
||||
// NewMigDeviceByUUID builds a new MigDevice from a UUID.
|
||||
func (d *devicelib) NewMigDeviceByUUID(uuid string) (MigDevice, error) {
|
||||
dev, ret := d.nvml.DeviceGetHandleByUUID(uuid)
|
||||
if ret != nvml.SUCCESS {
|
||||
@@ -57,7 +57,7 @@ func (d *devicelib) NewMigDeviceByUUID(uuid string) (MigDevice, error) {
|
||||
return d.NewMigDevice(dev)
|
||||
}
|
||||
|
||||
// GetProfile returns the MIG profile associated with a MIG device
|
||||
// GetProfile returns the MIG profile associated with a MIG device.
|
||||
func (m *migdevice) GetProfile() (MigProfile, error) {
|
||||
if m.profile != nil {
|
||||
return m.profile, nil
|
||||
|
||||
26
vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/mig_profile.go
generated
vendored
26
vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/mig_profile.go
generated
vendored
@@ -23,7 +23,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/NVIDIA/go-nvlib/pkg/nvml"
|
||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -40,7 +40,7 @@ type MigProfile interface {
|
||||
Matches(profile string) bool
|
||||
}
|
||||
|
||||
// MigProfileInfo holds all info associated with a specific MIG profile
|
||||
// MigProfileInfo holds all info associated with a specific MIG profile.
|
||||
type MigProfileInfo struct {
|
||||
C int
|
||||
G int
|
||||
@@ -119,13 +119,13 @@ func (d *devicelib) NewMigProfile(giProfileID, ciProfileID, ciEngProfileID int,
|
||||
return p, nil
|
||||
}
|
||||
|
||||
// AssertValidMigProfileFormat checks if the string is in the proper format to represent a MIG profile
|
||||
// AssertValidMigProfileFormat checks if the string is in the proper format to represent a MIG profile.
|
||||
func (d *devicelib) AssertValidMigProfileFormat(profile string) error {
|
||||
_, _, _, _, err := parseMigProfile(profile)
|
||||
return err
|
||||
}
|
||||
|
||||
// ParseMigProfile converts a string representation of a MigProfile into an object
|
||||
// ParseMigProfile converts a string representation of a MigProfile into an object.
|
||||
func (d *devicelib) ParseMigProfile(profile string) (MigProfile, error) {
|
||||
profiles, err := d.GetMigProfiles()
|
||||
if err != nil {
|
||||
@@ -141,7 +141,7 @@ func (d *devicelib) ParseMigProfile(profile string) (MigProfile, error) {
|
||||
return nil, fmt.Errorf("unable to parse profile string into a valid profile")
|
||||
}
|
||||
|
||||
// String returns the string representation of a Profile
|
||||
// String returns the string representation of a Profile.
|
||||
func (p MigProfileInfo) String() string {
|
||||
var suffix string
|
||||
if len(p.Attributes) > 0 {
|
||||
@@ -153,12 +153,12 @@ func (p MigProfileInfo) String() string {
|
||||
return fmt.Sprintf("%dc.%dg.%dgb%s", p.C, p.G, p.GB, suffix)
|
||||
}
|
||||
|
||||
// GetInfo returns detailed info about a Profile
|
||||
// GetInfo returns detailed info about a Profile.
|
||||
func (p MigProfileInfo) GetInfo() MigProfileInfo {
|
||||
return p
|
||||
}
|
||||
|
||||
// Equals checks if two Profiles are identical or not
|
||||
// Equals checks if two Profiles are identical or not.
|
||||
func (p MigProfileInfo) Equals(other MigProfile) bool {
|
||||
o := other.GetInfo()
|
||||
if p.C != o.C {
|
||||
@@ -182,7 +182,7 @@ func (p MigProfileInfo) Equals(other MigProfile) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// Matches checks if a MigProfile matches the string passed in
|
||||
// Matches checks if a MigProfile matches the string passed in.
|
||||
func (p MigProfileInfo) Matches(profile string) bool {
|
||||
c, g, gb, attrs, err := parseMigProfile(profile)
|
||||
if err != nil {
|
||||
@@ -211,26 +211,26 @@ func (p MigProfileInfo) Matches(profile string) bool {
|
||||
}
|
||||
|
||||
func parseMigProfile(profile string) (int, int, int, []string, error) {
|
||||
// If we are handed the empty string, we cannot parse it
|
||||
// If we are handed the empty string, we cannot parse it.
|
||||
if profile == "" {
|
||||
return -1, -1, -1, nil, fmt.Errorf("profile is the empty string")
|
||||
}
|
||||
|
||||
// Split by + to separate out attributes
|
||||
// Split by + to separate out attributes.
|
||||
split := strings.SplitN(profile, "+", 2)
|
||||
|
||||
// Check to make sure the c, g, and gb values match
|
||||
// Check to make sure the c, g, and gb values match.
|
||||
c, g, gb, err := parseMigProfileFields(split[0])
|
||||
if err != nil {
|
||||
return -1, -1, -1, nil, fmt.Errorf("cannot parse fields of '%v': %v", profile, err)
|
||||
}
|
||||
|
||||
// If we have no attributes we are done
|
||||
// If we have no attributes we are done.
|
||||
if len(split) == 1 {
|
||||
return c, g, gb, nil, nil
|
||||
}
|
||||
|
||||
// Make sure we have the same set of attributes
|
||||
// Make sure we have the same set of attributes.
|
||||
attrs, err := parseMigProfileAttributes(split[1])
|
||||
if err != nil {
|
||||
return -1, -1, -1, nil, fmt.Errorf("cannot parse attributes of '%v': %v", profile, err)
|
||||
|
||||
8
vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/info/info.go
generated
vendored
8
vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/info/info.go
generated
vendored
@@ -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
|
||||
|
||||
6
vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/info/options.go
generated
vendored
6
vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/info/options.go
generated
vendored
@@ -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
|
||||
|
||||
44
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/ci.go
generated
vendored
44
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/ci.go
generated
vendored
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package nvml
|
||||
|
||||
import (
|
||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
)
|
||||
|
||||
type nvmlComputeInstance nvml.ComputeInstance
|
||||
|
||||
var _ ComputeInstance = (*nvmlComputeInstance)(nil)
|
||||
|
||||
// GetInfo() returns info about a Compute Instance
|
||||
func (ci nvmlComputeInstance) GetInfo() (ComputeInstanceInfo, Return) {
|
||||
i, r := nvml.ComputeInstance(ci).GetInfo()
|
||||
info := ComputeInstanceInfo{
|
||||
Device: nvmlDevice(i.Device),
|
||||
GpuInstance: nvmlGpuInstance(i.GpuInstance),
|
||||
Id: i.Id,
|
||||
ProfileId: i.ProfileId,
|
||||
Placement: ComputeInstancePlacement(i.Placement),
|
||||
}
|
||||
return info, Return(r)
|
||||
}
|
||||
|
||||
// Destroy() destroys a Compute Instance
|
||||
func (ci nvmlComputeInstance) Destroy() Return {
|
||||
r := nvml.ComputeInstance(ci).Destroy()
|
||||
return Return(r)
|
||||
}
|
||||
163
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/consts.go
generated
vendored
163
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/consts.go
generated
vendored
@@ -1,163 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package nvml
|
||||
|
||||
import (
|
||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
)
|
||||
|
||||
// General untyped constants
|
||||
const (
|
||||
NVLINK_MAX_LINKS = nvml.NVLINK_MAX_LINKS
|
||||
)
|
||||
|
||||
// Return constants
|
||||
const (
|
||||
SUCCESS = Return(nvml.SUCCESS)
|
||||
ERROR_UNINITIALIZED = Return(nvml.ERROR_UNINITIALIZED)
|
||||
ERROR_INVALID_ARGUMENT = Return(nvml.ERROR_INVALID_ARGUMENT)
|
||||
ERROR_NOT_SUPPORTED = Return(nvml.ERROR_NOT_SUPPORTED)
|
||||
ERROR_NO_PERMISSION = Return(nvml.ERROR_NO_PERMISSION)
|
||||
ERROR_ALREADY_INITIALIZED = Return(nvml.ERROR_ALREADY_INITIALIZED)
|
||||
ERROR_NOT_FOUND = Return(nvml.ERROR_NOT_FOUND)
|
||||
ERROR_INSUFFICIENT_SIZE = Return(nvml.ERROR_INSUFFICIENT_SIZE)
|
||||
ERROR_INSUFFICIENT_POWER = Return(nvml.ERROR_INSUFFICIENT_POWER)
|
||||
ERROR_DRIVER_NOT_LOADED = Return(nvml.ERROR_DRIVER_NOT_LOADED)
|
||||
ERROR_TIMEOUT = Return(nvml.ERROR_TIMEOUT)
|
||||
ERROR_IRQ_ISSUE = Return(nvml.ERROR_IRQ_ISSUE)
|
||||
ERROR_LIBRARY_NOT_FOUND = Return(nvml.ERROR_LIBRARY_NOT_FOUND)
|
||||
ERROR_FUNCTION_NOT_FOUND = Return(nvml.ERROR_FUNCTION_NOT_FOUND)
|
||||
ERROR_CORRUPTED_INFOROM = Return(nvml.ERROR_CORRUPTED_INFOROM)
|
||||
ERROR_GPU_IS_LOST = Return(nvml.ERROR_GPU_IS_LOST)
|
||||
ERROR_RESET_REQUIRED = Return(nvml.ERROR_RESET_REQUIRED)
|
||||
ERROR_OPERATING_SYSTEM = Return(nvml.ERROR_OPERATING_SYSTEM)
|
||||
ERROR_LIB_RM_VERSION_MISMATCH = Return(nvml.ERROR_LIB_RM_VERSION_MISMATCH)
|
||||
ERROR_IN_USE = Return(nvml.ERROR_IN_USE)
|
||||
ERROR_MEMORY = Return(nvml.ERROR_MEMORY)
|
||||
ERROR_NO_DATA = Return(nvml.ERROR_NO_DATA)
|
||||
ERROR_VGPU_ECC_NOT_SUPPORTED = Return(nvml.ERROR_VGPU_ECC_NOT_SUPPORTED)
|
||||
ERROR_INSUFFICIENT_RESOURCES = Return(nvml.ERROR_INSUFFICIENT_RESOURCES)
|
||||
ERROR_UNKNOWN = Return(nvml.ERROR_UNKNOWN)
|
||||
)
|
||||
|
||||
// Device architecture constants
|
||||
const (
|
||||
DEVICE_ARCH_KEPLER = nvml.DEVICE_ARCH_KEPLER
|
||||
DEVICE_ARCH_MAXWELL = nvml.DEVICE_ARCH_MAXWELL
|
||||
DEVICE_ARCH_PASCAL = nvml.DEVICE_ARCH_PASCAL
|
||||
DEVICE_ARCH_VOLTA = nvml.DEVICE_ARCH_VOLTA
|
||||
DEVICE_ARCH_TURING = nvml.DEVICE_ARCH_TURING
|
||||
DEVICE_ARCH_AMPERE = nvml.DEVICE_ARCH_AMPERE
|
||||
DEVICE_ARCH_ADA = nvml.DEVICE_ARCH_ADA
|
||||
DEVICE_ARCH_HOPPER = nvml.DEVICE_ARCH_HOPPER
|
||||
DEVICE_ARCH_UNKNOWN = nvml.DEVICE_ARCH_UNKNOWN
|
||||
)
|
||||
|
||||
// Device brand constants
|
||||
const (
|
||||
BRAND_UNKNOWN = BrandType(nvml.BRAND_UNKNOWN)
|
||||
BRAND_QUADRO = BrandType(nvml.BRAND_QUADRO)
|
||||
BRAND_TESLA = BrandType(nvml.BRAND_TESLA)
|
||||
BRAND_NVS = BrandType(nvml.BRAND_NVS)
|
||||
BRAND_GRID = BrandType(nvml.BRAND_GRID)
|
||||
BRAND_GEFORCE = BrandType(nvml.BRAND_GEFORCE)
|
||||
BRAND_TITAN = BrandType(nvml.BRAND_TITAN)
|
||||
BRAND_NVIDIA_VAPPS = BrandType(nvml.BRAND_NVIDIA_VAPPS)
|
||||
BRAND_NVIDIA_VPC = BrandType(nvml.BRAND_NVIDIA_VPC)
|
||||
BRAND_NVIDIA_VCS = BrandType(nvml.BRAND_NVIDIA_VCS)
|
||||
BRAND_NVIDIA_VWS = BrandType(nvml.BRAND_NVIDIA_VWS)
|
||||
BRAND_NVIDIA_CLOUD_GAMING = BrandType(nvml.BRAND_NVIDIA_CLOUD_GAMING)
|
||||
BRAND_NVIDIA_VGAMING = BrandType(nvml.BRAND_NVIDIA_VGAMING)
|
||||
BRAND_QUADRO_RTX = BrandType(nvml.BRAND_QUADRO_RTX)
|
||||
BRAND_NVIDIA_RTX = BrandType(nvml.BRAND_NVIDIA_RTX)
|
||||
BRAND_NVIDIA = BrandType(nvml.BRAND_NVIDIA)
|
||||
BRAND_GEFORCE_RTX = BrandType(nvml.BRAND_GEFORCE_RTX)
|
||||
BRAND_TITAN_RTX = BrandType(nvml.BRAND_TITAN_RTX)
|
||||
BRAND_COUNT = BrandType(nvml.BRAND_COUNT)
|
||||
)
|
||||
|
||||
// MIG Mode constants
|
||||
const (
|
||||
DEVICE_MIG_ENABLE = nvml.DEVICE_MIG_ENABLE
|
||||
DEVICE_MIG_DISABLE = nvml.DEVICE_MIG_DISABLE
|
||||
)
|
||||
|
||||
// GPU Instance Profiles
|
||||
const (
|
||||
GPU_INSTANCE_PROFILE_1_SLICE = nvml.GPU_INSTANCE_PROFILE_1_SLICE
|
||||
GPU_INSTANCE_PROFILE_2_SLICE = nvml.GPU_INSTANCE_PROFILE_2_SLICE
|
||||
GPU_INSTANCE_PROFILE_3_SLICE = nvml.GPU_INSTANCE_PROFILE_3_SLICE
|
||||
GPU_INSTANCE_PROFILE_4_SLICE = nvml.GPU_INSTANCE_PROFILE_4_SLICE
|
||||
GPU_INSTANCE_PROFILE_6_SLICE = nvml.GPU_INSTANCE_PROFILE_6_SLICE
|
||||
GPU_INSTANCE_PROFILE_7_SLICE = nvml.GPU_INSTANCE_PROFILE_7_SLICE
|
||||
GPU_INSTANCE_PROFILE_8_SLICE = nvml.GPU_INSTANCE_PROFILE_8_SLICE
|
||||
GPU_INSTANCE_PROFILE_1_SLICE_REV1 = nvml.GPU_INSTANCE_PROFILE_1_SLICE_REV1
|
||||
GPU_INSTANCE_PROFILE_1_SLICE_REV2 = nvml.GPU_INSTANCE_PROFILE_1_SLICE_REV2
|
||||
GPU_INSTANCE_PROFILE_2_SLICE_REV1 = nvml.GPU_INSTANCE_PROFILE_2_SLICE_REV1
|
||||
GPU_INSTANCE_PROFILE_COUNT = nvml.GPU_INSTANCE_PROFILE_COUNT
|
||||
)
|
||||
|
||||
// Compute Instance Profiles
|
||||
const (
|
||||
COMPUTE_INSTANCE_PROFILE_1_SLICE = nvml.COMPUTE_INSTANCE_PROFILE_1_SLICE
|
||||
COMPUTE_INSTANCE_PROFILE_2_SLICE = nvml.COMPUTE_INSTANCE_PROFILE_2_SLICE
|
||||
COMPUTE_INSTANCE_PROFILE_3_SLICE = nvml.COMPUTE_INSTANCE_PROFILE_3_SLICE
|
||||
COMPUTE_INSTANCE_PROFILE_4_SLICE = nvml.COMPUTE_INSTANCE_PROFILE_4_SLICE
|
||||
COMPUTE_INSTANCE_PROFILE_6_SLICE = nvml.COMPUTE_INSTANCE_PROFILE_6_SLICE
|
||||
COMPUTE_INSTANCE_PROFILE_7_SLICE = nvml.COMPUTE_INSTANCE_PROFILE_7_SLICE
|
||||
COMPUTE_INSTANCE_PROFILE_8_SLICE = nvml.COMPUTE_INSTANCE_PROFILE_8_SLICE
|
||||
COMPUTE_INSTANCE_PROFILE_1_SLICE_REV1 = nvml.COMPUTE_INSTANCE_PROFILE_1_SLICE_REV1
|
||||
COMPUTE_INSTANCE_PROFILE_COUNT = nvml.COMPUTE_INSTANCE_PROFILE_COUNT
|
||||
)
|
||||
|
||||
// Compute Instance Engine Profiles
|
||||
const (
|
||||
COMPUTE_INSTANCE_ENGINE_PROFILE_SHARED = nvml.COMPUTE_INSTANCE_ENGINE_PROFILE_SHARED
|
||||
COMPUTE_INSTANCE_ENGINE_PROFILE_COUNT = nvml.COMPUTE_INSTANCE_ENGINE_PROFILE_COUNT
|
||||
)
|
||||
|
||||
// Event Types
|
||||
const (
|
||||
EventTypeXidCriticalError = nvml.EventTypeXidCriticalError
|
||||
EventTypeSingleBitEccError = nvml.EventTypeSingleBitEccError
|
||||
EventTypeDoubleBitEccError = nvml.EventTypeDoubleBitEccError
|
||||
)
|
||||
|
||||
// GPU Topology enumeration
|
||||
const (
|
||||
TOPOLOGY_INTERNAL = GpuTopologyLevel(nvml.TOPOLOGY_INTERNAL)
|
||||
TOPOLOGY_SINGLE = GpuTopologyLevel(nvml.TOPOLOGY_SINGLE)
|
||||
TOPOLOGY_MULTIPLE = GpuTopologyLevel(nvml.TOPOLOGY_MULTIPLE)
|
||||
TOPOLOGY_HOSTBRIDGE = GpuTopologyLevel(nvml.TOPOLOGY_HOSTBRIDGE)
|
||||
TOPOLOGY_NODE = GpuTopologyLevel(nvml.TOPOLOGY_NODE)
|
||||
TOPOLOGY_SYSTEM = GpuTopologyLevel(nvml.TOPOLOGY_SYSTEM)
|
||||
)
|
||||
|
||||
// Generic enable/disable constants
|
||||
const (
|
||||
FEATURE_DISABLED = EnableState(nvml.FEATURE_DISABLED)
|
||||
FEATURE_ENABLED = EnableState(nvml.FEATURE_ENABLED)
|
||||
)
|
||||
|
||||
// Compute mode constants
|
||||
const (
|
||||
COMPUTEMODE_DEFAULT = ComputeMode(nvml.COMPUTEMODE_DEFAULT)
|
||||
COMPUTEMODE_EXCLUSIVE_THREAD = ComputeMode(nvml.COMPUTEMODE_EXCLUSIVE_THREAD)
|
||||
COMPUTEMODE_PROHIBITED = ComputeMode(nvml.COMPUTEMODE_PROHIBITED)
|
||||
COMPUTEMODE_EXCLUSIVE_PROCESS = ComputeMode(nvml.COMPUTEMODE_EXCLUSIVE_PROCESS)
|
||||
COMPUTEMODE_COUNT = ComputeMode(nvml.COMPUTEMODE_COUNT)
|
||||
)
|
||||
215
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/device.go
generated
vendored
215
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/device.go
generated
vendored
@@ -1,215 +0,0 @@
|
||||
/**
|
||||
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
**/
|
||||
|
||||
package nvml
|
||||
|
||||
import "github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
|
||||
type nvmlDevice nvml.Device
|
||||
|
||||
var _ Device = (*nvmlDevice)(nil)
|
||||
|
||||
// nvmlDeviceHandle returns a pointer to the underlying device.
|
||||
func (d nvmlDevice) nvmlDeviceHandle() *nvml.Device {
|
||||
return (*nvml.Device)(&d)
|
||||
}
|
||||
|
||||
// GetIndex returns the index of a Device
|
||||
func (d nvmlDevice) GetIndex() (int, Return) {
|
||||
i, r := nvml.Device(d).GetIndex()
|
||||
return i, Return(r)
|
||||
}
|
||||
|
||||
// GetPciInfo returns the PCI info of a Device
|
||||
func (d nvmlDevice) GetPciInfo() (PciInfo, Return) {
|
||||
p, r := nvml.Device(d).GetPciInfo()
|
||||
return PciInfo(p), Return(r)
|
||||
}
|
||||
|
||||
// GetMemoryInfo returns the memory info of a Device
|
||||
func (d nvmlDevice) GetMemoryInfo() (Memory, Return) {
|
||||
p, r := nvml.Device(d).GetMemoryInfo()
|
||||
return Memory(p), Return(r)
|
||||
}
|
||||
|
||||
// GetUUID returns the UUID of a Device
|
||||
func (d nvmlDevice) GetUUID() (string, Return) {
|
||||
u, r := nvml.Device(d).GetUUID()
|
||||
return u, Return(r)
|
||||
}
|
||||
|
||||
// GetMinorNumber returns the minor number of a Device
|
||||
func (d nvmlDevice) GetMinorNumber() (int, Return) {
|
||||
m, r := nvml.Device(d).GetMinorNumber()
|
||||
return m, Return(r)
|
||||
}
|
||||
|
||||
// IsMigDeviceHandle returns whether a Device is a MIG device or not
|
||||
func (d nvmlDevice) IsMigDeviceHandle() (bool, Return) {
|
||||
b, r := nvml.Device(d).IsMigDeviceHandle()
|
||||
return b, Return(r)
|
||||
}
|
||||
|
||||
// GetDeviceHandleFromMigDeviceHandle returns the parent Device of a MIG device
|
||||
func (d nvmlDevice) GetDeviceHandleFromMigDeviceHandle() (Device, Return) {
|
||||
p, r := nvml.Device(d).GetDeviceHandleFromMigDeviceHandle()
|
||||
return nvmlDevice(p), Return(r)
|
||||
}
|
||||
|
||||
// SetMigMode sets the MIG mode of a Device
|
||||
func (d nvmlDevice) SetMigMode(mode int) (Return, Return) {
|
||||
r1, r2 := nvml.Device(d).SetMigMode(mode)
|
||||
return Return(r1), Return(r2)
|
||||
}
|
||||
|
||||
// GetMigMode returns the MIG mode of a Device
|
||||
func (d nvmlDevice) GetMigMode() (int, int, Return) {
|
||||
s1, s2, r := nvml.Device(d).GetMigMode()
|
||||
return s1, s2, Return(r)
|
||||
}
|
||||
|
||||
// GetGpuInstanceById returns the GPU Instance associated with a particular ID
|
||||
func (d nvmlDevice) GetGpuInstanceById(id int) (GpuInstance, Return) {
|
||||
gi, r := nvml.Device(d).GetGpuInstanceById(id)
|
||||
return nvmlGpuInstance(gi), Return(r)
|
||||
}
|
||||
|
||||
// GetGpuInstanceProfileInfo returns the profile info of a GPU Instance
|
||||
func (d nvmlDevice) GetGpuInstanceProfileInfo(profile int) (GpuInstanceProfileInfo, Return) {
|
||||
p, r := nvml.Device(d).GetGpuInstanceProfileInfo(profile)
|
||||
return GpuInstanceProfileInfo(p), Return(r)
|
||||
}
|
||||
|
||||
// GetGpuInstancePossiblePlacements returns the possible placements of a GPU Instance
|
||||
func (d nvmlDevice) GetGpuInstancePossiblePlacements(info *GpuInstanceProfileInfo) ([]GpuInstancePlacement, Return) {
|
||||
nvmlPlacements, r := nvml.Device(d).GetGpuInstancePossiblePlacements((*nvml.GpuInstanceProfileInfo)(info))
|
||||
var placements []GpuInstancePlacement
|
||||
for _, p := range nvmlPlacements {
|
||||
placements = append(placements, GpuInstancePlacement(p))
|
||||
}
|
||||
return placements, Return(r)
|
||||
}
|
||||
|
||||
// GetGpuInstances returns the set of GPU Instances associated with a Device
|
||||
func (d nvmlDevice) GetGpuInstances(info *GpuInstanceProfileInfo) ([]GpuInstance, Return) {
|
||||
nvmlGis, r := nvml.Device(d).GetGpuInstances((*nvml.GpuInstanceProfileInfo)(info))
|
||||
var gis []GpuInstance
|
||||
for _, gi := range nvmlGis {
|
||||
gis = append(gis, nvmlGpuInstance(gi))
|
||||
}
|
||||
return gis, Return(r)
|
||||
}
|
||||
|
||||
// CreateGpuInstanceWithPlacement creates a GPU Instance with a specific placement
|
||||
func (d nvmlDevice) CreateGpuInstanceWithPlacement(info *GpuInstanceProfileInfo, placement *GpuInstancePlacement) (GpuInstance, Return) {
|
||||
gi, r := nvml.Device(d).CreateGpuInstanceWithPlacement((*nvml.GpuInstanceProfileInfo)(info), (*nvml.GpuInstancePlacement)(placement))
|
||||
return nvmlGpuInstance(gi), Return(r)
|
||||
}
|
||||
|
||||
// GetMaxMigDeviceCount returns the maximum number of MIG devices that can be created on a Device
|
||||
func (d nvmlDevice) GetMaxMigDeviceCount() (int, Return) {
|
||||
m, r := nvml.Device(d).GetMaxMigDeviceCount()
|
||||
return m, Return(r)
|
||||
}
|
||||
|
||||
// GetMigDeviceHandleByIndex returns the handle to a MIG device given its index
|
||||
func (d nvmlDevice) GetMigDeviceHandleByIndex(Index int) (Device, Return) {
|
||||
h, r := nvml.Device(d).GetMigDeviceHandleByIndex(Index)
|
||||
return nvmlDevice(h), Return(r)
|
||||
}
|
||||
|
||||
// GetGpuInstanceId returns the GPU Instance ID of a MIG device
|
||||
func (d nvmlDevice) GetGpuInstanceId() (int, Return) {
|
||||
gi, r := nvml.Device(d).GetGpuInstanceId()
|
||||
return gi, Return(r)
|
||||
}
|
||||
|
||||
// GetComputeInstanceId returns the Compute Instance ID of a MIG device
|
||||
func (d nvmlDevice) GetComputeInstanceId() (int, Return) {
|
||||
ci, r := nvml.Device(d).GetComputeInstanceId()
|
||||
return ci, Return(r)
|
||||
}
|
||||
|
||||
// GetCudaComputeCapability returns the compute capability major and minor versions for a device
|
||||
func (d nvmlDevice) GetCudaComputeCapability() (int, int, Return) {
|
||||
major, minor, r := nvml.Device(d).GetCudaComputeCapability()
|
||||
return major, minor, Return(r)
|
||||
}
|
||||
|
||||
// GetAttributes returns the device attributes for a MIG device
|
||||
func (d nvmlDevice) GetAttributes() (DeviceAttributes, Return) {
|
||||
a, r := nvml.Device(d).GetAttributes()
|
||||
return DeviceAttributes(a), Return(r)
|
||||
}
|
||||
|
||||
// GetName returns the product name of a Device
|
||||
func (d nvmlDevice) GetName() (string, Return) {
|
||||
n, r := nvml.Device(d).GetName()
|
||||
return n, Return(r)
|
||||
}
|
||||
|
||||
// GetBrand returns the brand of a Device
|
||||
func (d nvmlDevice) GetBrand() (BrandType, Return) {
|
||||
b, r := nvml.Device(d).GetBrand()
|
||||
return BrandType(b), Return(r)
|
||||
}
|
||||
|
||||
// GetArchitecture returns the architecture of a Device
|
||||
func (d nvmlDevice) GetArchitecture() (DeviceArchitecture, Return) {
|
||||
a, r := nvml.Device(d).GetArchitecture()
|
||||
return DeviceArchitecture(a), Return(r)
|
||||
}
|
||||
|
||||
// RegisterEvents registers the specified event set and type with the device
|
||||
func (d nvmlDevice) RegisterEvents(EventTypes uint64, Set EventSet) Return {
|
||||
return Return(nvml.Device(d).RegisterEvents(EventTypes, nvml.EventSet(Set)))
|
||||
}
|
||||
|
||||
// GetSupportedEventTypes returns the events supported by the device
|
||||
func (d nvmlDevice) GetSupportedEventTypes() (uint64, Return) {
|
||||
e, r := nvml.Device(d).GetSupportedEventTypes()
|
||||
return e, Return(r)
|
||||
}
|
||||
|
||||
// GetTopologyCommonAncestor retrieves the common ancestor for two devices.
|
||||
func (d nvmlDevice) GetTopologyCommonAncestor(o Device) (GpuTopologyLevel, Return) {
|
||||
other := o.nvmlDeviceHandle()
|
||||
if other == nil {
|
||||
return 0, ERROR_INVALID_ARGUMENT
|
||||
}
|
||||
|
||||
l, r := nvml.Device(d).GetTopologyCommonAncestor(*other)
|
||||
return GpuTopologyLevel(l), Return(r)
|
||||
}
|
||||
|
||||
// GetNvLinkState retrieves the state of the device's NvLink for the link specified.
|
||||
func (d nvmlDevice) GetNvLinkState(link int) (EnableState, Return) {
|
||||
s, r := nvml.Device(d).GetNvLinkState(link)
|
||||
return EnableState(s), Return(r)
|
||||
}
|
||||
|
||||
// GetNvLinkRemotePciInfo retrieves the PCI information for the remote node on a NvLink link.
|
||||
// Note: pciSubSystemId is not filled in this function and is indeterminate.
|
||||
func (d nvmlDevice) GetNvLinkRemotePciInfo(link int) (PciInfo, Return) {
|
||||
p, r := nvml.Device(d).GetNvLinkRemotePciInfo(link)
|
||||
return PciInfo(p), Return(r)
|
||||
}
|
||||
|
||||
// SetComputeMode sets the compute mode for the device.
|
||||
func (d nvmlDevice) SetComputeMode(mode ComputeMode) Return {
|
||||
r := nvml.Device(d).SetComputeMode(nvml.ComputeMode(mode))
|
||||
return Return(r)
|
||||
}
|
||||
1237
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/device_mock.go
generated
vendored
1237
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/device_mock.go
generated
vendored
File diff suppressed because it is too large
Load Diff
39
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/event_set.go
generated
vendored
39
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/event_set.go
generated
vendored
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package nvml
|
||||
|
||||
import (
|
||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
)
|
||||
|
||||
// Wait watches for an event with the specified timeout
|
||||
func (e EventSet) Wait(Timeoutms uint32) (EventData, Return) {
|
||||
d, r := nvml.EventSet(e).Wait(Timeoutms)
|
||||
eventData := EventData{
|
||||
Device: nvmlDevice(d.Device),
|
||||
EventType: d.EventType,
|
||||
EventData: d.EventData,
|
||||
GpuInstanceId: d.GpuInstanceId,
|
||||
ComputeInstanceId: d.ComputeInstanceId,
|
||||
}
|
||||
return eventData, Return(r)
|
||||
}
|
||||
|
||||
// Free deletes the event set
|
||||
func (e EventSet) Free() Return {
|
||||
return Return(nvml.EventSet(e).Free())
|
||||
}
|
||||
71
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/gi.go
generated
vendored
71
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/gi.go
generated
vendored
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package nvml
|
||||
|
||||
import (
|
||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
)
|
||||
|
||||
type nvmlGpuInstance nvml.GpuInstance
|
||||
|
||||
var _ GpuInstance = (*nvmlGpuInstance)(nil)
|
||||
|
||||
// GetInfo returns info about a GPU Intsance
|
||||
func (gi nvmlGpuInstance) GetInfo() (GpuInstanceInfo, Return) {
|
||||
i, r := nvml.GpuInstance(gi).GetInfo()
|
||||
info := GpuInstanceInfo{
|
||||
Device: nvmlDevice(i.Device),
|
||||
Id: i.Id,
|
||||
ProfileId: i.ProfileId,
|
||||
Placement: GpuInstancePlacement(i.Placement),
|
||||
}
|
||||
return info, Return(r)
|
||||
}
|
||||
|
||||
// GetComputeInstanceById returns the Compute Instance associated with a particular ID.
|
||||
func (gi nvmlGpuInstance) GetComputeInstanceById(id int) (ComputeInstance, Return) {
|
||||
ci, r := nvml.GpuInstance(gi).GetComputeInstanceById(id)
|
||||
return nvmlComputeInstance(ci), Return(r)
|
||||
}
|
||||
|
||||
// GetComputeInstanceProfileInfo returns info about a given Compute Instance profile
|
||||
func (gi nvmlGpuInstance) GetComputeInstanceProfileInfo(profile int, engProfile int) (ComputeInstanceProfileInfo, Return) {
|
||||
p, r := nvml.GpuInstance(gi).GetComputeInstanceProfileInfo(profile, engProfile)
|
||||
return ComputeInstanceProfileInfo(p), Return(r)
|
||||
}
|
||||
|
||||
// CreateComputeInstance creates a Compute Instance within the GPU Instance
|
||||
func (gi nvmlGpuInstance) CreateComputeInstance(info *ComputeInstanceProfileInfo) (ComputeInstance, Return) {
|
||||
ci, r := nvml.GpuInstance(gi).CreateComputeInstance((*nvml.ComputeInstanceProfileInfo)(info))
|
||||
return nvmlComputeInstance(ci), Return(r)
|
||||
}
|
||||
|
||||
// GetComputeInstances returns the set of Compute Instances associated with a GPU Instance
|
||||
func (gi nvmlGpuInstance) GetComputeInstances(info *ComputeInstanceProfileInfo) ([]ComputeInstance, Return) {
|
||||
nvmlCis, r := nvml.GpuInstance(gi).GetComputeInstances((*nvml.ComputeInstanceProfileInfo)(info))
|
||||
var cis []ComputeInstance
|
||||
for _, ci := range nvmlCis {
|
||||
cis = append(cis, nvmlComputeInstance(ci))
|
||||
}
|
||||
return cis, Return(r)
|
||||
}
|
||||
|
||||
// Destroy destroys a GPU Instance
|
||||
func (gi nvmlGpuInstance) Destroy() Return {
|
||||
r := nvml.GpuInstance(gi).Destroy()
|
||||
return Return(r)
|
||||
}
|
||||
286
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/gi_mock.go
generated
vendored
286
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/gi_mock.go
generated
vendored
@@ -1,286 +0,0 @@
|
||||
// Code generated by moq; DO NOT EDIT.
|
||||
// github.com/matryer/moq
|
||||
|
||||
package nvml
|
||||
|
||||
import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Ensure, that GpuInstanceMock does implement GpuInstance.
|
||||
// If this is not the case, regenerate this file with moq.
|
||||
var _ GpuInstance = &GpuInstanceMock{}
|
||||
|
||||
// GpuInstanceMock is a mock implementation of GpuInstance.
|
||||
//
|
||||
// func TestSomethingThatUsesGpuInstance(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked GpuInstance
|
||||
// mockedGpuInstance := &GpuInstanceMock{
|
||||
// CreateComputeInstanceFunc: func(Info *ComputeInstanceProfileInfo) (ComputeInstance, Return) {
|
||||
// panic("mock out the CreateComputeInstance method")
|
||||
// },
|
||||
// DestroyFunc: func() Return {
|
||||
// panic("mock out the Destroy method")
|
||||
// },
|
||||
// GetComputeInstanceByIdFunc: func(ID int) (ComputeInstance, Return) {
|
||||
// panic("mock out the GetComputeInstanceById method")
|
||||
// },
|
||||
// GetComputeInstanceProfileInfoFunc: func(Profile int, EngProfile int) (ComputeInstanceProfileInfo, Return) {
|
||||
// panic("mock out the GetComputeInstanceProfileInfo method")
|
||||
// },
|
||||
// GetComputeInstancesFunc: func(Info *ComputeInstanceProfileInfo) ([]ComputeInstance, Return) {
|
||||
// panic("mock out the GetComputeInstances method")
|
||||
// },
|
||||
// GetInfoFunc: func() (GpuInstanceInfo, Return) {
|
||||
// panic("mock out the GetInfo method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedGpuInstance in code that requires GpuInstance
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
type GpuInstanceMock struct {
|
||||
// CreateComputeInstanceFunc mocks the CreateComputeInstance method.
|
||||
CreateComputeInstanceFunc func(Info *ComputeInstanceProfileInfo) (ComputeInstance, Return)
|
||||
|
||||
// DestroyFunc mocks the Destroy method.
|
||||
DestroyFunc func() Return
|
||||
|
||||
// GetComputeInstanceByIdFunc mocks the GetComputeInstanceById method.
|
||||
GetComputeInstanceByIdFunc func(ID int) (ComputeInstance, Return)
|
||||
|
||||
// GetComputeInstanceProfileInfoFunc mocks the GetComputeInstanceProfileInfo method.
|
||||
GetComputeInstanceProfileInfoFunc func(Profile int, EngProfile int) (ComputeInstanceProfileInfo, Return)
|
||||
|
||||
// GetComputeInstancesFunc mocks the GetComputeInstances method.
|
||||
GetComputeInstancesFunc func(Info *ComputeInstanceProfileInfo) ([]ComputeInstance, Return)
|
||||
|
||||
// GetInfoFunc mocks the GetInfo method.
|
||||
GetInfoFunc func() (GpuInstanceInfo, Return)
|
||||
|
||||
// calls tracks calls to the methods.
|
||||
calls struct {
|
||||
// CreateComputeInstance holds details about calls to the CreateComputeInstance method.
|
||||
CreateComputeInstance []struct {
|
||||
// Info is the Info argument value.
|
||||
Info *ComputeInstanceProfileInfo
|
||||
}
|
||||
// Destroy holds details about calls to the Destroy method.
|
||||
Destroy []struct {
|
||||
}
|
||||
// GetComputeInstanceById holds details about calls to the GetComputeInstanceById method.
|
||||
GetComputeInstanceById []struct {
|
||||
// ID is the ID argument value.
|
||||
ID int
|
||||
}
|
||||
// GetComputeInstanceProfileInfo holds details about calls to the GetComputeInstanceProfileInfo method.
|
||||
GetComputeInstanceProfileInfo []struct {
|
||||
// Profile is the Profile argument value.
|
||||
Profile int
|
||||
// EngProfile is the EngProfile argument value.
|
||||
EngProfile int
|
||||
}
|
||||
// GetComputeInstances holds details about calls to the GetComputeInstances method.
|
||||
GetComputeInstances []struct {
|
||||
// Info is the Info argument value.
|
||||
Info *ComputeInstanceProfileInfo
|
||||
}
|
||||
// GetInfo holds details about calls to the GetInfo method.
|
||||
GetInfo []struct {
|
||||
}
|
||||
}
|
||||
lockCreateComputeInstance sync.RWMutex
|
||||
lockDestroy sync.RWMutex
|
||||
lockGetComputeInstanceById sync.RWMutex
|
||||
lockGetComputeInstanceProfileInfo sync.RWMutex
|
||||
lockGetComputeInstances sync.RWMutex
|
||||
lockGetInfo sync.RWMutex
|
||||
}
|
||||
|
||||
// CreateComputeInstance calls CreateComputeInstanceFunc.
|
||||
func (mock *GpuInstanceMock) CreateComputeInstance(Info *ComputeInstanceProfileInfo) (ComputeInstance, Return) {
|
||||
if mock.CreateComputeInstanceFunc == nil {
|
||||
panic("GpuInstanceMock.CreateComputeInstanceFunc: method is nil but GpuInstance.CreateComputeInstance was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
Info *ComputeInstanceProfileInfo
|
||||
}{
|
||||
Info: Info,
|
||||
}
|
||||
mock.lockCreateComputeInstance.Lock()
|
||||
mock.calls.CreateComputeInstance = append(mock.calls.CreateComputeInstance, callInfo)
|
||||
mock.lockCreateComputeInstance.Unlock()
|
||||
return mock.CreateComputeInstanceFunc(Info)
|
||||
}
|
||||
|
||||
// CreateComputeInstanceCalls gets all the calls that were made to CreateComputeInstance.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedGpuInstance.CreateComputeInstanceCalls())
|
||||
func (mock *GpuInstanceMock) CreateComputeInstanceCalls() []struct {
|
||||
Info *ComputeInstanceProfileInfo
|
||||
} {
|
||||
var calls []struct {
|
||||
Info *ComputeInstanceProfileInfo
|
||||
}
|
||||
mock.lockCreateComputeInstance.RLock()
|
||||
calls = mock.calls.CreateComputeInstance
|
||||
mock.lockCreateComputeInstance.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// Destroy calls DestroyFunc.
|
||||
func (mock *GpuInstanceMock) Destroy() Return {
|
||||
if mock.DestroyFunc == nil {
|
||||
panic("GpuInstanceMock.DestroyFunc: method is nil but GpuInstance.Destroy was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockDestroy.Lock()
|
||||
mock.calls.Destroy = append(mock.calls.Destroy, callInfo)
|
||||
mock.lockDestroy.Unlock()
|
||||
return mock.DestroyFunc()
|
||||
}
|
||||
|
||||
// DestroyCalls gets all the calls that were made to Destroy.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedGpuInstance.DestroyCalls())
|
||||
func (mock *GpuInstanceMock) DestroyCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockDestroy.RLock()
|
||||
calls = mock.calls.Destroy
|
||||
mock.lockDestroy.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetComputeInstanceById calls GetComputeInstanceByIdFunc.
|
||||
func (mock *GpuInstanceMock) GetComputeInstanceById(ID int) (ComputeInstance, Return) {
|
||||
if mock.GetComputeInstanceByIdFunc == nil {
|
||||
panic("GpuInstanceMock.GetComputeInstanceByIdFunc: method is nil but GpuInstance.GetComputeInstanceById was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
ID int
|
||||
}{
|
||||
ID: ID,
|
||||
}
|
||||
mock.lockGetComputeInstanceById.Lock()
|
||||
mock.calls.GetComputeInstanceById = append(mock.calls.GetComputeInstanceById, callInfo)
|
||||
mock.lockGetComputeInstanceById.Unlock()
|
||||
return mock.GetComputeInstanceByIdFunc(ID)
|
||||
}
|
||||
|
||||
// GetComputeInstanceByIdCalls gets all the calls that were made to GetComputeInstanceById.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedGpuInstance.GetComputeInstanceByIdCalls())
|
||||
func (mock *GpuInstanceMock) GetComputeInstanceByIdCalls() []struct {
|
||||
ID int
|
||||
} {
|
||||
var calls []struct {
|
||||
ID int
|
||||
}
|
||||
mock.lockGetComputeInstanceById.RLock()
|
||||
calls = mock.calls.GetComputeInstanceById
|
||||
mock.lockGetComputeInstanceById.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetComputeInstanceProfileInfo calls GetComputeInstanceProfileInfoFunc.
|
||||
func (mock *GpuInstanceMock) GetComputeInstanceProfileInfo(Profile int, EngProfile int) (ComputeInstanceProfileInfo, Return) {
|
||||
if mock.GetComputeInstanceProfileInfoFunc == nil {
|
||||
panic("GpuInstanceMock.GetComputeInstanceProfileInfoFunc: method is nil but GpuInstance.GetComputeInstanceProfileInfo was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
Profile int
|
||||
EngProfile int
|
||||
}{
|
||||
Profile: Profile,
|
||||
EngProfile: EngProfile,
|
||||
}
|
||||
mock.lockGetComputeInstanceProfileInfo.Lock()
|
||||
mock.calls.GetComputeInstanceProfileInfo = append(mock.calls.GetComputeInstanceProfileInfo, callInfo)
|
||||
mock.lockGetComputeInstanceProfileInfo.Unlock()
|
||||
return mock.GetComputeInstanceProfileInfoFunc(Profile, EngProfile)
|
||||
}
|
||||
|
||||
// GetComputeInstanceProfileInfoCalls gets all the calls that were made to GetComputeInstanceProfileInfo.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedGpuInstance.GetComputeInstanceProfileInfoCalls())
|
||||
func (mock *GpuInstanceMock) GetComputeInstanceProfileInfoCalls() []struct {
|
||||
Profile int
|
||||
EngProfile int
|
||||
} {
|
||||
var calls []struct {
|
||||
Profile int
|
||||
EngProfile int
|
||||
}
|
||||
mock.lockGetComputeInstanceProfileInfo.RLock()
|
||||
calls = mock.calls.GetComputeInstanceProfileInfo
|
||||
mock.lockGetComputeInstanceProfileInfo.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetComputeInstances calls GetComputeInstancesFunc.
|
||||
func (mock *GpuInstanceMock) GetComputeInstances(Info *ComputeInstanceProfileInfo) ([]ComputeInstance, Return) {
|
||||
if mock.GetComputeInstancesFunc == nil {
|
||||
panic("GpuInstanceMock.GetComputeInstancesFunc: method is nil but GpuInstance.GetComputeInstances was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
Info *ComputeInstanceProfileInfo
|
||||
}{
|
||||
Info: Info,
|
||||
}
|
||||
mock.lockGetComputeInstances.Lock()
|
||||
mock.calls.GetComputeInstances = append(mock.calls.GetComputeInstances, callInfo)
|
||||
mock.lockGetComputeInstances.Unlock()
|
||||
return mock.GetComputeInstancesFunc(Info)
|
||||
}
|
||||
|
||||
// GetComputeInstancesCalls gets all the calls that were made to GetComputeInstances.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedGpuInstance.GetComputeInstancesCalls())
|
||||
func (mock *GpuInstanceMock) GetComputeInstancesCalls() []struct {
|
||||
Info *ComputeInstanceProfileInfo
|
||||
} {
|
||||
var calls []struct {
|
||||
Info *ComputeInstanceProfileInfo
|
||||
}
|
||||
mock.lockGetComputeInstances.RLock()
|
||||
calls = mock.calls.GetComputeInstances
|
||||
mock.lockGetComputeInstances.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetInfo calls GetInfoFunc.
|
||||
func (mock *GpuInstanceMock) GetInfo() (GpuInstanceInfo, Return) {
|
||||
if mock.GetInfoFunc == nil {
|
||||
panic("GpuInstanceMock.GetInfoFunc: method is nil but GpuInstance.GetInfo was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetInfo.Lock()
|
||||
mock.calls.GetInfo = append(mock.calls.GetInfo, callInfo)
|
||||
mock.lockGetInfo.Unlock()
|
||||
return mock.GetInfoFunc()
|
||||
}
|
||||
|
||||
// GetInfoCalls gets all the calls that were made to GetInfo.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedGpuInstance.GetInfoCalls())
|
||||
func (mock *GpuInstanceMock) GetInfoCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetInfo.RLock()
|
||||
calls = mock.calls.GetInfo
|
||||
mock.lockGetInfo.RUnlock()
|
||||
return calls
|
||||
}
|
||||
127
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/nvml.go
generated
vendored
127
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/nvml.go
generated
vendored
@@ -1,127 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package nvml
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
)
|
||||
|
||||
type nvmlLib struct {
|
||||
sync.Mutex
|
||||
refcount int
|
||||
}
|
||||
|
||||
var _ Interface = (*nvmlLib)(nil)
|
||||
|
||||
// New creates a new instance of the NVML Interface
|
||||
func New(opts ...Option) Interface {
|
||||
o := &options{}
|
||||
for _, opt := range opts {
|
||||
opt(o)
|
||||
}
|
||||
|
||||
var nvmlOptions []nvml.LibraryOption
|
||||
if o.libraryPath != "" {
|
||||
nvmlOptions = append(nvmlOptions, nvml.WithLibraryPath(o.libraryPath))
|
||||
}
|
||||
nvml.SetLibraryOptions(nvmlOptions...)
|
||||
|
||||
return &nvmlLib{}
|
||||
}
|
||||
|
||||
// Lookup checks whether the specified symbol exists in the configured NVML library.
|
||||
func (n *nvmlLib) Lookup(name string) error {
|
||||
// TODO: For now we rely on the default NVML library and perform the lookups against this.
|
||||
return nvml.GetLibrary().Lookup(name)
|
||||
}
|
||||
|
||||
// Init initializes an NVML Interface
|
||||
func (n *nvmlLib) Init() Return {
|
||||
ret := nvml.Init()
|
||||
if ret != nvml.SUCCESS {
|
||||
return Return(ret)
|
||||
}
|
||||
|
||||
n.Lock()
|
||||
defer n.Unlock()
|
||||
if n.refcount == 0 {
|
||||
errorStringFunc = nvml.ErrorString
|
||||
}
|
||||
n.refcount++
|
||||
|
||||
return SUCCESS
|
||||
}
|
||||
|
||||
// Shutdown shuts down an NVML Interface
|
||||
func (n *nvmlLib) Shutdown() Return {
|
||||
ret := nvml.Shutdown()
|
||||
if ret != nvml.SUCCESS {
|
||||
return Return(ret)
|
||||
}
|
||||
|
||||
n.Lock()
|
||||
defer n.Unlock()
|
||||
n.refcount--
|
||||
if n.refcount == 0 {
|
||||
errorStringFunc = defaultErrorStringFunc
|
||||
}
|
||||
|
||||
return SUCCESS
|
||||
}
|
||||
|
||||
// DeviceGetCount returns the total number of GPU Devices
|
||||
func (n *nvmlLib) DeviceGetCount() (int, Return) {
|
||||
c, r := nvml.DeviceGetCount()
|
||||
return c, Return(r)
|
||||
}
|
||||
|
||||
// DeviceGetHandleByIndex returns a Device handle given its index
|
||||
func (n *nvmlLib) DeviceGetHandleByIndex(index int) (Device, Return) {
|
||||
d, r := nvml.DeviceGetHandleByIndex(index)
|
||||
return nvmlDevice(d), Return(r)
|
||||
}
|
||||
|
||||
// DeviceGetHandleByUUID returns a Device handle given its UUID
|
||||
func (n *nvmlLib) DeviceGetHandleByUUID(uuid string) (Device, Return) {
|
||||
d, r := nvml.DeviceGetHandleByUUID(uuid)
|
||||
return nvmlDevice(d), Return(r)
|
||||
}
|
||||
|
||||
// SystemGetDriverVersion returns the version of the installed NVIDIA driver
|
||||
func (n *nvmlLib) SystemGetDriverVersion() (string, Return) {
|
||||
v, r := nvml.SystemGetDriverVersion()
|
||||
return v, Return(r)
|
||||
}
|
||||
|
||||
// SystemGetCudaDriverVersion returns the version of CUDA associated with the NVIDIA driver
|
||||
func (n *nvmlLib) SystemGetCudaDriverVersion() (int, Return) {
|
||||
v, r := nvml.SystemGetCudaDriverVersion()
|
||||
return v, Return(r)
|
||||
}
|
||||
|
||||
// ErrorString returns the error string associated with a given return value
|
||||
func (n *nvmlLib) ErrorString(ret Return) string {
|
||||
return nvml.ErrorString(nvml.Return(ret))
|
||||
}
|
||||
|
||||
// EventSetCreate creates an event set
|
||||
func (n *nvmlLib) EventSetCreate() (EventSet, Return) {
|
||||
e, r := nvml.EventSetCreate()
|
||||
return EventSet(e), Return(r)
|
||||
}
|
||||
428
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/nvml_mock.go
generated
vendored
428
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/nvml_mock.go
generated
vendored
@@ -1,428 +0,0 @@
|
||||
// Code generated by moq; DO NOT EDIT.
|
||||
// github.com/matryer/moq
|
||||
|
||||
package nvml
|
||||
|
||||
import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Ensure, that InterfaceMock does implement Interface.
|
||||
// If this is not the case, regenerate this file with moq.
|
||||
var _ Interface = &InterfaceMock{}
|
||||
|
||||
// InterfaceMock is a mock implementation of Interface.
|
||||
//
|
||||
// func TestSomethingThatUsesInterface(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked Interface
|
||||
// mockedInterface := &InterfaceMock{
|
||||
// DeviceGetCountFunc: func() (int, Return) {
|
||||
// panic("mock out the DeviceGetCount method")
|
||||
// },
|
||||
// DeviceGetHandleByIndexFunc: func(Index int) (Device, Return) {
|
||||
// panic("mock out the DeviceGetHandleByIndex method")
|
||||
// },
|
||||
// DeviceGetHandleByUUIDFunc: func(UUID string) (Device, Return) {
|
||||
// panic("mock out the DeviceGetHandleByUUID method")
|
||||
// },
|
||||
// ErrorStringFunc: func(r Return) string {
|
||||
// panic("mock out the ErrorString method")
|
||||
// },
|
||||
// EventSetCreateFunc: func() (EventSet, Return) {
|
||||
// panic("mock out the EventSetCreate method")
|
||||
// },
|
||||
// InitFunc: func() Return {
|
||||
// panic("mock out the Init method")
|
||||
// },
|
||||
// LookupFunc: func(s string) error {
|
||||
// panic("mock out the Lookup method")
|
||||
// },
|
||||
// ShutdownFunc: func() Return {
|
||||
// panic("mock out the Shutdown method")
|
||||
// },
|
||||
// SystemGetCudaDriverVersionFunc: func() (int, Return) {
|
||||
// panic("mock out the SystemGetCudaDriverVersion method")
|
||||
// },
|
||||
// SystemGetDriverVersionFunc: func() (string, Return) {
|
||||
// panic("mock out the SystemGetDriverVersion method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedInterface in code that requires Interface
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
type InterfaceMock struct {
|
||||
// DeviceGetCountFunc mocks the DeviceGetCount method.
|
||||
DeviceGetCountFunc func() (int, Return)
|
||||
|
||||
// DeviceGetHandleByIndexFunc mocks the DeviceGetHandleByIndex method.
|
||||
DeviceGetHandleByIndexFunc func(Index int) (Device, Return)
|
||||
|
||||
// DeviceGetHandleByUUIDFunc mocks the DeviceGetHandleByUUID method.
|
||||
DeviceGetHandleByUUIDFunc func(UUID string) (Device, Return)
|
||||
|
||||
// ErrorStringFunc mocks the ErrorString method.
|
||||
ErrorStringFunc func(r Return) string
|
||||
|
||||
// EventSetCreateFunc mocks the EventSetCreate method.
|
||||
EventSetCreateFunc func() (EventSet, Return)
|
||||
|
||||
// InitFunc mocks the Init method.
|
||||
InitFunc func() Return
|
||||
|
||||
// LookupFunc mocks the Lookup method.
|
||||
LookupFunc func(s string) error
|
||||
|
||||
// ShutdownFunc mocks the Shutdown method.
|
||||
ShutdownFunc func() Return
|
||||
|
||||
// SystemGetCudaDriverVersionFunc mocks the SystemGetCudaDriverVersion method.
|
||||
SystemGetCudaDriverVersionFunc func() (int, Return)
|
||||
|
||||
// SystemGetDriverVersionFunc mocks the SystemGetDriverVersion method.
|
||||
SystemGetDriverVersionFunc func() (string, Return)
|
||||
|
||||
// calls tracks calls to the methods.
|
||||
calls struct {
|
||||
// DeviceGetCount holds details about calls to the DeviceGetCount method.
|
||||
DeviceGetCount []struct {
|
||||
}
|
||||
// DeviceGetHandleByIndex holds details about calls to the DeviceGetHandleByIndex method.
|
||||
DeviceGetHandleByIndex []struct {
|
||||
// Index is the Index argument value.
|
||||
Index int
|
||||
}
|
||||
// DeviceGetHandleByUUID holds details about calls to the DeviceGetHandleByUUID method.
|
||||
DeviceGetHandleByUUID []struct {
|
||||
// UUID is the UUID argument value.
|
||||
UUID string
|
||||
}
|
||||
// ErrorString holds details about calls to the ErrorString method.
|
||||
ErrorString []struct {
|
||||
// R is the r argument value.
|
||||
R Return
|
||||
}
|
||||
// EventSetCreate holds details about calls to the EventSetCreate method.
|
||||
EventSetCreate []struct {
|
||||
}
|
||||
// Init holds details about calls to the Init method.
|
||||
Init []struct {
|
||||
}
|
||||
// Lookup holds details about calls to the Lookup method.
|
||||
Lookup []struct {
|
||||
// S is the s argument value.
|
||||
S string
|
||||
}
|
||||
// Shutdown holds details about calls to the Shutdown method.
|
||||
Shutdown []struct {
|
||||
}
|
||||
// SystemGetCudaDriverVersion holds details about calls to the SystemGetCudaDriverVersion method.
|
||||
SystemGetCudaDriverVersion []struct {
|
||||
}
|
||||
// SystemGetDriverVersion holds details about calls to the SystemGetDriverVersion method.
|
||||
SystemGetDriverVersion []struct {
|
||||
}
|
||||
}
|
||||
lockDeviceGetCount sync.RWMutex
|
||||
lockDeviceGetHandleByIndex sync.RWMutex
|
||||
lockDeviceGetHandleByUUID sync.RWMutex
|
||||
lockErrorString sync.RWMutex
|
||||
lockEventSetCreate sync.RWMutex
|
||||
lockInit sync.RWMutex
|
||||
lockLookup sync.RWMutex
|
||||
lockShutdown sync.RWMutex
|
||||
lockSystemGetCudaDriverVersion sync.RWMutex
|
||||
lockSystemGetDriverVersion sync.RWMutex
|
||||
}
|
||||
|
||||
// DeviceGetCount calls DeviceGetCountFunc.
|
||||
func (mock *InterfaceMock) DeviceGetCount() (int, Return) {
|
||||
if mock.DeviceGetCountFunc == nil {
|
||||
panic("InterfaceMock.DeviceGetCountFunc: method is nil but Interface.DeviceGetCount was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockDeviceGetCount.Lock()
|
||||
mock.calls.DeviceGetCount = append(mock.calls.DeviceGetCount, callInfo)
|
||||
mock.lockDeviceGetCount.Unlock()
|
||||
return mock.DeviceGetCountFunc()
|
||||
}
|
||||
|
||||
// DeviceGetCountCalls gets all the calls that were made to DeviceGetCount.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedInterface.DeviceGetCountCalls())
|
||||
func (mock *InterfaceMock) DeviceGetCountCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockDeviceGetCount.RLock()
|
||||
calls = mock.calls.DeviceGetCount
|
||||
mock.lockDeviceGetCount.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// DeviceGetHandleByIndex calls DeviceGetHandleByIndexFunc.
|
||||
func (mock *InterfaceMock) DeviceGetHandleByIndex(Index int) (Device, Return) {
|
||||
if mock.DeviceGetHandleByIndexFunc == nil {
|
||||
panic("InterfaceMock.DeviceGetHandleByIndexFunc: method is nil but Interface.DeviceGetHandleByIndex was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
Index int
|
||||
}{
|
||||
Index: Index,
|
||||
}
|
||||
mock.lockDeviceGetHandleByIndex.Lock()
|
||||
mock.calls.DeviceGetHandleByIndex = append(mock.calls.DeviceGetHandleByIndex, callInfo)
|
||||
mock.lockDeviceGetHandleByIndex.Unlock()
|
||||
return mock.DeviceGetHandleByIndexFunc(Index)
|
||||
}
|
||||
|
||||
// DeviceGetHandleByIndexCalls gets all the calls that were made to DeviceGetHandleByIndex.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedInterface.DeviceGetHandleByIndexCalls())
|
||||
func (mock *InterfaceMock) DeviceGetHandleByIndexCalls() []struct {
|
||||
Index int
|
||||
} {
|
||||
var calls []struct {
|
||||
Index int
|
||||
}
|
||||
mock.lockDeviceGetHandleByIndex.RLock()
|
||||
calls = mock.calls.DeviceGetHandleByIndex
|
||||
mock.lockDeviceGetHandleByIndex.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// DeviceGetHandleByUUID calls DeviceGetHandleByUUIDFunc.
|
||||
func (mock *InterfaceMock) DeviceGetHandleByUUID(UUID string) (Device, Return) {
|
||||
if mock.DeviceGetHandleByUUIDFunc == nil {
|
||||
panic("InterfaceMock.DeviceGetHandleByUUIDFunc: method is nil but Interface.DeviceGetHandleByUUID was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
UUID string
|
||||
}{
|
||||
UUID: UUID,
|
||||
}
|
||||
mock.lockDeviceGetHandleByUUID.Lock()
|
||||
mock.calls.DeviceGetHandleByUUID = append(mock.calls.DeviceGetHandleByUUID, callInfo)
|
||||
mock.lockDeviceGetHandleByUUID.Unlock()
|
||||
return mock.DeviceGetHandleByUUIDFunc(UUID)
|
||||
}
|
||||
|
||||
// DeviceGetHandleByUUIDCalls gets all the calls that were made to DeviceGetHandleByUUID.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedInterface.DeviceGetHandleByUUIDCalls())
|
||||
func (mock *InterfaceMock) DeviceGetHandleByUUIDCalls() []struct {
|
||||
UUID string
|
||||
} {
|
||||
var calls []struct {
|
||||
UUID string
|
||||
}
|
||||
mock.lockDeviceGetHandleByUUID.RLock()
|
||||
calls = mock.calls.DeviceGetHandleByUUID
|
||||
mock.lockDeviceGetHandleByUUID.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// ErrorString calls ErrorStringFunc.
|
||||
func (mock *InterfaceMock) ErrorString(r Return) string {
|
||||
if mock.ErrorStringFunc == nil {
|
||||
panic("InterfaceMock.ErrorStringFunc: method is nil but Interface.ErrorString was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
R Return
|
||||
}{
|
||||
R: r,
|
||||
}
|
||||
mock.lockErrorString.Lock()
|
||||
mock.calls.ErrorString = append(mock.calls.ErrorString, callInfo)
|
||||
mock.lockErrorString.Unlock()
|
||||
return mock.ErrorStringFunc(r)
|
||||
}
|
||||
|
||||
// ErrorStringCalls gets all the calls that were made to ErrorString.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedInterface.ErrorStringCalls())
|
||||
func (mock *InterfaceMock) ErrorStringCalls() []struct {
|
||||
R Return
|
||||
} {
|
||||
var calls []struct {
|
||||
R Return
|
||||
}
|
||||
mock.lockErrorString.RLock()
|
||||
calls = mock.calls.ErrorString
|
||||
mock.lockErrorString.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// EventSetCreate calls EventSetCreateFunc.
|
||||
func (mock *InterfaceMock) EventSetCreate() (EventSet, Return) {
|
||||
if mock.EventSetCreateFunc == nil {
|
||||
panic("InterfaceMock.EventSetCreateFunc: method is nil but Interface.EventSetCreate was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockEventSetCreate.Lock()
|
||||
mock.calls.EventSetCreate = append(mock.calls.EventSetCreate, callInfo)
|
||||
mock.lockEventSetCreate.Unlock()
|
||||
return mock.EventSetCreateFunc()
|
||||
}
|
||||
|
||||
// EventSetCreateCalls gets all the calls that were made to EventSetCreate.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedInterface.EventSetCreateCalls())
|
||||
func (mock *InterfaceMock) EventSetCreateCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockEventSetCreate.RLock()
|
||||
calls = mock.calls.EventSetCreate
|
||||
mock.lockEventSetCreate.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// Init calls InitFunc.
|
||||
func (mock *InterfaceMock) Init() Return {
|
||||
if mock.InitFunc == nil {
|
||||
panic("InterfaceMock.InitFunc: method is nil but Interface.Init was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockInit.Lock()
|
||||
mock.calls.Init = append(mock.calls.Init, callInfo)
|
||||
mock.lockInit.Unlock()
|
||||
return mock.InitFunc()
|
||||
}
|
||||
|
||||
// InitCalls gets all the calls that were made to Init.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedInterface.InitCalls())
|
||||
func (mock *InterfaceMock) InitCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockInit.RLock()
|
||||
calls = mock.calls.Init
|
||||
mock.lockInit.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// Lookup calls LookupFunc.
|
||||
func (mock *InterfaceMock) Lookup(s string) error {
|
||||
if mock.LookupFunc == nil {
|
||||
panic("InterfaceMock.LookupFunc: method is nil but Interface.Lookup was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
S string
|
||||
}{
|
||||
S: s,
|
||||
}
|
||||
mock.lockLookup.Lock()
|
||||
mock.calls.Lookup = append(mock.calls.Lookup, callInfo)
|
||||
mock.lockLookup.Unlock()
|
||||
return mock.LookupFunc(s)
|
||||
}
|
||||
|
||||
// LookupCalls gets all the calls that were made to Lookup.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedInterface.LookupCalls())
|
||||
func (mock *InterfaceMock) LookupCalls() []struct {
|
||||
S string
|
||||
} {
|
||||
var calls []struct {
|
||||
S string
|
||||
}
|
||||
mock.lockLookup.RLock()
|
||||
calls = mock.calls.Lookup
|
||||
mock.lockLookup.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// Shutdown calls ShutdownFunc.
|
||||
func (mock *InterfaceMock) Shutdown() Return {
|
||||
if mock.ShutdownFunc == nil {
|
||||
panic("InterfaceMock.ShutdownFunc: method is nil but Interface.Shutdown was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockShutdown.Lock()
|
||||
mock.calls.Shutdown = append(mock.calls.Shutdown, callInfo)
|
||||
mock.lockShutdown.Unlock()
|
||||
return mock.ShutdownFunc()
|
||||
}
|
||||
|
||||
// ShutdownCalls gets all the calls that were made to Shutdown.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedInterface.ShutdownCalls())
|
||||
func (mock *InterfaceMock) ShutdownCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockShutdown.RLock()
|
||||
calls = mock.calls.Shutdown
|
||||
mock.lockShutdown.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// SystemGetCudaDriverVersion calls SystemGetCudaDriverVersionFunc.
|
||||
func (mock *InterfaceMock) SystemGetCudaDriverVersion() (int, Return) {
|
||||
if mock.SystemGetCudaDriverVersionFunc == nil {
|
||||
panic("InterfaceMock.SystemGetCudaDriverVersionFunc: method is nil but Interface.SystemGetCudaDriverVersion was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockSystemGetCudaDriverVersion.Lock()
|
||||
mock.calls.SystemGetCudaDriverVersion = append(mock.calls.SystemGetCudaDriverVersion, callInfo)
|
||||
mock.lockSystemGetCudaDriverVersion.Unlock()
|
||||
return mock.SystemGetCudaDriverVersionFunc()
|
||||
}
|
||||
|
||||
// SystemGetCudaDriverVersionCalls gets all the calls that were made to SystemGetCudaDriverVersion.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedInterface.SystemGetCudaDriverVersionCalls())
|
||||
func (mock *InterfaceMock) SystemGetCudaDriverVersionCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockSystemGetCudaDriverVersion.RLock()
|
||||
calls = mock.calls.SystemGetCudaDriverVersion
|
||||
mock.lockSystemGetCudaDriverVersion.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// SystemGetDriverVersion calls SystemGetDriverVersionFunc.
|
||||
func (mock *InterfaceMock) SystemGetDriverVersion() (string, Return) {
|
||||
if mock.SystemGetDriverVersionFunc == nil {
|
||||
panic("InterfaceMock.SystemGetDriverVersionFunc: method is nil but Interface.SystemGetDriverVersion was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockSystemGetDriverVersion.Lock()
|
||||
mock.calls.SystemGetDriverVersion = append(mock.calls.SystemGetDriverVersion, callInfo)
|
||||
mock.lockSystemGetDriverVersion.Unlock()
|
||||
return mock.SystemGetDriverVersionFunc()
|
||||
}
|
||||
|
||||
// SystemGetDriverVersionCalls gets all the calls that were made to SystemGetDriverVersion.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedInterface.SystemGetDriverVersionCalls())
|
||||
func (mock *InterfaceMock) SystemGetDriverVersionCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockSystemGetDriverVersion.RLock()
|
||||
calls = mock.calls.SystemGetDriverVersion
|
||||
mock.lockSystemGetDriverVersion.RUnlock()
|
||||
return calls
|
||||
}
|
||||
32
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/options.go
generated
vendored
32
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/options.go
generated
vendored
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
# Copyright 2023 NVIDIA CORPORATION
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
**/
|
||||
|
||||
package nvml
|
||||
|
||||
// options represents the options that could be passed to the nvml contructor.
|
||||
type options struct {
|
||||
libraryPath string
|
||||
}
|
||||
|
||||
// Option represents a functional option to control behaviour.
|
||||
type Option func(*options)
|
||||
|
||||
// WithLibraryPath sets the NVML library name to use.
|
||||
func WithLibraryPath(libraryPath string) Option {
|
||||
return func(o *options) {
|
||||
o.libraryPath = libraryPath
|
||||
}
|
||||
}
|
||||
93
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/return.go
generated
vendored
93
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/return.go
generated
vendored
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package nvml
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
)
|
||||
|
||||
// String returns the string representation of a Return
|
||||
func (r Return) String() string {
|
||||
return errorStringFunc(nvml.Return(r))
|
||||
}
|
||||
|
||||
// Error returns the string representation of a Return
|
||||
func (r Return) Error() string {
|
||||
return errorStringFunc(nvml.Return(r))
|
||||
}
|
||||
|
||||
// Assigned to nvml.ErrorString if the system nvml library is in use
|
||||
var errorStringFunc = defaultErrorStringFunc
|
||||
|
||||
var defaultErrorStringFunc = func(r nvml.Return) string {
|
||||
switch Return(r) {
|
||||
case SUCCESS:
|
||||
return "SUCCESS"
|
||||
case ERROR_UNINITIALIZED:
|
||||
return "ERROR_UNINITIALIZED"
|
||||
case ERROR_INVALID_ARGUMENT:
|
||||
return "ERROR_INVALID_ARGUMENT"
|
||||
case ERROR_NOT_SUPPORTED:
|
||||
return "ERROR_NOT_SUPPORTED"
|
||||
case ERROR_NO_PERMISSION:
|
||||
return "ERROR_NO_PERMISSION"
|
||||
case ERROR_ALREADY_INITIALIZED:
|
||||
return "ERROR_ALREADY_INITIALIZED"
|
||||
case ERROR_NOT_FOUND:
|
||||
return "ERROR_NOT_FOUND"
|
||||
case ERROR_INSUFFICIENT_SIZE:
|
||||
return "ERROR_INSUFFICIENT_SIZE"
|
||||
case ERROR_INSUFFICIENT_POWER:
|
||||
return "ERROR_INSUFFICIENT_POWER"
|
||||
case ERROR_DRIVER_NOT_LOADED:
|
||||
return "ERROR_DRIVER_NOT_LOADED"
|
||||
case ERROR_TIMEOUT:
|
||||
return "ERROR_TIMEOUT"
|
||||
case ERROR_IRQ_ISSUE:
|
||||
return "ERROR_IRQ_ISSUE"
|
||||
case ERROR_LIBRARY_NOT_FOUND:
|
||||
return "ERROR_LIBRARY_NOT_FOUND"
|
||||
case ERROR_FUNCTION_NOT_FOUND:
|
||||
return "ERROR_FUNCTION_NOT_FOUND"
|
||||
case ERROR_CORRUPTED_INFOROM:
|
||||
return "ERROR_CORRUPTED_INFOROM"
|
||||
case ERROR_GPU_IS_LOST:
|
||||
return "ERROR_GPU_IS_LOST"
|
||||
case ERROR_RESET_REQUIRED:
|
||||
return "ERROR_RESET_REQUIRED"
|
||||
case ERROR_OPERATING_SYSTEM:
|
||||
return "ERROR_OPERATING_SYSTEM"
|
||||
case ERROR_LIB_RM_VERSION_MISMATCH:
|
||||
return "ERROR_LIB_RM_VERSION_MISMATCH"
|
||||
case ERROR_IN_USE:
|
||||
return "ERROR_IN_USE"
|
||||
case ERROR_MEMORY:
|
||||
return "ERROR_MEMORY"
|
||||
case ERROR_NO_DATA:
|
||||
return "ERROR_NO_DATA"
|
||||
case ERROR_VGPU_ECC_NOT_SUPPORTED:
|
||||
return "ERROR_VGPU_ECC_NOT_SUPPORTED"
|
||||
case ERROR_INSUFFICIENT_RESOURCES:
|
||||
return "ERROR_INSUFFICIENT_RESOURCES"
|
||||
case ERROR_UNKNOWN:
|
||||
return "ERROR_UNKNOWN"
|
||||
default:
|
||||
return fmt.Sprintf("Unknown return value: %d", r)
|
||||
}
|
||||
}
|
||||
162
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/types.go
generated
vendored
162
vendor/github.com/NVIDIA/go-nvlib/pkg/nvml/types.go
generated
vendored
@@ -1,162 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package nvml
|
||||
|
||||
import (
|
||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
)
|
||||
|
||||
// Interface defines the functions implemented by an NVML library
|
||||
//
|
||||
//go:generate moq -out nvml_mock.go . Interface
|
||||
type Interface interface {
|
||||
DeviceGetCount() (int, Return)
|
||||
DeviceGetHandleByIndex(Index int) (Device, Return)
|
||||
DeviceGetHandleByUUID(UUID string) (Device, Return)
|
||||
ErrorString(r Return) string
|
||||
EventSetCreate() (EventSet, Return)
|
||||
Init() Return
|
||||
Lookup(string) error
|
||||
Shutdown() Return
|
||||
SystemGetCudaDriverVersion() (int, Return)
|
||||
SystemGetDriverVersion() (string, Return)
|
||||
}
|
||||
|
||||
// Device defines the functions implemented by an NVML device
|
||||
//
|
||||
//go:generate moq -out device_mock.go . Device
|
||||
type Device interface {
|
||||
CreateGpuInstanceWithPlacement(*GpuInstanceProfileInfo, *GpuInstancePlacement) (GpuInstance, Return)
|
||||
GetArchitecture() (DeviceArchitecture, Return)
|
||||
GetAttributes() (DeviceAttributes, Return)
|
||||
GetBrand() (BrandType, Return)
|
||||
GetComputeInstanceId() (int, Return)
|
||||
GetCudaComputeCapability() (int, int, Return)
|
||||
GetDeviceHandleFromMigDeviceHandle() (Device, Return)
|
||||
GetGpuInstanceById(ID int) (GpuInstance, Return)
|
||||
GetGpuInstanceId() (int, Return)
|
||||
GetGpuInstancePossiblePlacements(*GpuInstanceProfileInfo) ([]GpuInstancePlacement, Return)
|
||||
GetGpuInstanceProfileInfo(Profile int) (GpuInstanceProfileInfo, Return)
|
||||
GetGpuInstances(Info *GpuInstanceProfileInfo) ([]GpuInstance, Return)
|
||||
GetIndex() (int, Return)
|
||||
GetMaxMigDeviceCount() (int, Return)
|
||||
GetMemoryInfo() (Memory, Return)
|
||||
GetMigDeviceHandleByIndex(Index int) (Device, Return)
|
||||
GetMigMode() (int, int, Return)
|
||||
GetMinorNumber() (int, Return)
|
||||
GetName() (string, Return)
|
||||
GetNvLinkRemotePciInfo(int) (PciInfo, Return)
|
||||
GetNvLinkState(int) (EnableState, Return)
|
||||
GetPciInfo() (PciInfo, Return)
|
||||
GetSupportedEventTypes() (uint64, Return)
|
||||
GetTopologyCommonAncestor(Device) (GpuTopologyLevel, Return)
|
||||
GetUUID() (string, Return)
|
||||
IsMigDeviceHandle() (bool, Return)
|
||||
RegisterEvents(uint64, EventSet) Return
|
||||
SetComputeMode(ComputeMode) Return
|
||||
SetMigMode(Mode int) (Return, Return)
|
||||
// nvmlDeviceHandle returns a pointer to the underlying NVML device.
|
||||
nvmlDeviceHandle() *nvml.Device
|
||||
}
|
||||
|
||||
// GpuInstance defines the functions implemented by a GpuInstance
|
||||
//
|
||||
//go:generate moq -out gi_mock.go . GpuInstance
|
||||
type GpuInstance interface {
|
||||
CreateComputeInstance(Info *ComputeInstanceProfileInfo) (ComputeInstance, Return)
|
||||
Destroy() Return
|
||||
GetComputeInstanceById(ID int) (ComputeInstance, Return)
|
||||
GetComputeInstanceProfileInfo(Profile int, EngProfile int) (ComputeInstanceProfileInfo, Return)
|
||||
GetComputeInstances(Info *ComputeInstanceProfileInfo) ([]ComputeInstance, Return)
|
||||
GetInfo() (GpuInstanceInfo, Return)
|
||||
}
|
||||
|
||||
// ComputeInstance defines the functions implemented by a ComputeInstance
|
||||
//
|
||||
//go:generate moq -out ci_mock.go . ComputeInstance
|
||||
type ComputeInstance interface {
|
||||
Destroy() Return
|
||||
GetInfo() (ComputeInstanceInfo, Return)
|
||||
}
|
||||
|
||||
// GpuInstanceInfo holds info about a GPU Instance
|
||||
type GpuInstanceInfo struct {
|
||||
Device Device
|
||||
Id uint32
|
||||
ProfileId uint32
|
||||
Placement GpuInstancePlacement
|
||||
}
|
||||
|
||||
// ComputeInstanceInfo holds info about a Compute Instance
|
||||
type ComputeInstanceInfo struct {
|
||||
Device Device
|
||||
GpuInstance GpuInstance
|
||||
Id uint32
|
||||
ProfileId uint32
|
||||
Placement ComputeInstancePlacement
|
||||
}
|
||||
|
||||
// EventData defines NVML event Data
|
||||
type EventData struct {
|
||||
Device Device
|
||||
EventType uint64
|
||||
EventData uint64
|
||||
GpuInstanceId uint32
|
||||
ComputeInstanceId uint32
|
||||
}
|
||||
|
||||
// EventSet defines NVML event Data
|
||||
type EventSet nvml.EventSet
|
||||
|
||||
// Return defines an NVML return type
|
||||
type Return nvml.Return
|
||||
|
||||
// Memory holds info about GPU device memory
|
||||
type Memory nvml.Memory
|
||||
|
||||
// PciInfo holds info about the PCI connections of a GPU dvice
|
||||
type PciInfo nvml.PciInfo
|
||||
|
||||
// GpuInstanceProfileInfo holds info about a GPU Instance Profile
|
||||
type GpuInstanceProfileInfo nvml.GpuInstanceProfileInfo
|
||||
|
||||
// GpuInstancePlacement holds placement info about a GPU Instance
|
||||
type GpuInstancePlacement nvml.GpuInstancePlacement
|
||||
|
||||
// ComputeInstanceProfileInfo holds info about a Compute Instance Profile
|
||||
type ComputeInstanceProfileInfo nvml.ComputeInstanceProfileInfo
|
||||
|
||||
// ComputeInstancePlacement holds placement info about a Compute Instance
|
||||
type ComputeInstancePlacement nvml.ComputeInstancePlacement
|
||||
|
||||
// DeviceAttributes stores information about MIG devices
|
||||
type DeviceAttributes nvml.DeviceAttributes
|
||||
|
||||
// DeviceArchitecture represents the hardware architecture of a GPU device
|
||||
type DeviceArchitecture nvml.DeviceArchitecture
|
||||
|
||||
// BrandType represents the brand of a GPU device
|
||||
type BrandType nvml.BrandType
|
||||
|
||||
// GpuTopologyLevel represents level relationships within a system between two GPUs
|
||||
type GpuTopologyLevel nvml.GpuTopologyLevel
|
||||
|
||||
// EnableState represents a generic enable/disable enum
|
||||
type EnableState nvml.EnableState
|
||||
|
||||
// ComputeMode represents the compute mode for a device
|
||||
type ComputeMode nvml.ComputeMode
|
||||
14
vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/bytes/bytes.go
generated
vendored
14
vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/bytes/bytes.go
generated
vendored
@@ -21,12 +21,12 @@ import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Raw returns just the bytes without any assumptions about layout
|
||||
// Raw returns just the bytes without any assumptions about layout.
|
||||
type Raw interface {
|
||||
Raw() *[]byte
|
||||
}
|
||||
|
||||
// Reader used to read various data sizes in the byte array
|
||||
// Reader used to read various data sizes in the byte array.
|
||||
type Reader interface {
|
||||
Read8(pos int) uint8
|
||||
Read16(pos int) uint16
|
||||
@@ -35,7 +35,7 @@ type Reader interface {
|
||||
Len() int
|
||||
}
|
||||
|
||||
// Writer used to write various sizes of data in the byte array
|
||||
// Writer used to write various sizes of data in the byte array.
|
||||
type Writer interface {
|
||||
Write8(pos int, value uint8)
|
||||
Write16(pos int, value uint16)
|
||||
@@ -44,7 +44,7 @@ type Writer interface {
|
||||
Len() int
|
||||
}
|
||||
|
||||
// Bytes object for manipulating arbitrary byte arrays
|
||||
// Bytes object for manipulating arbitrary byte arrays.
|
||||
type Bytes interface {
|
||||
Raw
|
||||
Reader
|
||||
@@ -70,12 +70,12 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
// New raw bytearray
|
||||
// New raw bytearray.
|
||||
func New(data *[]byte) Bytes {
|
||||
return (*native)(data)
|
||||
}
|
||||
|
||||
// NewLittleEndian little endian ordering of bytes
|
||||
// NewLittleEndian little endian ordering of bytes.
|
||||
func NewLittleEndian(data *[]byte) Bytes {
|
||||
if nativeByteOrder == binary.LittleEndian {
|
||||
return (*native)(data)
|
||||
@@ -84,7 +84,7 @@ func NewLittleEndian(data *[]byte) Bytes {
|
||||
return (*swapbo)(data)
|
||||
}
|
||||
|
||||
// NewBigEndian big endian ordering of bytes
|
||||
// NewBigEndian big endian ordering of bytes.
|
||||
func NewBigEndian(data *[]byte) Bytes {
|
||||
if nativeByteOrder == binary.BigEndian {
|
||||
return (*native)(data)
|
||||
|
||||
20
vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/config.go
generated
vendored
20
vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/config.go
generated
vendored
@@ -24,24 +24,24 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// PCICfgSpaceStandardSize represents the size in bytes of the standard config space
|
||||
// PCICfgSpaceStandardSize represents the size in bytes of the standard config space.
|
||||
PCICfgSpaceStandardSize = 256
|
||||
// PCICfgSpaceExtendedSize represents the size in bytes of the extended config space
|
||||
// PCICfgSpaceExtendedSize represents the size in bytes of the extended config space.
|
||||
PCICfgSpaceExtendedSize = 4096
|
||||
// PCICapabilityListPointer represents offset for the capability list pointer
|
||||
// PCICapabilityListPointer represents offset for the capability list pointer.
|
||||
PCICapabilityListPointer = 0x34
|
||||
// PCIStatusCapabilityList represents the status register bit which indicates capability list support
|
||||
// PCIStatusCapabilityList represents the status register bit which indicates capability list support.
|
||||
PCIStatusCapabilityList = 0x10
|
||||
// PCIStatusBytePosition represents the position of the status register
|
||||
// PCIStatusBytePosition represents the position of the status register.
|
||||
PCIStatusBytePosition = 0x06
|
||||
)
|
||||
|
||||
// ConfigSpace PCI configuration space (standard extended) file path
|
||||
// ConfigSpace PCI configuration space (standard extended) file path.
|
||||
type ConfigSpace struct {
|
||||
Path string
|
||||
}
|
||||
|
||||
// ConfigSpaceIO Interface for reading and writing raw and preconfigured values
|
||||
// ConfigSpaceIO Interface for reading and writing raw and preconfigured values.
|
||||
type ConfigSpaceIO interface {
|
||||
bytes.Bytes
|
||||
GetVendorID() uint16
|
||||
@@ -53,18 +53,18 @@ type configSpaceIO struct {
|
||||
bytes.Bytes
|
||||
}
|
||||
|
||||
// PCIStandardCapability standard PCI config space
|
||||
// PCIStandardCapability standard PCI config space.
|
||||
type PCIStandardCapability struct {
|
||||
bytes.Bytes
|
||||
}
|
||||
|
||||
// PCIExtendedCapability extended PCI config space
|
||||
// PCIExtendedCapability extended PCI config space.
|
||||
type PCIExtendedCapability struct {
|
||||
bytes.Bytes
|
||||
Version uint8
|
||||
}
|
||||
|
||||
// PCICapabilities combines the standard and extended config space
|
||||
// PCICapabilities combines the standard and extended config space.
|
||||
type PCICapabilities struct {
|
||||
Standard map[uint8]*PCIStandardCapability
|
||||
Extended map[uint16]*PCIExtendedCapability
|
||||
|
||||
18
vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/mlxpci.go
generated
vendored
18
vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/mlxpci.go
generated
vendored
@@ -22,15 +22,15 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// PCIMellanoxVendorID represents PCI vendor id for Mellanox
|
||||
// PCIMellanoxVendorID represents PCI vendor id for Mellanox.
|
||||
PCIMellanoxVendorID uint16 = 0x15b3
|
||||
// PCINetworkControllerClass represents the PCI class for network controllers
|
||||
// PCINetworkControllerClass represents the PCI class for network controllers.
|
||||
PCINetworkControllerClass uint32 = 0x020000
|
||||
// PCIBridgeClass represents the PCI class for network controllers
|
||||
// PCIBridgeClass represents the PCI class for network controllers.
|
||||
PCIBridgeClass uint32 = 0x060400
|
||||
)
|
||||
|
||||
// GetNetworkControllers returns all Mellanox Network Controller PCI devices on the system
|
||||
// GetNetworkControllers returns all Mellanox Network Controller PCI devices on the system.
|
||||
func (p *nvpci) GetNetworkControllers() ([]*NvidiaPCIDevice, error) {
|
||||
devices, err := p.GetAllDevices()
|
||||
if err != nil {
|
||||
@@ -47,7 +47,7 @@ func (p *nvpci) GetNetworkControllers() ([]*NvidiaPCIDevice, error) {
|
||||
return filtered, nil
|
||||
}
|
||||
|
||||
// GetPciBridges retrieves all Mellanox PCI(e) Bridges
|
||||
// GetPciBridges retrieves all Mellanox PCI(e) Bridges.
|
||||
func (p *nvpci) GetPciBridges() ([]*NvidiaPCIDevice, error) {
|
||||
devices, err := p.GetAllDevices()
|
||||
if err != nil {
|
||||
@@ -64,17 +64,17 @@ func (p *nvpci) GetPciBridges() ([]*NvidiaPCIDevice, error) {
|
||||
return filtered, nil
|
||||
}
|
||||
|
||||
// IsNetworkController if class == 0x300
|
||||
// IsNetworkController if class == 0x300.
|
||||
func (d *NvidiaPCIDevice) IsNetworkController() bool {
|
||||
return d.Class == PCINetworkControllerClass
|
||||
}
|
||||
|
||||
// IsPciBridge if class == 0x0604
|
||||
// IsPciBridge if class == 0x0604.
|
||||
func (d *NvidiaPCIDevice) IsPciBridge() bool {
|
||||
return d.Class == PCIBridgeClass
|
||||
}
|
||||
|
||||
// IsDPU returns if a device is a DPU
|
||||
// IsDPU returns if a device is a DPU.
|
||||
func (d *NvidiaPCIDevice) IsDPU() bool {
|
||||
if !strings.Contains(d.DeviceName, "BlueField") {
|
||||
return false
|
||||
@@ -87,7 +87,7 @@ func (d *NvidiaPCIDevice) IsDPU() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// GetDPUs returns all Mellanox DPU devices on the system
|
||||
// GetDPUs returns all Mellanox DPU devices on the system.
|
||||
func (p *nvpci) GetDPUs() ([]*NvidiaPCIDevice, error) {
|
||||
devices, err := p.GetNetworkControllers()
|
||||
if err != nil {
|
||||
|
||||
6
vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/mmio/mmio.go
generated
vendored
6
vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/mmio/mmio.go
generated
vendored
@@ -25,7 +25,7 @@ import (
|
||||
"github.com/NVIDIA/go-nvlib/pkg/nvpci/bytes"
|
||||
)
|
||||
|
||||
// Mmio memory map a region
|
||||
// Mmio memory map a region.
|
||||
type Mmio interface {
|
||||
bytes.Raw
|
||||
bytes.Reader
|
||||
@@ -84,12 +84,12 @@ func open(path string, offset int, size int, flags int) (Mmio, error) {
|
||||
return &mmio{bytes.New(&mmap)}, nil
|
||||
}
|
||||
|
||||
// OpenRO open region readonly
|
||||
// OpenRO open region readonly.
|
||||
func OpenRO(path string, offset int, size int) (Mmio, error) {
|
||||
return open(path, offset, size, os.O_RDONLY)
|
||||
}
|
||||
|
||||
// OpenRW open region read write
|
||||
// OpenRW open region read write.
|
||||
func OpenRW(path string, offset int, size int) (Mmio, error) {
|
||||
return open(path, offset, size, os.O_RDWR)
|
||||
}
|
||||
|
||||
9
vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/mmio/mock.go
generated
vendored
9
vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/mmio/mock.go
generated
vendored
@@ -48,18 +48,21 @@ func mockOpen(source *[]byte, offset int, size int, rw bool) (Mmio, error) {
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// MockOpenRO open read only
|
||||
// MockOpenRO open read only.
|
||||
func MockOpenRO(source *[]byte, offset int, size int) (Mmio, error) {
|
||||
return mockOpen(source, offset, size, false)
|
||||
}
|
||||
|
||||
// MockOpenRW open read write
|
||||
// MockOpenRW open read write.
|
||||
func MockOpenRW(source *[]byte, offset int, size int) (Mmio, error) {
|
||||
return mockOpen(source, offset, size, true)
|
||||
}
|
||||
|
||||
func (m *mockMmio) Close() error {
|
||||
m = &mockMmio{}
|
||||
m.Bytes = nil
|
||||
m.source = nil
|
||||
m.offset = 0
|
||||
m.rw = false
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
8
vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/mock.go
generated
vendored
8
vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/mock.go
generated
vendored
@@ -24,14 +24,14 @@ import (
|
||||
"github.com/NVIDIA/go-nvlib/pkg/nvpci/bytes"
|
||||
)
|
||||
|
||||
// MockNvpci mock pci device
|
||||
// MockNvpci mock pci device.
|
||||
type MockNvpci struct {
|
||||
*nvpci
|
||||
}
|
||||
|
||||
var _ Interface = (*MockNvpci)(nil)
|
||||
|
||||
// NewMockNvpci create new mock PCI and remove old devices
|
||||
// NewMockNvpci create new mock PCI and remove old devices.
|
||||
func NewMockNvpci() (mock *MockNvpci, rerr error) {
|
||||
rootDir, err := os.MkdirTemp(os.TempDir(), "")
|
||||
if err != nil {
|
||||
@@ -50,12 +50,12 @@ func NewMockNvpci() (mock *MockNvpci, rerr error) {
|
||||
return mock, nil
|
||||
}
|
||||
|
||||
// Cleanup remove the mocked PCI devices root folder
|
||||
// Cleanup remove the mocked PCI devices root folder.
|
||||
func (m *MockNvpci) Cleanup() {
|
||||
os.RemoveAll(m.pciDevicesRoot)
|
||||
}
|
||||
|
||||
// AddMockA100 Create an A100 like GPU mock device
|
||||
// AddMockA100 Create an A100 like GPU mock device.
|
||||
func (m *MockNvpci) AddMockA100(address string, numaNode int) error {
|
||||
deviceDir := filepath.Join(m.pciDevicesRoot, address)
|
||||
err := os.MkdirAll(deviceDir, 0755)
|
||||
|
||||
56
vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/nvpci.go
generated
vendored
56
vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/nvpci.go
generated
vendored
@@ -29,23 +29,23 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// PCIDevicesRoot represents base path for all pci devices under sysfs
|
||||
// PCIDevicesRoot represents base path for all pci devices under sysfs.
|
||||
PCIDevicesRoot = "/sys/bus/pci/devices"
|
||||
// PCINvidiaVendorID represents PCI vendor id for NVIDIA
|
||||
// PCINvidiaVendorID represents PCI vendor id for NVIDIA.
|
||||
PCINvidiaVendorID uint16 = 0x10de
|
||||
// PCIVgaControllerClass represents the PCI class for VGA Controllers
|
||||
// PCIVgaControllerClass represents the PCI class for VGA Controllers.
|
||||
PCIVgaControllerClass uint32 = 0x030000
|
||||
// PCI3dControllerClass represents the PCI class for 3D Graphics accellerators
|
||||
// PCI3dControllerClass represents the PCI class for 3D Graphics accellerators.
|
||||
PCI3dControllerClass uint32 = 0x030200
|
||||
// PCINvSwitchClass represents the PCI class for NVSwitches
|
||||
// PCINvSwitchClass represents the PCI class for NVSwitches.
|
||||
PCINvSwitchClass uint32 = 0x068000
|
||||
// UnknownDeviceString is the device name to set for devices not found in the PCI database
|
||||
// UnknownDeviceString is the device name to set for devices not found in the PCI database.
|
||||
UnknownDeviceString = "UNKNOWN_DEVICE"
|
||||
// UnknownClassString is the class name to set for devices not found in the PCI database
|
||||
// UnknownClassString is the class name to set for devices not found in the PCI database.
|
||||
UnknownClassString = "UNKNOWN_CLASS"
|
||||
)
|
||||
|
||||
// Interface allows us to get a list of all NVIDIA PCI devices
|
||||
// Interface allows us to get a list of all NVIDIA PCI devices.
|
||||
type Interface interface {
|
||||
GetAllDevices() ([]*NvidiaPCIDevice, error)
|
||||
Get3DControllers() ([]*NvidiaPCIDevice, error)
|
||||
@@ -59,10 +59,10 @@ type Interface interface {
|
||||
GetDPUs() ([]*NvidiaPCIDevice, error)
|
||||
}
|
||||
|
||||
// MemoryResources a more human readable handle
|
||||
// MemoryResources a more human readable handle.
|
||||
type MemoryResources map[int]*MemoryResource
|
||||
|
||||
// ResourceInterface exposes some higher level functions of resources
|
||||
// ResourceInterface exposes some higher level functions of resources.
|
||||
type ResourceInterface interface {
|
||||
GetTotalAddressableMemory(bool) (uint64, uint64)
|
||||
}
|
||||
@@ -76,7 +76,7 @@ type nvpci struct {
|
||||
var _ Interface = (*nvpci)(nil)
|
||||
var _ ResourceInterface = (*MemoryResources)(nil)
|
||||
|
||||
// NvidiaPCIDevice represents a PCI device for an NVIDIA product
|
||||
// NvidiaPCIDevice represents a PCI device for an NVIDIA product.
|
||||
type NvidiaPCIDevice struct {
|
||||
Path string
|
||||
Address string
|
||||
@@ -93,34 +93,34 @@ type NvidiaPCIDevice struct {
|
||||
IsVF bool
|
||||
}
|
||||
|
||||
// IsVGAController if class == 0x300
|
||||
// IsVGAController if class == 0x300.
|
||||
func (d *NvidiaPCIDevice) IsVGAController() bool {
|
||||
return d.Class == PCIVgaControllerClass
|
||||
}
|
||||
|
||||
// Is3DController if class == 0x302
|
||||
// Is3DController if class == 0x302.
|
||||
func (d *NvidiaPCIDevice) Is3DController() bool {
|
||||
return d.Class == PCI3dControllerClass
|
||||
}
|
||||
|
||||
// IsNVSwitch if class == 0x068
|
||||
// IsNVSwitch if class == 0x068.
|
||||
func (d *NvidiaPCIDevice) IsNVSwitch() bool {
|
||||
return d.Class == PCINvSwitchClass
|
||||
}
|
||||
|
||||
// IsGPU either VGA for older cards or 3D for newer
|
||||
// IsGPU either VGA for older cards or 3D for newer.
|
||||
func (d *NvidiaPCIDevice) IsGPU() bool {
|
||||
return d.IsVGAController() || d.Is3DController()
|
||||
}
|
||||
|
||||
// IsResetAvailable some devices can be reset without rebooting,
|
||||
// check if applicable
|
||||
// check if applicable.
|
||||
func (d *NvidiaPCIDevice) IsResetAvailable() bool {
|
||||
_, err := os.Stat(path.Join(d.Path, "reset"))
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// Reset perform a reset to apply a new configuration at HW level
|
||||
// Reset perform a reset to apply a new configuration at HW level.
|
||||
func (d *NvidiaPCIDevice) Reset() error {
|
||||
err := os.WriteFile(path.Join(d.Path, "reset"), []byte("1"), 0)
|
||||
if err != nil {
|
||||
@@ -129,7 +129,7 @@ func (d *NvidiaPCIDevice) Reset() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// New interface that allows us to get a list of all NVIDIA PCI devices
|
||||
// New interface that allows us to get a list of all NVIDIA PCI devices.
|
||||
func New(opts ...Option) Interface {
|
||||
n := &nvpci{}
|
||||
for _, opt := range opts {
|
||||
@@ -144,10 +144,10 @@ func New(opts ...Option) Interface {
|
||||
return n
|
||||
}
|
||||
|
||||
// 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(*nvpci)
|
||||
|
||||
// WithLogger provides an Option to set the logger for the library
|
||||
// WithLogger provides an Option to set the logger for the library.
|
||||
func WithLogger(logger logger) Option {
|
||||
return func(n *nvpci) {
|
||||
n.logger = logger
|
||||
@@ -170,7 +170,7 @@ func WithPCIDatabasePath(path string) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// GetAllDevices returns all Nvidia PCI devices on the system
|
||||
// GetAllDevices returns all Nvidia PCI devices on the system.
|
||||
func (p *nvpci) GetAllDevices() ([]*NvidiaPCIDevice, error) {
|
||||
deviceDirs, err := os.ReadDir(p.pciDevicesRoot)
|
||||
if err != nil {
|
||||
@@ -204,7 +204,7 @@ func (p *nvpci) GetAllDevices() ([]*NvidiaPCIDevice, error) {
|
||||
return nvdevices, nil
|
||||
}
|
||||
|
||||
// GetGPUByPciBusID constructs an NvidiaPCIDevice for the specified address (PCI Bus ID)
|
||||
// GetGPUByPciBusID constructs an NvidiaPCIDevice for the specified address (PCI Bus ID).
|
||||
func (p *nvpci) GetGPUByPciBusID(address string) (*NvidiaPCIDevice, error) {
|
||||
devicePath := filepath.Join(p.pciDevicesRoot, address)
|
||||
|
||||
@@ -265,7 +265,7 @@ func (p *nvpci) GetGPUByPciBusID(address string) (*NvidiaPCIDevice, error) {
|
||||
return nil, fmt.Errorf("unable to detect iommu_group for %s: %v", address, err)
|
||||
}
|
||||
|
||||
// device is a virtual function (VF) if "physfn" symlink exists
|
||||
// device is a virtual function (VF) if "physfn" symlink exists.
|
||||
var isVF bool
|
||||
_, err = filepath.EvalSymlinks(path.Join(devicePath, "physfn"))
|
||||
if err == nil {
|
||||
@@ -347,7 +347,7 @@ func (p *nvpci) GetGPUByPciBusID(address string) (*NvidiaPCIDevice, error) {
|
||||
return nvdevice, nil
|
||||
}
|
||||
|
||||
// Get3DControllers returns all NVIDIA 3D Controller PCI devices on the system
|
||||
// Get3DControllers returns all NVIDIA 3D Controller PCI devices on the system.
|
||||
func (p *nvpci) Get3DControllers() ([]*NvidiaPCIDevice, error) {
|
||||
devices, err := p.GetAllDevices()
|
||||
if err != nil {
|
||||
@@ -364,7 +364,7 @@ func (p *nvpci) Get3DControllers() ([]*NvidiaPCIDevice, error) {
|
||||
return filtered, nil
|
||||
}
|
||||
|
||||
// GetVGAControllers returns all NVIDIA VGA Controller PCI devices on the system
|
||||
// GetVGAControllers returns all NVIDIA VGA Controller PCI devices on the system.
|
||||
func (p *nvpci) GetVGAControllers() ([]*NvidiaPCIDevice, error) {
|
||||
devices, err := p.GetAllDevices()
|
||||
if err != nil {
|
||||
@@ -381,7 +381,7 @@ func (p *nvpci) GetVGAControllers() ([]*NvidiaPCIDevice, error) {
|
||||
return filtered, nil
|
||||
}
|
||||
|
||||
// GetNVSwitches returns all NVIDIA NVSwitch PCI devices on the system
|
||||
// GetNVSwitches returns all NVIDIA NVSwitch PCI devices on the system.
|
||||
func (p *nvpci) GetNVSwitches() ([]*NvidiaPCIDevice, error) {
|
||||
devices, err := p.GetAllDevices()
|
||||
if err != nil {
|
||||
@@ -398,7 +398,7 @@ func (p *nvpci) GetNVSwitches() ([]*NvidiaPCIDevice, error) {
|
||||
return filtered, nil
|
||||
}
|
||||
|
||||
// GetGPUs returns all NVIDIA GPU devices on the system
|
||||
// GetGPUs returns all NVIDIA GPU devices on the system.
|
||||
func (p *nvpci) GetGPUs() ([]*NvidiaPCIDevice, error) {
|
||||
devices, err := p.GetAllDevices()
|
||||
if err != nil {
|
||||
@@ -415,7 +415,7 @@ func (p *nvpci) GetGPUs() ([]*NvidiaPCIDevice, error) {
|
||||
return filtered, nil
|
||||
}
|
||||
|
||||
// GetGPUByIndex returns an NVIDIA GPU device at a particular index
|
||||
// GetGPUByIndex returns an NVIDIA GPU device at a particular index.
|
||||
func (p *nvpci) GetGPUByIndex(i int) (*NvidiaPCIDevice, error) {
|
||||
gpus, err := p.GetGPUs()
|
||||
if err != nil {
|
||||
|
||||
10
vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/resources.go
generated
vendored
10
vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/resources.go
generated
vendored
@@ -29,7 +29,7 @@ const (
|
||||
pmcBigEndian = 0x01000001
|
||||
)
|
||||
|
||||
// MemoryResource represents a mmio region
|
||||
// MemoryResource represents a mmio region.
|
||||
type MemoryResource struct {
|
||||
Start uintptr
|
||||
End uintptr
|
||||
@@ -37,7 +37,7 @@ type MemoryResource struct {
|
||||
Path string
|
||||
}
|
||||
|
||||
// OpenRW read write mmio region
|
||||
// OpenRW read write mmio region.
|
||||
func (mr *MemoryResource) OpenRW() (mmio.Mmio, error) {
|
||||
rw, err := mmio.OpenRW(mr.Path, 0, int(mr.End-mr.Start+1))
|
||||
if err != nil {
|
||||
@@ -52,7 +52,7 @@ func (mr *MemoryResource) OpenRW() (mmio.Mmio, error) {
|
||||
return nil, fmt.Errorf("unknown endianness for mmio: %v", err)
|
||||
}
|
||||
|
||||
// OpenRO read only mmio region
|
||||
// OpenRO read only mmio region.
|
||||
func (mr *MemoryResource) OpenRO() (mmio.Mmio, error) {
|
||||
ro, err := mmio.OpenRO(mr.Path, 0, int(mr.End-mr.Start+1))
|
||||
if err != nil {
|
||||
@@ -67,7 +67,7 @@ func (mr *MemoryResource) OpenRO() (mmio.Mmio, error) {
|
||||
return nil, fmt.Errorf("unknown endianness for mmio: %v", err)
|
||||
}
|
||||
|
||||
// From Bit Twiddling Hacks, great resource for all low level bit manipulations
|
||||
// From Bit Twiddling Hacks, great resource for all low level bit manipulations.
|
||||
func calcNextPowerOf2(n uint64) uint64 {
|
||||
n--
|
||||
n |= n >> 1
|
||||
@@ -83,7 +83,7 @@ func calcNextPowerOf2(n uint64) uint64 {
|
||||
|
||||
// GetTotalAddressableMemory will accumulate the 32bit and 64bit memory windows
|
||||
// of each BAR and round the value if needed to the next power of 2; first
|
||||
// return value is the accumulated 32bit addresable memory size the second one
|
||||
// return value is the accumulated 32bit addressable memory size the second one
|
||||
// is the accumulated 64bit addressable memory size in bytes. These values are
|
||||
// needed to configure virtualized environments.
|
||||
func (mrs MemoryResources) GetTotalAddressableMemory(roundUp bool) (uint64, uint64) {
|
||||
|
||||
76
vendor/github.com/NVIDIA/go-nvlib/pkg/pciids/pciids.go
generated
vendored
76
vendor/github.com/NVIDIA/go-nvlib/pkg/pciids/pciids.go
generated
vendored
@@ -11,42 +11,42 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// token what the Lexer retruns
|
||||
// token what the Lexer retruns.
|
||||
type token int
|
||||
|
||||
const (
|
||||
// ILLEGAL a token which the Lexer does not understand
|
||||
// ILLEGAL a token which the Lexer does not understand.
|
||||
ILLEGAL token = iota
|
||||
// EOF end of file
|
||||
// EOF end of file.
|
||||
EOF
|
||||
// WS whitespace
|
||||
// WS whitespace.
|
||||
WS
|
||||
// NEWLINE '\n'
|
||||
// NEWLINE '\n'.
|
||||
NEWLINE
|
||||
// COMMENT '# something'
|
||||
// COMMENT '# something'.
|
||||
COMMENT
|
||||
// VENDOR PCI vendor
|
||||
// VENDOR PCI vendor.
|
||||
VENDOR
|
||||
// SUBVENDOR PCI subvendor
|
||||
// SUBVENDOR PCI subvendor.
|
||||
SUBVENDOR
|
||||
// DEVICE PCI device
|
||||
// DEVICE PCI device.
|
||||
DEVICE
|
||||
// CLASS PCI class
|
||||
// CLASS PCI class.
|
||||
CLASS
|
||||
// SUBCLASS PCI subclass
|
||||
// SUBCLASS PCI subclass.
|
||||
SUBCLASS
|
||||
// PROGIF PCI programming interface
|
||||
// PROGIF PCI programming interface.
|
||||
PROGIF
|
||||
)
|
||||
|
||||
// literal values from the Lexer
|
||||
// literal values from the Lexer.
|
||||
type literal struct {
|
||||
ID string
|
||||
name string
|
||||
SubName string
|
||||
}
|
||||
|
||||
// scanner a lexical scanner
|
||||
// scanner a lexical scanner.
|
||||
type scanner struct {
|
||||
r *bufio.Reader
|
||||
isVendor bool
|
||||
@@ -58,7 +58,7 @@ func newScanner(r io.Reader) *scanner {
|
||||
}
|
||||
|
||||
// Since the pci.ids is line base we're consuming a whole line rather then only
|
||||
// a single rune/char
|
||||
// a single rune/char.
|
||||
func (s *scanner) readline() []byte {
|
||||
ln, err := s.r.ReadBytes('\n')
|
||||
if err == io.EOF {
|
||||
@@ -107,7 +107,7 @@ func isSubVendor(ln []byte) bool { return isLeadingTwoTabs(ln) }
|
||||
func isDevice(ln []byte) bool { return isLeadingOneTab(ln) }
|
||||
func isNewline(ln []byte) bool { return (ln[0] == '\n') }
|
||||
|
||||
// List of known device classes, subclasses and programming interfaces
|
||||
// List of known device classes, subclasses and programming interfaces.
|
||||
func isClass(ln []byte) bool { return (ln[0] == 'C') }
|
||||
func isProgIf(ln []byte) bool { return isLeadingTwoTabs(ln) }
|
||||
func isSubClass(ln []byte) bool { return isLeadingOneTab(ln) }
|
||||
@@ -162,7 +162,7 @@ func (s *scanner) scan() (tok token, lit literal) {
|
||||
return ILLEGAL, literal{ID: string(line)}
|
||||
}
|
||||
|
||||
// parser reads the tokens returned by the Lexer and constructs the AST
|
||||
// parser reads the tokens returned by the Lexer and constructs the AST.
|
||||
type parser struct {
|
||||
s *scanner
|
||||
buf struct {
|
||||
@@ -173,7 +173,7 @@ type parser struct {
|
||||
}
|
||||
|
||||
// Various locations of pci.ids for different distributions. These may be more
|
||||
// up to date then the embedded pci.ids db
|
||||
// up to date then the embedded pci.ids db.
|
||||
var defaultPCIdbPaths = []string{
|
||||
"/usr/share/misc/pci.ids", // Ubuntu
|
||||
"/usr/local/share/pci.ids", // RHEL like with manual update
|
||||
@@ -202,7 +202,7 @@ func NewDB(opts ...Option) Interface {
|
||||
return newParser(pcidbs).parse()
|
||||
}
|
||||
|
||||
// Option defines a function for passing options to the NewDB() call
|
||||
// Option defines a function for passing options to the NewDB() call.
|
||||
type Option func(*pcidb)
|
||||
|
||||
// WithFilePath provides an Option to set the file path
|
||||
@@ -216,7 +216,7 @@ func WithFilePath(path string) Option {
|
||||
}
|
||||
|
||||
// newParser will attempt to read the db pci.ids from well known places or fall
|
||||
// back to an internal db
|
||||
// back to an internal db.
|
||||
func newParser(pcidbs []string) *parser {
|
||||
|
||||
for _, db := range pcidbs {
|
||||
@@ -229,7 +229,7 @@ func newParser(pcidbs []string) *parser {
|
||||
}
|
||||
// We're using go embed above to have the byte array
|
||||
// correctly initialized with the internal shipped db
|
||||
// if we cannot find an up to date in the filesystem
|
||||
// if we cannot find an up to date in the filesystem.
|
||||
return newParserFromReader(bufio.NewReader(bytes.NewReader(defaultPCIdb)))
|
||||
}
|
||||
|
||||
@@ -252,13 +252,13 @@ func (p *parser) unscan() { p.buf.n = 1 }
|
||||
|
||||
var _ Interface = (*pcidb)(nil)
|
||||
|
||||
// Interface returns textual description of specific attributes of PCI devices
|
||||
// Interface returns textual description of specific attributes of PCI devices.
|
||||
type Interface interface {
|
||||
GetDeviceName(uint16, uint16) (string, error)
|
||||
GetClassName(uint32) (string, error)
|
||||
}
|
||||
|
||||
// GetDeviceName return the textual description of the PCI device
|
||||
// GetDeviceName return the textual description of the PCI device.
|
||||
func (d *pcidb) GetDeviceName(vendorID uint16, deviceID uint16) (string, error) {
|
||||
vendor, ok := d.vendors[vendorID]
|
||||
if !ok {
|
||||
@@ -273,7 +273,7 @@ func (d *pcidb) GetDeviceName(vendorID uint16, deviceID uint16) (string, error)
|
||||
return device.name, nil
|
||||
}
|
||||
|
||||
// GetClassName resturn the textual description of the PCI device class
|
||||
// GetClassName resturn the textual description of the PCI device class.
|
||||
func (d *pcidb) GetClassName(classID uint32) (string, error) {
|
||||
class, ok := d.classes[classID]
|
||||
if !ok {
|
||||
@@ -282,53 +282,53 @@ func (d *pcidb) GetClassName(classID uint32) (string, error) {
|
||||
return class.name, nil
|
||||
}
|
||||
|
||||
// pcidb The complete set of PCI vendors and PCI classes
|
||||
// pcidb The complete set of PCI vendors and PCI classes.
|
||||
type pcidb struct {
|
||||
vendors map[uint16]vendor
|
||||
classes map[uint32]class
|
||||
path string
|
||||
}
|
||||
|
||||
// vendor PCI vendors/devices/subVendors/SubDevices
|
||||
// vendor PCI vendors/devices/subVendors/SubDevices.
|
||||
type vendor struct {
|
||||
name string
|
||||
devices map[uint16]device
|
||||
}
|
||||
|
||||
// subVendor PCI subVendor
|
||||
// subVendor PCI subVendor.
|
||||
type subVendor struct {
|
||||
SubDevices map[uint16]SubDevice
|
||||
}
|
||||
|
||||
// SubDevice PCI SubDevice
|
||||
// SubDevice PCI SubDevice.
|
||||
type SubDevice struct {
|
||||
name string
|
||||
}
|
||||
|
||||
// device PCI device
|
||||
// device PCI device.
|
||||
type device struct {
|
||||
name string
|
||||
subVendors map[uint16]subVendor
|
||||
}
|
||||
|
||||
// class PCI classes/subClasses/Programming Interfaces
|
||||
// class PCI classes/subClasses/Programming Interfaces.
|
||||
type class struct {
|
||||
name string
|
||||
subClasses map[uint32]subClass
|
||||
}
|
||||
|
||||
// subClass PCI subClass
|
||||
// subClass PCI subClass.
|
||||
type subClass struct {
|
||||
name string
|
||||
progIfs map[uint8]progIf
|
||||
}
|
||||
|
||||
// progIf PCI Programming Interface
|
||||
// progIf PCI Programming Interface.
|
||||
type progIf struct {
|
||||
name string
|
||||
}
|
||||
|
||||
// parse parses a PCI IDS entry
|
||||
// parse parses a PCI IDS entry.
|
||||
func (p *parser) parse() Interface {
|
||||
|
||||
db := &pcidb{
|
||||
@@ -336,7 +336,7 @@ func (p *parser) parse() Interface {
|
||||
classes: map[uint32]class{},
|
||||
}
|
||||
|
||||
// Used for housekeeping, breadcrumb for aggregated types
|
||||
// Used for housekeeping, breadcrumb for aggregated types.
|
||||
var hkVendor vendor
|
||||
var hkDevice device
|
||||
|
||||
@@ -349,8 +349,8 @@ func (p *parser) parse() Interface {
|
||||
for {
|
||||
tok, lit := p.scan()
|
||||
|
||||
// We're ignoring COMMENT, NEWLINE
|
||||
// An EOF will break the loop
|
||||
// We're ignoring COMMENT, NEWLINE.
|
||||
// An EOF will break the loop.
|
||||
if tok == EOF {
|
||||
break
|
||||
}
|
||||
@@ -408,10 +408,10 @@ func (p *parser) parse() Interface {
|
||||
}
|
||||
hkSubClass = hkClass.subClasses[uint32(id)]
|
||||
|
||||
// Clear the last detected sub class
|
||||
// Clear the last detected sub class.
|
||||
hkFullID = hkFullID & 0xFFFF0000
|
||||
hkFullID = hkFullID | uint32(id)<<8
|
||||
// Clear the last detected prog iface
|
||||
// Clear the last detected prog iface.
|
||||
hkFullID = hkFullID & 0xFFFFFF00
|
||||
hkFullName[1] = fmt.Sprintf("%s (%02x)", lit.name, id)
|
||||
|
||||
|
||||
47
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/api.go
generated
vendored
47
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/api.go
generated
vendored
@@ -16,22 +16,41 @@
|
||||
|
||||
package nvml
|
||||
|
||||
// Library defines a set of functions defined on the underlying dynamic library.
|
||||
type Library interface {
|
||||
Lookup(string) error
|
||||
// ExtendedInterface defines a set of extensions to the core NVML API.
|
||||
//
|
||||
// TODO: For now the list of methods in this interface need to be kept in sync
|
||||
// with the list of excluded methods for the Interface type in
|
||||
// gen/nvml/generateapi.go. In the future we should automate this.
|
||||
//
|
||||
//go:generate moq -out mock/extendedinterface.go -pkg mock . ExtendedInterface:ExtendedInterface
|
||||
type ExtendedInterface interface {
|
||||
LookupSymbol(string) error
|
||||
}
|
||||
|
||||
// dynamicLibrary is an interface for abstacting the underlying library.
|
||||
// This also allows for mocking and testing.
|
||||
|
||||
//go:generate moq -stub -out dynamicLibrary_mock.go . dynamicLibrary
|
||||
type dynamicLibrary interface {
|
||||
Lookup(string) error
|
||||
Open() error
|
||||
Close() error
|
||||
// libraryOptions hold the paramaters than can be set by a LibraryOption
|
||||
type libraryOptions struct {
|
||||
path string
|
||||
flags int
|
||||
}
|
||||
|
||||
// Interface represents the interface for the NVML library.
|
||||
type Interface interface {
|
||||
GetLibrary() Library
|
||||
// LibraryOption represents a functional option to configure the underlying NVML library
|
||||
type LibraryOption func(*libraryOptions)
|
||||
|
||||
// WithLibraryPath provides an option to set the library name to be used by the NVML library.
|
||||
func WithLibraryPath(path string) LibraryOption {
|
||||
return func(o *libraryOptions) {
|
||||
o.path = path
|
||||
}
|
||||
}
|
||||
|
||||
// SetLibraryOptions applies the specified options to the NVML library.
|
||||
// If this is called when a library is already loaded, an error is raised.
|
||||
func SetLibraryOptions(opts ...LibraryOption) error {
|
||||
libnvml.Lock()
|
||||
defer libnvml.Unlock()
|
||||
if libnvml.refcount != 0 {
|
||||
return errLibraryAlreadyLoaded
|
||||
}
|
||||
libnvml.init(opts...)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -44,6 +44,17 @@ func uint32SliceToIntSlice(s []uint32) []int {
|
||||
return ret
|
||||
}
|
||||
|
||||
func convertSlice[T any, I any](input []T) []I {
|
||||
output := make([]I, len(input))
|
||||
for i, obj := range input {
|
||||
switch v := any(obj).(type) {
|
||||
case I:
|
||||
output[i] = v
|
||||
}
|
||||
}
|
||||
return output
|
||||
}
|
||||
|
||||
// packPCharString creates a Go string backed by *C.char and avoids copying.
|
||||
func packPCharString(p *C.char) (raw string) {
|
||||
if p != nil && *p != 0 {
|
||||
2851
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/device.go
generated
vendored
2851
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/device.go
generated
vendored
File diff suppressed because it is too large
Load Diff
55
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/event_set.go
generated
vendored
55
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/event_set.go
generated
vendored
@@ -14,29 +14,60 @@
|
||||
|
||||
package nvml
|
||||
|
||||
// EventData includes an interface type for Device instead of nvmlDevice
|
||||
type EventData struct {
|
||||
Device Device
|
||||
EventType uint64
|
||||
EventData uint64
|
||||
GpuInstanceId uint32
|
||||
ComputeInstanceId uint32
|
||||
}
|
||||
|
||||
func (e EventData) convert() nvmlEventData {
|
||||
out := nvmlEventData{
|
||||
Device: e.Device.(nvmlDevice),
|
||||
EventType: e.EventType,
|
||||
EventData: e.EventData,
|
||||
GpuInstanceId: e.GpuInstanceId,
|
||||
ComputeInstanceId: e.ComputeInstanceId,
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func (e nvmlEventData) convert() EventData {
|
||||
out := EventData{
|
||||
Device: e.Device,
|
||||
EventType: e.EventType,
|
||||
EventData: e.EventData,
|
||||
GpuInstanceId: e.GpuInstanceId,
|
||||
ComputeInstanceId: e.ComputeInstanceId,
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// nvml.EventSetCreate()
|
||||
func EventSetCreate() (EventSet, Return) {
|
||||
var Set EventSet
|
||||
func (l *library) EventSetCreate() (EventSet, Return) {
|
||||
var Set nvmlEventSet
|
||||
ret := nvmlEventSetCreate(&Set)
|
||||
return Set, ret
|
||||
}
|
||||
|
||||
// nvml.EventSetWait()
|
||||
func EventSetWait(Set EventSet, Timeoutms uint32) (EventData, Return) {
|
||||
var Data EventData
|
||||
ret := nvmlEventSetWait(Set, &Data, Timeoutms)
|
||||
return Data, ret
|
||||
func (l *library) EventSetWait(set EventSet, timeoutms uint32) (EventData, Return) {
|
||||
return set.Wait(timeoutms)
|
||||
}
|
||||
|
||||
func (Set EventSet) Wait(Timeoutms uint32) (EventData, Return) {
|
||||
return EventSetWait(Set, Timeoutms)
|
||||
func (set nvmlEventSet) Wait(timeoutms uint32) (EventData, Return) {
|
||||
var data nvmlEventData
|
||||
ret := nvmlEventSetWait(set, &data, timeoutms)
|
||||
return data.convert(), ret
|
||||
}
|
||||
|
||||
// nvml.EventSetFree()
|
||||
func EventSetFree(Set EventSet) Return {
|
||||
return nvmlEventSetFree(Set)
|
||||
func (l *library) EventSetFree(set EventSet) Return {
|
||||
return set.Free()
|
||||
}
|
||||
|
||||
func (Set EventSet) Free() Return {
|
||||
return EventSetFree(Set)
|
||||
func (set nvmlEventSet) Free() Return {
|
||||
return nvmlEventSetFree(set)
|
||||
}
|
||||
|
||||
128
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/gpm.go
generated
vendored
128
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/gpm.go
generated
vendored
@@ -14,80 +14,128 @@
|
||||
|
||||
package nvml
|
||||
|
||||
// GpmMetricsGetType includes interface types for GpmSample instead of nvmlGpmSample
|
||||
type GpmMetricsGetType struct {
|
||||
Version uint32
|
||||
NumMetrics uint32
|
||||
Sample1 GpmSample
|
||||
Sample2 GpmSample
|
||||
Metrics [98]GpmMetric
|
||||
}
|
||||
|
||||
func (g *GpmMetricsGetType) convert() *nvmlGpmMetricsGetType {
|
||||
out := &nvmlGpmMetricsGetType{
|
||||
Version: g.Version,
|
||||
NumMetrics: g.NumMetrics,
|
||||
Sample1: g.Sample1.(nvmlGpmSample),
|
||||
Sample2: g.Sample2.(nvmlGpmSample),
|
||||
}
|
||||
for i := range g.Metrics {
|
||||
out.Metrics[i] = g.Metrics[i]
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func (g *nvmlGpmMetricsGetType) convert() *GpmMetricsGetType {
|
||||
out := &GpmMetricsGetType{
|
||||
Version: g.Version,
|
||||
NumMetrics: g.NumMetrics,
|
||||
Sample1: g.Sample1,
|
||||
Sample2: g.Sample2,
|
||||
}
|
||||
for i := range g.Metrics {
|
||||
out.Metrics[i] = g.Metrics[i]
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// nvml.GpmMetricsGet()
|
||||
type GpmMetricsGetVType struct {
|
||||
metricsGet *GpmMetricsGetType
|
||||
metricsGet *nvmlGpmMetricsGetType
|
||||
}
|
||||
|
||||
func GpmMetricsGetV(MetricsGet *GpmMetricsGetType) GpmMetricsGetVType {
|
||||
return GpmMetricsGetVType{MetricsGet}
|
||||
func (l *library) GpmMetricsGetV(metricsGet *GpmMetricsGetType) GpmMetricsGetVType {
|
||||
return GpmMetricsGetVType{metricsGet.convert()}
|
||||
}
|
||||
func (metricsGetV GpmMetricsGetVType) V1() Return {
|
||||
metricsGetV.metricsGet.Version = 1
|
||||
return nvmlGpmMetricsGet(metricsGetV.metricsGet)
|
||||
}
|
||||
|
||||
func (MetricsGetV GpmMetricsGetVType) V1() Return {
|
||||
MetricsGetV.metricsGet.Version = 1
|
||||
return nvmlGpmMetricsGet(MetricsGetV.metricsGet)
|
||||
}
|
||||
|
||||
func GpmMetricsGet(MetricsGet *GpmMetricsGetType) Return {
|
||||
MetricsGet.Version = GPM_METRICS_GET_VERSION
|
||||
return nvmlGpmMetricsGet(MetricsGet)
|
||||
func (l *library) GpmMetricsGet(metricsGet *GpmMetricsGetType) Return {
|
||||
metricsGet.Version = GPM_METRICS_GET_VERSION
|
||||
return nvmlGpmMetricsGet(metricsGet.convert())
|
||||
}
|
||||
|
||||
// nvml.GpmSampleFree()
|
||||
func GpmSampleFree(GpmSample GpmSample) Return {
|
||||
return nvmlGpmSampleFree(GpmSample)
|
||||
func (l *library) GpmSampleFree(gpmSample GpmSample) Return {
|
||||
return gpmSample.Free()
|
||||
}
|
||||
|
||||
func (gpmSample nvmlGpmSample) Free() Return {
|
||||
return nvmlGpmSampleFree(gpmSample)
|
||||
}
|
||||
|
||||
// nvml.GpmSampleAlloc()
|
||||
func GpmSampleAlloc(GpmSample *GpmSample) Return {
|
||||
return nvmlGpmSampleAlloc(GpmSample)
|
||||
func (l *library) GpmSampleAlloc() (GpmSample, Return) {
|
||||
var gpmSample nvmlGpmSample
|
||||
ret := nvmlGpmSampleAlloc(&gpmSample)
|
||||
return gpmSample, ret
|
||||
}
|
||||
|
||||
// nvml.GpmSampleGet()
|
||||
func GpmSampleGet(Device Device, GpmSample GpmSample) Return {
|
||||
return nvmlGpmSampleGet(Device, GpmSample)
|
||||
func (l *library) GpmSampleGet(device Device, gpmSample GpmSample) Return {
|
||||
return gpmSample.Get(device)
|
||||
}
|
||||
|
||||
func (Device Device) GpmSampleGet(GpmSample GpmSample) Return {
|
||||
return GpmSampleGet(Device, GpmSample)
|
||||
func (device nvmlDevice) GpmSampleGet(gpmSample GpmSample) Return {
|
||||
return gpmSample.Get(device)
|
||||
}
|
||||
|
||||
func (gpmSample nvmlGpmSample) Get(device Device) Return {
|
||||
return nvmlGpmSampleGet(device.(nvmlDevice), gpmSample)
|
||||
}
|
||||
|
||||
// nvml.GpmQueryDeviceSupport()
|
||||
type GpmSupportV struct {
|
||||
device Device
|
||||
device nvmlDevice
|
||||
}
|
||||
|
||||
func GpmQueryDeviceSupportV(Device Device) GpmSupportV {
|
||||
return GpmSupportV{Device}
|
||||
func (l *library) GpmQueryDeviceSupportV(device Device) GpmSupportV {
|
||||
return device.GpmQueryDeviceSupportV()
|
||||
}
|
||||
|
||||
func (Device Device) GpmQueryDeviceSupportV() GpmSupportV {
|
||||
return GpmSupportV{Device}
|
||||
func (device nvmlDevice) GpmQueryDeviceSupportV() GpmSupportV {
|
||||
return GpmSupportV{device}
|
||||
}
|
||||
|
||||
func (GpmSupportV GpmSupportV) V1() (GpmSupport, Return) {
|
||||
var GpmSupport GpmSupport
|
||||
GpmSupport.Version = 1
|
||||
ret := nvmlGpmQueryDeviceSupport(GpmSupportV.device, &GpmSupport)
|
||||
return GpmSupport, ret
|
||||
func (gpmSupportV GpmSupportV) V1() (GpmSupport, Return) {
|
||||
var gpmSupport GpmSupport
|
||||
gpmSupport.Version = 1
|
||||
ret := nvmlGpmQueryDeviceSupport(gpmSupportV.device, &gpmSupport)
|
||||
return gpmSupport, ret
|
||||
}
|
||||
|
||||
func GpmQueryDeviceSupport(Device Device) (GpmSupport, Return) {
|
||||
var GpmSupport GpmSupport
|
||||
GpmSupport.Version = GPM_SUPPORT_VERSION
|
||||
ret := nvmlGpmQueryDeviceSupport(Device, &GpmSupport)
|
||||
return GpmSupport, ret
|
||||
func (l *library) GpmQueryDeviceSupport(device Device) (GpmSupport, Return) {
|
||||
return device.GpmQueryDeviceSupport()
|
||||
}
|
||||
|
||||
func (Device Device) GpmQueryDeviceSupport() (GpmSupport, Return) {
|
||||
return GpmQueryDeviceSupport(Device)
|
||||
func (device nvmlDevice) GpmQueryDeviceSupport() (GpmSupport, Return) {
|
||||
var gpmSupport GpmSupport
|
||||
gpmSupport.Version = GPM_SUPPORT_VERSION
|
||||
ret := nvmlGpmQueryDeviceSupport(device, &gpmSupport)
|
||||
return gpmSupport, ret
|
||||
}
|
||||
|
||||
// nvml.GpmMigSampleGet()
|
||||
func GpmMigSampleGet(Device Device, GpuInstanceId int, GpmSample GpmSample) Return {
|
||||
return nvmlGpmMigSampleGet(Device, uint32(GpuInstanceId), GpmSample)
|
||||
func (l *library) GpmMigSampleGet(device Device, gpuInstanceId int, gpmSample GpmSample) Return {
|
||||
return gpmSample.MigGet(device, gpuInstanceId)
|
||||
}
|
||||
|
||||
func (Device Device) GpmMigSampleGet(GpuInstanceId int, GpmSample GpmSample) Return {
|
||||
return GpmMigSampleGet(Device, GpuInstanceId, GpmSample)
|
||||
func (device nvmlDevice) GpmMigSampleGet(gpuInstanceId int, gpmSample GpmSample) Return {
|
||||
return gpmSample.MigGet(device, gpuInstanceId)
|
||||
}
|
||||
|
||||
func (gpmSample nvmlGpmSample) MigGet(device Device, gpuInstanceId int) Return {
|
||||
return nvmlGpmMigSampleGet(device.(nvmlDevice), uint32(gpuInstanceId), gpmSample)
|
||||
}
|
||||
|
||||
10
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/init.go
generated
vendored
10
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/init.go
generated
vendored
@@ -17,7 +17,7 @@ package nvml
|
||||
import "C"
|
||||
|
||||
// nvml.Init()
|
||||
func Init() Return {
|
||||
func (l *library) Init() Return {
|
||||
if err := libnvml.load(); err != nil {
|
||||
return ERROR_LIBRARY_NOT_FOUND
|
||||
}
|
||||
@@ -25,15 +25,15 @@ func Init() Return {
|
||||
}
|
||||
|
||||
// nvml.InitWithFlags()
|
||||
func InitWithFlags(Flags uint32) Return {
|
||||
func (l *library) InitWithFlags(flags uint32) Return {
|
||||
if err := libnvml.load(); err != nil {
|
||||
return ERROR_LIBRARY_NOT_FOUND
|
||||
}
|
||||
return nvmlInitWithFlags(Flags)
|
||||
return nvmlInitWithFlags(flags)
|
||||
}
|
||||
|
||||
// nvml.Shutdown()
|
||||
func Shutdown() Return {
|
||||
func (l *library) Shutdown() Return {
|
||||
ret := nvmlShutdown()
|
||||
if ret != SUCCESS {
|
||||
return ret
|
||||
@@ -41,7 +41,7 @@ func Shutdown() Return {
|
||||
|
||||
err := libnvml.close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return ERROR_UNKNOWN
|
||||
}
|
||||
|
||||
return ret
|
||||
|
||||
168
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/lib.go
generated
vendored
168
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/lib.go
generated
vendored
@@ -34,48 +34,70 @@ const (
|
||||
var errLibraryNotLoaded = errors.New("library not loaded")
|
||||
var errLibraryAlreadyLoaded = errors.New("library already loaded")
|
||||
|
||||
// dynamicLibrary is an interface for abstacting the underlying library.
|
||||
// This also allows for mocking and testing.
|
||||
|
||||
//go:generate moq -stub -out dynamicLibrary_mock.go . dynamicLibrary
|
||||
type dynamicLibrary interface {
|
||||
Lookup(string) error
|
||||
Open() error
|
||||
Close() error
|
||||
}
|
||||
|
||||
// library represents an nvml library.
|
||||
// This includes a reference to the underlying DynamicLibrary
|
||||
type library struct {
|
||||
sync.Mutex
|
||||
path string
|
||||
flags int
|
||||
refcount refcount
|
||||
dl dynamicLibrary
|
||||
}
|
||||
|
||||
// libnvml is a global instance of the nvml library.
|
||||
var libnvml = library{
|
||||
path: defaultNvmlLibraryName,
|
||||
flags: defaultNvmlLibraryLoadFlags,
|
||||
}
|
||||
|
||||
var _ Interface = (*library)(nil)
|
||||
|
||||
// GetLibrary returns a the library as a Library interface.
|
||||
func (l *library) GetLibrary() Library {
|
||||
// libnvml is a global instance of the nvml library.
|
||||
var libnvml = newLibrary()
|
||||
|
||||
func New(opts ...LibraryOption) Interface {
|
||||
return newLibrary(opts...)
|
||||
}
|
||||
|
||||
func newLibrary(opts ...LibraryOption) *library {
|
||||
l := &library{}
|
||||
l.init(opts...)
|
||||
return l
|
||||
}
|
||||
|
||||
// GetLibrary returns a representation of the underlying library that implements the Library interface.
|
||||
func GetLibrary() Library {
|
||||
return libnvml.GetLibrary()
|
||||
func (l *library) init(opts ...LibraryOption) {
|
||||
o := libraryOptions{}
|
||||
for _, opt := range opts {
|
||||
opt(&o)
|
||||
}
|
||||
|
||||
if o.path == "" {
|
||||
o.path = defaultNvmlLibraryName
|
||||
}
|
||||
if o.flags == 0 {
|
||||
o.flags = defaultNvmlLibraryLoadFlags
|
||||
}
|
||||
|
||||
l.path = o.path
|
||||
l.dl = dl.New(o.path, o.flags)
|
||||
}
|
||||
|
||||
// Lookup checks whether the specified library symbol exists in the library.
|
||||
func (l *library) Extensions() ExtendedInterface {
|
||||
return l
|
||||
}
|
||||
|
||||
// LookupSymbol checks whether the specified library symbol exists in the library.
|
||||
// Note that this requires that the library be loaded.
|
||||
func (l *library) Lookup(name string) error {
|
||||
if l == nil || l.dl == nil {
|
||||
func (l *library) LookupSymbol(name string) error {
|
||||
if l == nil || l.refcount == 0 {
|
||||
return fmt.Errorf("error looking up %s: %w", name, errLibraryNotLoaded)
|
||||
}
|
||||
return l.dl.Lookup(name)
|
||||
}
|
||||
|
||||
// newDynamicLibrary is a function variable that can be overridden for testing.
|
||||
var newDynamicLibrary = func(path string, flags int) dynamicLibrary {
|
||||
return dl.New(path, flags)
|
||||
}
|
||||
|
||||
// load initializes the library and updates the versioned symbols.
|
||||
// Multiple calls to an already loaded library will return without error.
|
||||
func (l *library) load() (rerr error) {
|
||||
@@ -87,12 +109,14 @@ func (l *library) load() (rerr error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
dl := newDynamicLibrary(l.path, l.flags)
|
||||
if err := dl.Open(); err != nil {
|
||||
if err := l.dl.Open(); err != nil {
|
||||
return fmt.Errorf("error opening %s: %w", l.path, err)
|
||||
}
|
||||
|
||||
l.dl = dl
|
||||
// Update the errorStringFunc to point to nvml.ErrorString
|
||||
errorStringFunc = nvmlErrorString
|
||||
|
||||
// Update all versioned symbols
|
||||
l.updateVersionedSymbols()
|
||||
|
||||
return nil
|
||||
@@ -114,7 +138,8 @@ func (l *library) close() (rerr error) {
|
||||
return fmt.Errorf("error closing %s: %w", l.path, err)
|
||||
}
|
||||
|
||||
l.dl = nil
|
||||
// Update the errorStringFunc to point to defaultErrorStringFunc
|
||||
errorStringFunc = defaultErrorStringFunc
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -131,9 +156,9 @@ var nvmlDeviceGetGridLicensableFeatures = nvmlDeviceGetGridLicensableFeatures_v1
|
||||
var nvmlEventSetWait = nvmlEventSetWait_v1
|
||||
var nvmlDeviceGetAttributes = nvmlDeviceGetAttributes_v1
|
||||
var nvmlComputeInstanceGetInfo = nvmlComputeInstanceGetInfo_v1
|
||||
var DeviceGetComputeRunningProcesses = deviceGetComputeRunningProcesses_v1
|
||||
var DeviceGetGraphicsRunningProcesses = deviceGetGraphicsRunningProcesses_v1
|
||||
var DeviceGetMPSComputeRunningProcesses = deviceGetMPSComputeRunningProcesses_v1
|
||||
var deviceGetComputeRunningProcesses = deviceGetComputeRunningProcesses_v1
|
||||
var deviceGetGraphicsRunningProcesses = deviceGetGraphicsRunningProcesses_v1
|
||||
var deviceGetMPSComputeRunningProcesses = deviceGetMPSComputeRunningProcesses_v1
|
||||
var GetBlacklistDeviceCount = GetExcludedDeviceCount
|
||||
var GetBlacklistDeviceInfoByIndex = GetExcludedDeviceInfoByIndex
|
||||
var nvmlDeviceGetGpuInstancePossiblePlacements = nvmlDeviceGetGpuInstancePossiblePlacements_v1
|
||||
@@ -173,127 +198,94 @@ func (pis ProcessInfo_v2Slice) ToProcessInfoSlice() []ProcessInfo {
|
||||
// When new versioned symbols are added, these would have to be initialized above and have
|
||||
// corresponding checks and subsequent assignments added below.
|
||||
func (l *library) updateVersionedSymbols() {
|
||||
err := l.Lookup("nvmlInit_v2")
|
||||
err := l.LookupSymbol("nvmlInit_v2")
|
||||
if err == nil {
|
||||
nvmlInit = nvmlInit_v2
|
||||
}
|
||||
err = l.Lookup("nvmlDeviceGetPciInfo_v2")
|
||||
err = l.LookupSymbol("nvmlDeviceGetPciInfo_v2")
|
||||
if err == nil {
|
||||
nvmlDeviceGetPciInfo = nvmlDeviceGetPciInfo_v2
|
||||
}
|
||||
err = l.Lookup("nvmlDeviceGetPciInfo_v3")
|
||||
err = l.LookupSymbol("nvmlDeviceGetPciInfo_v3")
|
||||
if err == nil {
|
||||
nvmlDeviceGetPciInfo = nvmlDeviceGetPciInfo_v3
|
||||
}
|
||||
err = l.Lookup("nvmlDeviceGetCount_v2")
|
||||
err = l.LookupSymbol("nvmlDeviceGetCount_v2")
|
||||
if err == nil {
|
||||
nvmlDeviceGetCount = nvmlDeviceGetCount_v2
|
||||
}
|
||||
err = l.Lookup("nvmlDeviceGetHandleByIndex_v2")
|
||||
err = l.LookupSymbol("nvmlDeviceGetHandleByIndex_v2")
|
||||
if err == nil {
|
||||
nvmlDeviceGetHandleByIndex = nvmlDeviceGetHandleByIndex_v2
|
||||
}
|
||||
err = l.Lookup("nvmlDeviceGetHandleByPciBusId_v2")
|
||||
err = l.LookupSymbol("nvmlDeviceGetHandleByPciBusId_v2")
|
||||
if err == nil {
|
||||
nvmlDeviceGetHandleByPciBusId = nvmlDeviceGetHandleByPciBusId_v2
|
||||
}
|
||||
err = l.Lookup("nvmlDeviceGetNvLinkRemotePciInfo_v2")
|
||||
err = l.LookupSymbol("nvmlDeviceGetNvLinkRemotePciInfo_v2")
|
||||
if err == nil {
|
||||
nvmlDeviceGetNvLinkRemotePciInfo = nvmlDeviceGetNvLinkRemotePciInfo_v2
|
||||
}
|
||||
// Unable to overwrite nvmlDeviceRemoveGpu() because the v2 function takes
|
||||
// a different set of parameters than the v1 function.
|
||||
//err = l.Lookup("nvmlDeviceRemoveGpu_v2")
|
||||
//err = l.LookupSymbol("nvmlDeviceRemoveGpu_v2")
|
||||
//if err == nil {
|
||||
// nvmlDeviceRemoveGpu = nvmlDeviceRemoveGpu_v2
|
||||
//}
|
||||
err = l.Lookup("nvmlDeviceGetGridLicensableFeatures_v2")
|
||||
err = l.LookupSymbol("nvmlDeviceGetGridLicensableFeatures_v2")
|
||||
if err == nil {
|
||||
nvmlDeviceGetGridLicensableFeatures = nvmlDeviceGetGridLicensableFeatures_v2
|
||||
}
|
||||
err = l.Lookup("nvmlDeviceGetGridLicensableFeatures_v3")
|
||||
err = l.LookupSymbol("nvmlDeviceGetGridLicensableFeatures_v3")
|
||||
if err == nil {
|
||||
nvmlDeviceGetGridLicensableFeatures = nvmlDeviceGetGridLicensableFeatures_v3
|
||||
}
|
||||
err = l.Lookup("nvmlDeviceGetGridLicensableFeatures_v4")
|
||||
err = l.LookupSymbol("nvmlDeviceGetGridLicensableFeatures_v4")
|
||||
if err == nil {
|
||||
nvmlDeviceGetGridLicensableFeatures = nvmlDeviceGetGridLicensableFeatures_v4
|
||||
}
|
||||
err = l.Lookup("nvmlEventSetWait_v2")
|
||||
err = l.LookupSymbol("nvmlEventSetWait_v2")
|
||||
if err == nil {
|
||||
nvmlEventSetWait = nvmlEventSetWait_v2
|
||||
}
|
||||
err = l.Lookup("nvmlDeviceGetAttributes_v2")
|
||||
err = l.LookupSymbol("nvmlDeviceGetAttributes_v2")
|
||||
if err == nil {
|
||||
nvmlDeviceGetAttributes = nvmlDeviceGetAttributes_v2
|
||||
}
|
||||
err = l.Lookup("nvmlComputeInstanceGetInfo_v2")
|
||||
err = l.LookupSymbol("nvmlComputeInstanceGetInfo_v2")
|
||||
if err == nil {
|
||||
nvmlComputeInstanceGetInfo = nvmlComputeInstanceGetInfo_v2
|
||||
}
|
||||
err = l.Lookup("nvmlDeviceGetComputeRunningProcesses_v2")
|
||||
err = l.LookupSymbol("nvmlDeviceGetComputeRunningProcesses_v2")
|
||||
if err == nil {
|
||||
DeviceGetComputeRunningProcesses = deviceGetComputeRunningProcesses_v2
|
||||
deviceGetComputeRunningProcesses = deviceGetComputeRunningProcesses_v2
|
||||
}
|
||||
err = l.Lookup("nvmlDeviceGetComputeRunningProcesses_v3")
|
||||
err = l.LookupSymbol("nvmlDeviceGetComputeRunningProcesses_v3")
|
||||
if err == nil {
|
||||
DeviceGetComputeRunningProcesses = deviceGetComputeRunningProcesses_v3
|
||||
deviceGetComputeRunningProcesses = deviceGetComputeRunningProcesses_v3
|
||||
}
|
||||
err = l.Lookup("nvmlDeviceGetGraphicsRunningProcesses_v2")
|
||||
err = l.LookupSymbol("nvmlDeviceGetGraphicsRunningProcesses_v2")
|
||||
if err == nil {
|
||||
DeviceGetGraphicsRunningProcesses = deviceGetGraphicsRunningProcesses_v2
|
||||
deviceGetGraphicsRunningProcesses = deviceGetGraphicsRunningProcesses_v2
|
||||
}
|
||||
err = l.Lookup("nvmlDeviceGetGraphicsRunningProcesses_v3")
|
||||
err = l.LookupSymbol("nvmlDeviceGetGraphicsRunningProcesses_v3")
|
||||
if err == nil {
|
||||
DeviceGetGraphicsRunningProcesses = deviceGetGraphicsRunningProcesses_v3
|
||||
deviceGetGraphicsRunningProcesses = deviceGetGraphicsRunningProcesses_v3
|
||||
}
|
||||
err = l.Lookup("nvmlDeviceGetMPSComputeRunningProcesses_v2")
|
||||
err = l.LookupSymbol("nvmlDeviceGetMPSComputeRunningProcesses_v2")
|
||||
if err == nil {
|
||||
DeviceGetMPSComputeRunningProcesses = deviceGetMPSComputeRunningProcesses_v2
|
||||
deviceGetMPSComputeRunningProcesses = deviceGetMPSComputeRunningProcesses_v2
|
||||
}
|
||||
err = l.Lookup("nvmlDeviceGetMPSComputeRunningProcesses_v3")
|
||||
err = l.LookupSymbol("nvmlDeviceGetMPSComputeRunningProcesses_v3")
|
||||
if err == nil {
|
||||
DeviceGetMPSComputeRunningProcesses = deviceGetMPSComputeRunningProcesses_v3
|
||||
deviceGetMPSComputeRunningProcesses = deviceGetMPSComputeRunningProcesses_v3
|
||||
}
|
||||
err = l.Lookup("nvmlDeviceGetGpuInstancePossiblePlacements_v2")
|
||||
err = l.LookupSymbol("nvmlDeviceGetGpuInstancePossiblePlacements_v2")
|
||||
if err == nil {
|
||||
nvmlDeviceGetGpuInstancePossiblePlacements = nvmlDeviceGetGpuInstancePossiblePlacements_v2
|
||||
}
|
||||
err = l.Lookup("nvmlVgpuInstanceGetLicenseInfo_v2")
|
||||
err = l.LookupSymbol("nvmlVgpuInstanceGetLicenseInfo_v2")
|
||||
if err == nil {
|
||||
nvmlVgpuInstanceGetLicenseInfo = nvmlVgpuInstanceGetLicenseInfo_v2
|
||||
}
|
||||
}
|
||||
|
||||
// LibraryOption represents a functional option to configure the underlying NVML library
|
||||
type LibraryOption func(*library)
|
||||
|
||||
// WithLibraryPath provides an option to set the library name to be used by the NVML library.
|
||||
func WithLibraryPath(path string) LibraryOption {
|
||||
return func(l *library) {
|
||||
l.path = path
|
||||
}
|
||||
}
|
||||
|
||||
// SetLibraryOptions applies the specified options to the NVML library.
|
||||
// If this is called when a library is already loaded, and error is raised.
|
||||
func SetLibraryOptions(opts ...LibraryOption) error {
|
||||
libnvml.Lock()
|
||||
defer libnvml.Unlock()
|
||||
if libnvml.dl != nil {
|
||||
return errLibraryAlreadyLoaded
|
||||
}
|
||||
|
||||
for _, opt := range opts {
|
||||
opt(&libnvml)
|
||||
}
|
||||
|
||||
if libnvml.path == "" {
|
||||
libnvml.path = defaultNvmlLibraryName
|
||||
}
|
||||
if libnvml.flags == 0 {
|
||||
libnvml.flags = defaultNvmlLibraryLoadFlags
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1,40 +1,41 @@
|
||||
// Code generated by moq; DO NOT EDIT.
|
||||
// github.com/matryer/moq
|
||||
|
||||
package nvml
|
||||
package mock
|
||||
|
||||
import (
|
||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Ensure, that ComputeInstanceMock does implement ComputeInstance.
|
||||
// Ensure, that ComputeInstance does implement nvml.ComputeInstance.
|
||||
// If this is not the case, regenerate this file with moq.
|
||||
var _ ComputeInstance = &ComputeInstanceMock{}
|
||||
var _ nvml.ComputeInstance = &ComputeInstance{}
|
||||
|
||||
// ComputeInstanceMock is a mock implementation of ComputeInstance.
|
||||
// ComputeInstance is a mock implementation of nvml.ComputeInstance.
|
||||
//
|
||||
// func TestSomethingThatUsesComputeInstance(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked ComputeInstance
|
||||
// mockedComputeInstance := &ComputeInstanceMock{
|
||||
// DestroyFunc: func() Return {
|
||||
// // make and configure a mocked nvml.ComputeInstance
|
||||
// mockedComputeInstance := &ComputeInstance{
|
||||
// DestroyFunc: func() nvml.Return {
|
||||
// panic("mock out the Destroy method")
|
||||
// },
|
||||
// GetInfoFunc: func() (ComputeInstanceInfo, Return) {
|
||||
// GetInfoFunc: func() (nvml.ComputeInstanceInfo, nvml.Return) {
|
||||
// panic("mock out the GetInfo method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedComputeInstance in code that requires ComputeInstance
|
||||
// // use mockedComputeInstance in code that requires nvml.ComputeInstance
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
type ComputeInstanceMock struct {
|
||||
type ComputeInstance struct {
|
||||
// DestroyFunc mocks the Destroy method.
|
||||
DestroyFunc func() Return
|
||||
DestroyFunc func() nvml.Return
|
||||
|
||||
// GetInfoFunc mocks the GetInfo method.
|
||||
GetInfoFunc func() (ComputeInstanceInfo, Return)
|
||||
GetInfoFunc func() (nvml.ComputeInstanceInfo, nvml.Return)
|
||||
|
||||
// calls tracks calls to the methods.
|
||||
calls struct {
|
||||
@@ -50,9 +51,9 @@ type ComputeInstanceMock struct {
|
||||
}
|
||||
|
||||
// Destroy calls DestroyFunc.
|
||||
func (mock *ComputeInstanceMock) Destroy() Return {
|
||||
func (mock *ComputeInstance) Destroy() nvml.Return {
|
||||
if mock.DestroyFunc == nil {
|
||||
panic("ComputeInstanceMock.DestroyFunc: method is nil but ComputeInstance.Destroy was just called")
|
||||
panic("ComputeInstance.DestroyFunc: method is nil but ComputeInstance.Destroy was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
@@ -66,7 +67,7 @@ func (mock *ComputeInstanceMock) Destroy() Return {
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedComputeInstance.DestroyCalls())
|
||||
func (mock *ComputeInstanceMock) DestroyCalls() []struct {
|
||||
func (mock *ComputeInstance) DestroyCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
@@ -77,9 +78,9 @@ func (mock *ComputeInstanceMock) DestroyCalls() []struct {
|
||||
}
|
||||
|
||||
// GetInfo calls GetInfoFunc.
|
||||
func (mock *ComputeInstanceMock) GetInfo() (ComputeInstanceInfo, Return) {
|
||||
func (mock *ComputeInstance) GetInfo() (nvml.ComputeInstanceInfo, nvml.Return) {
|
||||
if mock.GetInfoFunc == nil {
|
||||
panic("ComputeInstanceMock.GetInfoFunc: method is nil but ComputeInstance.GetInfo was just called")
|
||||
panic("ComputeInstance.GetInfoFunc: method is nil but ComputeInstance.GetInfo was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
@@ -93,7 +94,7 @@ func (mock *ComputeInstanceMock) GetInfo() (ComputeInstanceInfo, Return) {
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedComputeInstance.GetInfoCalls())
|
||||
func (mock *ComputeInstanceMock) GetInfoCalls() []struct {
|
||||
func (mock *ComputeInstance) GetInfoCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
8283
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/device.go
generated
vendored
Normal file
8283
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/device.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
112
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/eventset.go
generated
vendored
Normal file
112
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/eventset.go
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
// Code generated by moq; DO NOT EDIT.
|
||||
// github.com/matryer/moq
|
||||
|
||||
package mock
|
||||
|
||||
import (
|
||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Ensure, that EventSet does implement nvml.EventSet.
|
||||
// If this is not the case, regenerate this file with moq.
|
||||
var _ nvml.EventSet = &EventSet{}
|
||||
|
||||
// EventSet is a mock implementation of nvml.EventSet.
|
||||
//
|
||||
// func TestSomethingThatUsesEventSet(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked nvml.EventSet
|
||||
// mockedEventSet := &EventSet{
|
||||
// FreeFunc: func() nvml.Return {
|
||||
// panic("mock out the Free method")
|
||||
// },
|
||||
// WaitFunc: func(v uint32) (nvml.EventData, nvml.Return) {
|
||||
// panic("mock out the Wait method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedEventSet in code that requires nvml.EventSet
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
type EventSet struct {
|
||||
// FreeFunc mocks the Free method.
|
||||
FreeFunc func() nvml.Return
|
||||
|
||||
// WaitFunc mocks the Wait method.
|
||||
WaitFunc func(v uint32) (nvml.EventData, nvml.Return)
|
||||
|
||||
// calls tracks calls to the methods.
|
||||
calls struct {
|
||||
// Free holds details about calls to the Free method.
|
||||
Free []struct {
|
||||
}
|
||||
// Wait holds details about calls to the Wait method.
|
||||
Wait []struct {
|
||||
// V is the v argument value.
|
||||
V uint32
|
||||
}
|
||||
}
|
||||
lockFree sync.RWMutex
|
||||
lockWait sync.RWMutex
|
||||
}
|
||||
|
||||
// Free calls FreeFunc.
|
||||
func (mock *EventSet) Free() nvml.Return {
|
||||
if mock.FreeFunc == nil {
|
||||
panic("EventSet.FreeFunc: method is nil but EventSet.Free was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockFree.Lock()
|
||||
mock.calls.Free = append(mock.calls.Free, callInfo)
|
||||
mock.lockFree.Unlock()
|
||||
return mock.FreeFunc()
|
||||
}
|
||||
|
||||
// FreeCalls gets all the calls that were made to Free.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedEventSet.FreeCalls())
|
||||
func (mock *EventSet) FreeCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockFree.RLock()
|
||||
calls = mock.calls.Free
|
||||
mock.lockFree.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// Wait calls WaitFunc.
|
||||
func (mock *EventSet) Wait(v uint32) (nvml.EventData, nvml.Return) {
|
||||
if mock.WaitFunc == nil {
|
||||
panic("EventSet.WaitFunc: method is nil but EventSet.Wait was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
V uint32
|
||||
}{
|
||||
V: v,
|
||||
}
|
||||
mock.lockWait.Lock()
|
||||
mock.calls.Wait = append(mock.calls.Wait, callInfo)
|
||||
mock.lockWait.Unlock()
|
||||
return mock.WaitFunc(v)
|
||||
}
|
||||
|
||||
// WaitCalls gets all the calls that were made to Wait.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedEventSet.WaitCalls())
|
||||
func (mock *EventSet) WaitCalls() []struct {
|
||||
V uint32
|
||||
} {
|
||||
var calls []struct {
|
||||
V uint32
|
||||
}
|
||||
mock.lockWait.RLock()
|
||||
calls = mock.calls.Wait
|
||||
mock.lockWait.RUnlock()
|
||||
return calls
|
||||
}
|
||||
75
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/extendedinterface.go
generated
vendored
Normal file
75
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/extendedinterface.go
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
// Code generated by moq; DO NOT EDIT.
|
||||
// github.com/matryer/moq
|
||||
|
||||
package mock
|
||||
|
||||
import (
|
||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Ensure, that ExtendedInterface does implement nvml.ExtendedInterface.
|
||||
// If this is not the case, regenerate this file with moq.
|
||||
var _ nvml.ExtendedInterface = &ExtendedInterface{}
|
||||
|
||||
// ExtendedInterface is a mock implementation of nvml.ExtendedInterface.
|
||||
//
|
||||
// func TestSomethingThatUsesExtendedInterface(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked nvml.ExtendedInterface
|
||||
// mockedExtendedInterface := &ExtendedInterface{
|
||||
// LookupSymbolFunc: func(s string) error {
|
||||
// panic("mock out the LookupSymbol method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedExtendedInterface in code that requires nvml.ExtendedInterface
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
type ExtendedInterface struct {
|
||||
// LookupSymbolFunc mocks the LookupSymbol method.
|
||||
LookupSymbolFunc func(s string) error
|
||||
|
||||
// calls tracks calls to the methods.
|
||||
calls struct {
|
||||
// LookupSymbol holds details about calls to the LookupSymbol method.
|
||||
LookupSymbol []struct {
|
||||
// S is the s argument value.
|
||||
S string
|
||||
}
|
||||
}
|
||||
lockLookupSymbol sync.RWMutex
|
||||
}
|
||||
|
||||
// LookupSymbol calls LookupSymbolFunc.
|
||||
func (mock *ExtendedInterface) LookupSymbol(s string) error {
|
||||
if mock.LookupSymbolFunc == nil {
|
||||
panic("ExtendedInterface.LookupSymbolFunc: method is nil but ExtendedInterface.LookupSymbol was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
S string
|
||||
}{
|
||||
S: s,
|
||||
}
|
||||
mock.lockLookupSymbol.Lock()
|
||||
mock.calls.LookupSymbol = append(mock.calls.LookupSymbol, callInfo)
|
||||
mock.lockLookupSymbol.Unlock()
|
||||
return mock.LookupSymbolFunc(s)
|
||||
}
|
||||
|
||||
// LookupSymbolCalls gets all the calls that were made to LookupSymbol.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedExtendedInterface.LookupSymbolCalls())
|
||||
func (mock *ExtendedInterface) LookupSymbolCalls() []struct {
|
||||
S string
|
||||
} {
|
||||
var calls []struct {
|
||||
S string
|
||||
}
|
||||
mock.lockLookupSymbol.RLock()
|
||||
calls = mock.calls.LookupSymbol
|
||||
mock.lockLookupSymbol.RUnlock()
|
||||
return calls
|
||||
}
|
||||
162
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/gpmsample.go
generated
vendored
Normal file
162
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/gpmsample.go
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
// Code generated by moq; DO NOT EDIT.
|
||||
// github.com/matryer/moq
|
||||
|
||||
package mock
|
||||
|
||||
import (
|
||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Ensure, that GpmSample does implement nvml.GpmSample.
|
||||
// If this is not the case, regenerate this file with moq.
|
||||
var _ nvml.GpmSample = &GpmSample{}
|
||||
|
||||
// GpmSample is a mock implementation of nvml.GpmSample.
|
||||
//
|
||||
// func TestSomethingThatUsesGpmSample(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked nvml.GpmSample
|
||||
// mockedGpmSample := &GpmSample{
|
||||
// FreeFunc: func() nvml.Return {
|
||||
// panic("mock out the Free method")
|
||||
// },
|
||||
// GetFunc: func(device nvml.Device) nvml.Return {
|
||||
// panic("mock out the Get method")
|
||||
// },
|
||||
// MigGetFunc: func(device nvml.Device, n int) nvml.Return {
|
||||
// panic("mock out the MigGet method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedGpmSample in code that requires nvml.GpmSample
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
type GpmSample struct {
|
||||
// FreeFunc mocks the Free method.
|
||||
FreeFunc func() nvml.Return
|
||||
|
||||
// GetFunc mocks the Get method.
|
||||
GetFunc func(device nvml.Device) nvml.Return
|
||||
|
||||
// MigGetFunc mocks the MigGet method.
|
||||
MigGetFunc func(device nvml.Device, n int) nvml.Return
|
||||
|
||||
// calls tracks calls to the methods.
|
||||
calls struct {
|
||||
// Free holds details about calls to the Free method.
|
||||
Free []struct {
|
||||
}
|
||||
// Get holds details about calls to the Get method.
|
||||
Get []struct {
|
||||
// Device is the device argument value.
|
||||
Device nvml.Device
|
||||
}
|
||||
// MigGet holds details about calls to the MigGet method.
|
||||
MigGet []struct {
|
||||
// Device is the device argument value.
|
||||
Device nvml.Device
|
||||
// N is the n argument value.
|
||||
N int
|
||||
}
|
||||
}
|
||||
lockFree sync.RWMutex
|
||||
lockGet sync.RWMutex
|
||||
lockMigGet sync.RWMutex
|
||||
}
|
||||
|
||||
// Free calls FreeFunc.
|
||||
func (mock *GpmSample) Free() nvml.Return {
|
||||
if mock.FreeFunc == nil {
|
||||
panic("GpmSample.FreeFunc: method is nil but GpmSample.Free was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockFree.Lock()
|
||||
mock.calls.Free = append(mock.calls.Free, callInfo)
|
||||
mock.lockFree.Unlock()
|
||||
return mock.FreeFunc()
|
||||
}
|
||||
|
||||
// FreeCalls gets all the calls that were made to Free.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedGpmSample.FreeCalls())
|
||||
func (mock *GpmSample) FreeCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockFree.RLock()
|
||||
calls = mock.calls.Free
|
||||
mock.lockFree.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// Get calls GetFunc.
|
||||
func (mock *GpmSample) Get(device nvml.Device) nvml.Return {
|
||||
if mock.GetFunc == nil {
|
||||
panic("GpmSample.GetFunc: method is nil but GpmSample.Get was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
Device nvml.Device
|
||||
}{
|
||||
Device: device,
|
||||
}
|
||||
mock.lockGet.Lock()
|
||||
mock.calls.Get = append(mock.calls.Get, callInfo)
|
||||
mock.lockGet.Unlock()
|
||||
return mock.GetFunc(device)
|
||||
}
|
||||
|
||||
// GetCalls gets all the calls that were made to Get.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedGpmSample.GetCalls())
|
||||
func (mock *GpmSample) GetCalls() []struct {
|
||||
Device nvml.Device
|
||||
} {
|
||||
var calls []struct {
|
||||
Device nvml.Device
|
||||
}
|
||||
mock.lockGet.RLock()
|
||||
calls = mock.calls.Get
|
||||
mock.lockGet.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// MigGet calls MigGetFunc.
|
||||
func (mock *GpmSample) MigGet(device nvml.Device, n int) nvml.Return {
|
||||
if mock.MigGetFunc == nil {
|
||||
panic("GpmSample.MigGetFunc: method is nil but GpmSample.MigGet was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
Device nvml.Device
|
||||
N int
|
||||
}{
|
||||
Device: device,
|
||||
N: n,
|
||||
}
|
||||
mock.lockMigGet.Lock()
|
||||
mock.calls.MigGet = append(mock.calls.MigGet, callInfo)
|
||||
mock.lockMigGet.Unlock()
|
||||
return mock.MigGetFunc(device, n)
|
||||
}
|
||||
|
||||
// MigGetCalls gets all the calls that were made to MigGet.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedGpmSample.MigGetCalls())
|
||||
func (mock *GpmSample) MigGetCalls() []struct {
|
||||
Device nvml.Device
|
||||
N int
|
||||
} {
|
||||
var calls []struct {
|
||||
Device nvml.Device
|
||||
N int
|
||||
}
|
||||
mock.lockMigGet.RLock()
|
||||
calls = mock.calls.MigGet
|
||||
mock.lockMigGet.RUnlock()
|
||||
return calls
|
||||
}
|
||||
475
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/gpuinstance.go
generated
vendored
Normal file
475
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/gpuinstance.go
generated
vendored
Normal file
@@ -0,0 +1,475 @@
|
||||
// Code generated by moq; DO NOT EDIT.
|
||||
// github.com/matryer/moq
|
||||
|
||||
package mock
|
||||
|
||||
import (
|
||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Ensure, that GpuInstance does implement nvml.GpuInstance.
|
||||
// If this is not the case, regenerate this file with moq.
|
||||
var _ nvml.GpuInstance = &GpuInstance{}
|
||||
|
||||
// GpuInstance is a mock implementation of nvml.GpuInstance.
|
||||
//
|
||||
// func TestSomethingThatUsesGpuInstance(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked nvml.GpuInstance
|
||||
// mockedGpuInstance := &GpuInstance{
|
||||
// CreateComputeInstanceFunc: func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) (nvml.ComputeInstance, nvml.Return) {
|
||||
// panic("mock out the CreateComputeInstance method")
|
||||
// },
|
||||
// CreateComputeInstanceWithPlacementFunc: func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo, computeInstancePlacement *nvml.ComputeInstancePlacement) (nvml.ComputeInstance, nvml.Return) {
|
||||
// panic("mock out the CreateComputeInstanceWithPlacement method")
|
||||
// },
|
||||
// DestroyFunc: func() nvml.Return {
|
||||
// panic("mock out the Destroy method")
|
||||
// },
|
||||
// GetComputeInstanceByIdFunc: func(n int) (nvml.ComputeInstance, nvml.Return) {
|
||||
// panic("mock out the GetComputeInstanceById method")
|
||||
// },
|
||||
// GetComputeInstancePossiblePlacementsFunc: func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) ([]nvml.ComputeInstancePlacement, nvml.Return) {
|
||||
// panic("mock out the GetComputeInstancePossiblePlacements method")
|
||||
// },
|
||||
// GetComputeInstanceProfileInfoFunc: func(n1 int, n2 int) (nvml.ComputeInstanceProfileInfo, nvml.Return) {
|
||||
// panic("mock out the GetComputeInstanceProfileInfo method")
|
||||
// },
|
||||
// GetComputeInstanceProfileInfoVFunc: func(n1 int, n2 int) nvml.ComputeInstanceProfileInfoV {
|
||||
// panic("mock out the GetComputeInstanceProfileInfoV method")
|
||||
// },
|
||||
// GetComputeInstanceRemainingCapacityFunc: func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) (int, nvml.Return) {
|
||||
// panic("mock out the GetComputeInstanceRemainingCapacity method")
|
||||
// },
|
||||
// GetComputeInstancesFunc: func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) ([]nvml.ComputeInstance, nvml.Return) {
|
||||
// panic("mock out the GetComputeInstances method")
|
||||
// },
|
||||
// GetInfoFunc: func() (nvml.GpuInstanceInfo, nvml.Return) {
|
||||
// panic("mock out the GetInfo method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedGpuInstance in code that requires nvml.GpuInstance
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
type GpuInstance struct {
|
||||
// CreateComputeInstanceFunc mocks the CreateComputeInstance method.
|
||||
CreateComputeInstanceFunc func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) (nvml.ComputeInstance, nvml.Return)
|
||||
|
||||
// CreateComputeInstanceWithPlacementFunc mocks the CreateComputeInstanceWithPlacement method.
|
||||
CreateComputeInstanceWithPlacementFunc func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo, computeInstancePlacement *nvml.ComputeInstancePlacement) (nvml.ComputeInstance, nvml.Return)
|
||||
|
||||
// DestroyFunc mocks the Destroy method.
|
||||
DestroyFunc func() nvml.Return
|
||||
|
||||
// GetComputeInstanceByIdFunc mocks the GetComputeInstanceById method.
|
||||
GetComputeInstanceByIdFunc func(n int) (nvml.ComputeInstance, nvml.Return)
|
||||
|
||||
// GetComputeInstancePossiblePlacementsFunc mocks the GetComputeInstancePossiblePlacements method.
|
||||
GetComputeInstancePossiblePlacementsFunc func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) ([]nvml.ComputeInstancePlacement, nvml.Return)
|
||||
|
||||
// GetComputeInstanceProfileInfoFunc mocks the GetComputeInstanceProfileInfo method.
|
||||
GetComputeInstanceProfileInfoFunc func(n1 int, n2 int) (nvml.ComputeInstanceProfileInfo, nvml.Return)
|
||||
|
||||
// GetComputeInstanceProfileInfoVFunc mocks the GetComputeInstanceProfileInfoV method.
|
||||
GetComputeInstanceProfileInfoVFunc func(n1 int, n2 int) nvml.ComputeInstanceProfileInfoV
|
||||
|
||||
// GetComputeInstanceRemainingCapacityFunc mocks the GetComputeInstanceRemainingCapacity method.
|
||||
GetComputeInstanceRemainingCapacityFunc func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) (int, nvml.Return)
|
||||
|
||||
// GetComputeInstancesFunc mocks the GetComputeInstances method.
|
||||
GetComputeInstancesFunc func(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) ([]nvml.ComputeInstance, nvml.Return)
|
||||
|
||||
// GetInfoFunc mocks the GetInfo method.
|
||||
GetInfoFunc func() (nvml.GpuInstanceInfo, nvml.Return)
|
||||
|
||||
// calls tracks calls to the methods.
|
||||
calls struct {
|
||||
// CreateComputeInstance holds details about calls to the CreateComputeInstance method.
|
||||
CreateComputeInstance []struct {
|
||||
// ComputeInstanceProfileInfo is the computeInstanceProfileInfo argument value.
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
}
|
||||
// CreateComputeInstanceWithPlacement holds details about calls to the CreateComputeInstanceWithPlacement method.
|
||||
CreateComputeInstanceWithPlacement []struct {
|
||||
// ComputeInstanceProfileInfo is the computeInstanceProfileInfo argument value.
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
// ComputeInstancePlacement is the computeInstancePlacement argument value.
|
||||
ComputeInstancePlacement *nvml.ComputeInstancePlacement
|
||||
}
|
||||
// Destroy holds details about calls to the Destroy method.
|
||||
Destroy []struct {
|
||||
}
|
||||
// GetComputeInstanceById holds details about calls to the GetComputeInstanceById method.
|
||||
GetComputeInstanceById []struct {
|
||||
// N is the n argument value.
|
||||
N int
|
||||
}
|
||||
// GetComputeInstancePossiblePlacements holds details about calls to the GetComputeInstancePossiblePlacements method.
|
||||
GetComputeInstancePossiblePlacements []struct {
|
||||
// ComputeInstanceProfileInfo is the computeInstanceProfileInfo argument value.
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
}
|
||||
// GetComputeInstanceProfileInfo holds details about calls to the GetComputeInstanceProfileInfo method.
|
||||
GetComputeInstanceProfileInfo []struct {
|
||||
// N1 is the n1 argument value.
|
||||
N1 int
|
||||
// N2 is the n2 argument value.
|
||||
N2 int
|
||||
}
|
||||
// GetComputeInstanceProfileInfoV holds details about calls to the GetComputeInstanceProfileInfoV method.
|
||||
GetComputeInstanceProfileInfoV []struct {
|
||||
// N1 is the n1 argument value.
|
||||
N1 int
|
||||
// N2 is the n2 argument value.
|
||||
N2 int
|
||||
}
|
||||
// GetComputeInstanceRemainingCapacity holds details about calls to the GetComputeInstanceRemainingCapacity method.
|
||||
GetComputeInstanceRemainingCapacity []struct {
|
||||
// ComputeInstanceProfileInfo is the computeInstanceProfileInfo argument value.
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
}
|
||||
// GetComputeInstances holds details about calls to the GetComputeInstances method.
|
||||
GetComputeInstances []struct {
|
||||
// ComputeInstanceProfileInfo is the computeInstanceProfileInfo argument value.
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
}
|
||||
// GetInfo holds details about calls to the GetInfo method.
|
||||
GetInfo []struct {
|
||||
}
|
||||
}
|
||||
lockCreateComputeInstance sync.RWMutex
|
||||
lockCreateComputeInstanceWithPlacement sync.RWMutex
|
||||
lockDestroy sync.RWMutex
|
||||
lockGetComputeInstanceById sync.RWMutex
|
||||
lockGetComputeInstancePossiblePlacements sync.RWMutex
|
||||
lockGetComputeInstanceProfileInfo sync.RWMutex
|
||||
lockGetComputeInstanceProfileInfoV sync.RWMutex
|
||||
lockGetComputeInstanceRemainingCapacity sync.RWMutex
|
||||
lockGetComputeInstances sync.RWMutex
|
||||
lockGetInfo sync.RWMutex
|
||||
}
|
||||
|
||||
// CreateComputeInstance calls CreateComputeInstanceFunc.
|
||||
func (mock *GpuInstance) CreateComputeInstance(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) (nvml.ComputeInstance, nvml.Return) {
|
||||
if mock.CreateComputeInstanceFunc == nil {
|
||||
panic("GpuInstance.CreateComputeInstanceFunc: method is nil but GpuInstance.CreateComputeInstance was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
}{
|
||||
ComputeInstanceProfileInfo: computeInstanceProfileInfo,
|
||||
}
|
||||
mock.lockCreateComputeInstance.Lock()
|
||||
mock.calls.CreateComputeInstance = append(mock.calls.CreateComputeInstance, callInfo)
|
||||
mock.lockCreateComputeInstance.Unlock()
|
||||
return mock.CreateComputeInstanceFunc(computeInstanceProfileInfo)
|
||||
}
|
||||
|
||||
// CreateComputeInstanceCalls gets all the calls that were made to CreateComputeInstance.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedGpuInstance.CreateComputeInstanceCalls())
|
||||
func (mock *GpuInstance) CreateComputeInstanceCalls() []struct {
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
} {
|
||||
var calls []struct {
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
}
|
||||
mock.lockCreateComputeInstance.RLock()
|
||||
calls = mock.calls.CreateComputeInstance
|
||||
mock.lockCreateComputeInstance.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// CreateComputeInstanceWithPlacement calls CreateComputeInstanceWithPlacementFunc.
|
||||
func (mock *GpuInstance) CreateComputeInstanceWithPlacement(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo, computeInstancePlacement *nvml.ComputeInstancePlacement) (nvml.ComputeInstance, nvml.Return) {
|
||||
if mock.CreateComputeInstanceWithPlacementFunc == nil {
|
||||
panic("GpuInstance.CreateComputeInstanceWithPlacementFunc: method is nil but GpuInstance.CreateComputeInstanceWithPlacement was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
ComputeInstancePlacement *nvml.ComputeInstancePlacement
|
||||
}{
|
||||
ComputeInstanceProfileInfo: computeInstanceProfileInfo,
|
||||
ComputeInstancePlacement: computeInstancePlacement,
|
||||
}
|
||||
mock.lockCreateComputeInstanceWithPlacement.Lock()
|
||||
mock.calls.CreateComputeInstanceWithPlacement = append(mock.calls.CreateComputeInstanceWithPlacement, callInfo)
|
||||
mock.lockCreateComputeInstanceWithPlacement.Unlock()
|
||||
return mock.CreateComputeInstanceWithPlacementFunc(computeInstanceProfileInfo, computeInstancePlacement)
|
||||
}
|
||||
|
||||
// CreateComputeInstanceWithPlacementCalls gets all the calls that were made to CreateComputeInstanceWithPlacement.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedGpuInstance.CreateComputeInstanceWithPlacementCalls())
|
||||
func (mock *GpuInstance) CreateComputeInstanceWithPlacementCalls() []struct {
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
ComputeInstancePlacement *nvml.ComputeInstancePlacement
|
||||
} {
|
||||
var calls []struct {
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
ComputeInstancePlacement *nvml.ComputeInstancePlacement
|
||||
}
|
||||
mock.lockCreateComputeInstanceWithPlacement.RLock()
|
||||
calls = mock.calls.CreateComputeInstanceWithPlacement
|
||||
mock.lockCreateComputeInstanceWithPlacement.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// Destroy calls DestroyFunc.
|
||||
func (mock *GpuInstance) Destroy() nvml.Return {
|
||||
if mock.DestroyFunc == nil {
|
||||
panic("GpuInstance.DestroyFunc: method is nil but GpuInstance.Destroy was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockDestroy.Lock()
|
||||
mock.calls.Destroy = append(mock.calls.Destroy, callInfo)
|
||||
mock.lockDestroy.Unlock()
|
||||
return mock.DestroyFunc()
|
||||
}
|
||||
|
||||
// DestroyCalls gets all the calls that were made to Destroy.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedGpuInstance.DestroyCalls())
|
||||
func (mock *GpuInstance) DestroyCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockDestroy.RLock()
|
||||
calls = mock.calls.Destroy
|
||||
mock.lockDestroy.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetComputeInstanceById calls GetComputeInstanceByIdFunc.
|
||||
func (mock *GpuInstance) GetComputeInstanceById(n int) (nvml.ComputeInstance, nvml.Return) {
|
||||
if mock.GetComputeInstanceByIdFunc == nil {
|
||||
panic("GpuInstance.GetComputeInstanceByIdFunc: method is nil but GpuInstance.GetComputeInstanceById was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
N int
|
||||
}{
|
||||
N: n,
|
||||
}
|
||||
mock.lockGetComputeInstanceById.Lock()
|
||||
mock.calls.GetComputeInstanceById = append(mock.calls.GetComputeInstanceById, callInfo)
|
||||
mock.lockGetComputeInstanceById.Unlock()
|
||||
return mock.GetComputeInstanceByIdFunc(n)
|
||||
}
|
||||
|
||||
// GetComputeInstanceByIdCalls gets all the calls that were made to GetComputeInstanceById.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedGpuInstance.GetComputeInstanceByIdCalls())
|
||||
func (mock *GpuInstance) GetComputeInstanceByIdCalls() []struct {
|
||||
N int
|
||||
} {
|
||||
var calls []struct {
|
||||
N int
|
||||
}
|
||||
mock.lockGetComputeInstanceById.RLock()
|
||||
calls = mock.calls.GetComputeInstanceById
|
||||
mock.lockGetComputeInstanceById.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetComputeInstancePossiblePlacements calls GetComputeInstancePossiblePlacementsFunc.
|
||||
func (mock *GpuInstance) GetComputeInstancePossiblePlacements(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) ([]nvml.ComputeInstancePlacement, nvml.Return) {
|
||||
if mock.GetComputeInstancePossiblePlacementsFunc == nil {
|
||||
panic("GpuInstance.GetComputeInstancePossiblePlacementsFunc: method is nil but GpuInstance.GetComputeInstancePossiblePlacements was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
}{
|
||||
ComputeInstanceProfileInfo: computeInstanceProfileInfo,
|
||||
}
|
||||
mock.lockGetComputeInstancePossiblePlacements.Lock()
|
||||
mock.calls.GetComputeInstancePossiblePlacements = append(mock.calls.GetComputeInstancePossiblePlacements, callInfo)
|
||||
mock.lockGetComputeInstancePossiblePlacements.Unlock()
|
||||
return mock.GetComputeInstancePossiblePlacementsFunc(computeInstanceProfileInfo)
|
||||
}
|
||||
|
||||
// GetComputeInstancePossiblePlacementsCalls gets all the calls that were made to GetComputeInstancePossiblePlacements.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedGpuInstance.GetComputeInstancePossiblePlacementsCalls())
|
||||
func (mock *GpuInstance) GetComputeInstancePossiblePlacementsCalls() []struct {
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
} {
|
||||
var calls []struct {
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
}
|
||||
mock.lockGetComputeInstancePossiblePlacements.RLock()
|
||||
calls = mock.calls.GetComputeInstancePossiblePlacements
|
||||
mock.lockGetComputeInstancePossiblePlacements.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetComputeInstanceProfileInfo calls GetComputeInstanceProfileInfoFunc.
|
||||
func (mock *GpuInstance) GetComputeInstanceProfileInfo(n1 int, n2 int) (nvml.ComputeInstanceProfileInfo, nvml.Return) {
|
||||
if mock.GetComputeInstanceProfileInfoFunc == nil {
|
||||
panic("GpuInstance.GetComputeInstanceProfileInfoFunc: method is nil but GpuInstance.GetComputeInstanceProfileInfo was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
N1 int
|
||||
N2 int
|
||||
}{
|
||||
N1: n1,
|
||||
N2: n2,
|
||||
}
|
||||
mock.lockGetComputeInstanceProfileInfo.Lock()
|
||||
mock.calls.GetComputeInstanceProfileInfo = append(mock.calls.GetComputeInstanceProfileInfo, callInfo)
|
||||
mock.lockGetComputeInstanceProfileInfo.Unlock()
|
||||
return mock.GetComputeInstanceProfileInfoFunc(n1, n2)
|
||||
}
|
||||
|
||||
// GetComputeInstanceProfileInfoCalls gets all the calls that were made to GetComputeInstanceProfileInfo.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedGpuInstance.GetComputeInstanceProfileInfoCalls())
|
||||
func (mock *GpuInstance) GetComputeInstanceProfileInfoCalls() []struct {
|
||||
N1 int
|
||||
N2 int
|
||||
} {
|
||||
var calls []struct {
|
||||
N1 int
|
||||
N2 int
|
||||
}
|
||||
mock.lockGetComputeInstanceProfileInfo.RLock()
|
||||
calls = mock.calls.GetComputeInstanceProfileInfo
|
||||
mock.lockGetComputeInstanceProfileInfo.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetComputeInstanceProfileInfoV calls GetComputeInstanceProfileInfoVFunc.
|
||||
func (mock *GpuInstance) GetComputeInstanceProfileInfoV(n1 int, n2 int) nvml.ComputeInstanceProfileInfoV {
|
||||
if mock.GetComputeInstanceProfileInfoVFunc == nil {
|
||||
panic("GpuInstance.GetComputeInstanceProfileInfoVFunc: method is nil but GpuInstance.GetComputeInstanceProfileInfoV was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
N1 int
|
||||
N2 int
|
||||
}{
|
||||
N1: n1,
|
||||
N2: n2,
|
||||
}
|
||||
mock.lockGetComputeInstanceProfileInfoV.Lock()
|
||||
mock.calls.GetComputeInstanceProfileInfoV = append(mock.calls.GetComputeInstanceProfileInfoV, callInfo)
|
||||
mock.lockGetComputeInstanceProfileInfoV.Unlock()
|
||||
return mock.GetComputeInstanceProfileInfoVFunc(n1, n2)
|
||||
}
|
||||
|
||||
// GetComputeInstanceProfileInfoVCalls gets all the calls that were made to GetComputeInstanceProfileInfoV.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedGpuInstance.GetComputeInstanceProfileInfoVCalls())
|
||||
func (mock *GpuInstance) GetComputeInstanceProfileInfoVCalls() []struct {
|
||||
N1 int
|
||||
N2 int
|
||||
} {
|
||||
var calls []struct {
|
||||
N1 int
|
||||
N2 int
|
||||
}
|
||||
mock.lockGetComputeInstanceProfileInfoV.RLock()
|
||||
calls = mock.calls.GetComputeInstanceProfileInfoV
|
||||
mock.lockGetComputeInstanceProfileInfoV.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetComputeInstanceRemainingCapacity calls GetComputeInstanceRemainingCapacityFunc.
|
||||
func (mock *GpuInstance) GetComputeInstanceRemainingCapacity(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) (int, nvml.Return) {
|
||||
if mock.GetComputeInstanceRemainingCapacityFunc == nil {
|
||||
panic("GpuInstance.GetComputeInstanceRemainingCapacityFunc: method is nil but GpuInstance.GetComputeInstanceRemainingCapacity was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
}{
|
||||
ComputeInstanceProfileInfo: computeInstanceProfileInfo,
|
||||
}
|
||||
mock.lockGetComputeInstanceRemainingCapacity.Lock()
|
||||
mock.calls.GetComputeInstanceRemainingCapacity = append(mock.calls.GetComputeInstanceRemainingCapacity, callInfo)
|
||||
mock.lockGetComputeInstanceRemainingCapacity.Unlock()
|
||||
return mock.GetComputeInstanceRemainingCapacityFunc(computeInstanceProfileInfo)
|
||||
}
|
||||
|
||||
// GetComputeInstanceRemainingCapacityCalls gets all the calls that were made to GetComputeInstanceRemainingCapacity.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedGpuInstance.GetComputeInstanceRemainingCapacityCalls())
|
||||
func (mock *GpuInstance) GetComputeInstanceRemainingCapacityCalls() []struct {
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
} {
|
||||
var calls []struct {
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
}
|
||||
mock.lockGetComputeInstanceRemainingCapacity.RLock()
|
||||
calls = mock.calls.GetComputeInstanceRemainingCapacity
|
||||
mock.lockGetComputeInstanceRemainingCapacity.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetComputeInstances calls GetComputeInstancesFunc.
|
||||
func (mock *GpuInstance) GetComputeInstances(computeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo) ([]nvml.ComputeInstance, nvml.Return) {
|
||||
if mock.GetComputeInstancesFunc == nil {
|
||||
panic("GpuInstance.GetComputeInstancesFunc: method is nil but GpuInstance.GetComputeInstances was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
}{
|
||||
ComputeInstanceProfileInfo: computeInstanceProfileInfo,
|
||||
}
|
||||
mock.lockGetComputeInstances.Lock()
|
||||
mock.calls.GetComputeInstances = append(mock.calls.GetComputeInstances, callInfo)
|
||||
mock.lockGetComputeInstances.Unlock()
|
||||
return mock.GetComputeInstancesFunc(computeInstanceProfileInfo)
|
||||
}
|
||||
|
||||
// GetComputeInstancesCalls gets all the calls that were made to GetComputeInstances.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedGpuInstance.GetComputeInstancesCalls())
|
||||
func (mock *GpuInstance) GetComputeInstancesCalls() []struct {
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
} {
|
||||
var calls []struct {
|
||||
ComputeInstanceProfileInfo *nvml.ComputeInstanceProfileInfo
|
||||
}
|
||||
mock.lockGetComputeInstances.RLock()
|
||||
calls = mock.calls.GetComputeInstances
|
||||
mock.lockGetComputeInstances.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetInfo calls GetInfoFunc.
|
||||
func (mock *GpuInstance) GetInfo() (nvml.GpuInstanceInfo, nvml.Return) {
|
||||
if mock.GetInfoFunc == nil {
|
||||
panic("GpuInstance.GetInfoFunc: method is nil but GpuInstance.GetInfo was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetInfo.Lock()
|
||||
mock.calls.GetInfo = append(mock.calls.GetInfo, callInfo)
|
||||
mock.lockGetInfo.Unlock()
|
||||
return mock.GetInfoFunc()
|
||||
}
|
||||
|
||||
// GetInfoCalls gets all the calls that were made to GetInfo.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedGpuInstance.GetInfoCalls())
|
||||
func (mock *GpuInstance) GetInfoCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetInfo.RLock()
|
||||
calls = mock.calls.GetInfo
|
||||
mock.lockGetInfo.RUnlock()
|
||||
return calls
|
||||
}
|
||||
13588
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/interface.go
generated
vendored
Normal file
13588
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/interface.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
304
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/unit.go
generated
vendored
Normal file
304
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/unit.go
generated
vendored
Normal file
@@ -0,0 +1,304 @@
|
||||
// Code generated by moq; DO NOT EDIT.
|
||||
// github.com/matryer/moq
|
||||
|
||||
package mock
|
||||
|
||||
import (
|
||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Ensure, that Unit does implement nvml.Unit.
|
||||
// If this is not the case, regenerate this file with moq.
|
||||
var _ nvml.Unit = &Unit{}
|
||||
|
||||
// Unit is a mock implementation of nvml.Unit.
|
||||
//
|
||||
// func TestSomethingThatUsesUnit(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked nvml.Unit
|
||||
// mockedUnit := &Unit{
|
||||
// GetDevicesFunc: func() ([]nvml.Device, nvml.Return) {
|
||||
// panic("mock out the GetDevices method")
|
||||
// },
|
||||
// GetFanSpeedInfoFunc: func() (nvml.UnitFanSpeeds, nvml.Return) {
|
||||
// panic("mock out the GetFanSpeedInfo method")
|
||||
// },
|
||||
// GetLedStateFunc: func() (nvml.LedState, nvml.Return) {
|
||||
// panic("mock out the GetLedState method")
|
||||
// },
|
||||
// GetPsuInfoFunc: func() (nvml.PSUInfo, nvml.Return) {
|
||||
// panic("mock out the GetPsuInfo method")
|
||||
// },
|
||||
// GetTemperatureFunc: func(n int) (uint32, nvml.Return) {
|
||||
// panic("mock out the GetTemperature method")
|
||||
// },
|
||||
// GetUnitInfoFunc: func() (nvml.UnitInfo, nvml.Return) {
|
||||
// panic("mock out the GetUnitInfo method")
|
||||
// },
|
||||
// SetLedStateFunc: func(ledColor nvml.LedColor) nvml.Return {
|
||||
// panic("mock out the SetLedState method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedUnit in code that requires nvml.Unit
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
type Unit struct {
|
||||
// GetDevicesFunc mocks the GetDevices method.
|
||||
GetDevicesFunc func() ([]nvml.Device, nvml.Return)
|
||||
|
||||
// GetFanSpeedInfoFunc mocks the GetFanSpeedInfo method.
|
||||
GetFanSpeedInfoFunc func() (nvml.UnitFanSpeeds, nvml.Return)
|
||||
|
||||
// GetLedStateFunc mocks the GetLedState method.
|
||||
GetLedStateFunc func() (nvml.LedState, nvml.Return)
|
||||
|
||||
// GetPsuInfoFunc mocks the GetPsuInfo method.
|
||||
GetPsuInfoFunc func() (nvml.PSUInfo, nvml.Return)
|
||||
|
||||
// GetTemperatureFunc mocks the GetTemperature method.
|
||||
GetTemperatureFunc func(n int) (uint32, nvml.Return)
|
||||
|
||||
// GetUnitInfoFunc mocks the GetUnitInfo method.
|
||||
GetUnitInfoFunc func() (nvml.UnitInfo, nvml.Return)
|
||||
|
||||
// SetLedStateFunc mocks the SetLedState method.
|
||||
SetLedStateFunc func(ledColor nvml.LedColor) nvml.Return
|
||||
|
||||
// calls tracks calls to the methods.
|
||||
calls struct {
|
||||
// GetDevices holds details about calls to the GetDevices method.
|
||||
GetDevices []struct {
|
||||
}
|
||||
// GetFanSpeedInfo holds details about calls to the GetFanSpeedInfo method.
|
||||
GetFanSpeedInfo []struct {
|
||||
}
|
||||
// GetLedState holds details about calls to the GetLedState method.
|
||||
GetLedState []struct {
|
||||
}
|
||||
// GetPsuInfo holds details about calls to the GetPsuInfo method.
|
||||
GetPsuInfo []struct {
|
||||
}
|
||||
// GetTemperature holds details about calls to the GetTemperature method.
|
||||
GetTemperature []struct {
|
||||
// N is the n argument value.
|
||||
N int
|
||||
}
|
||||
// GetUnitInfo holds details about calls to the GetUnitInfo method.
|
||||
GetUnitInfo []struct {
|
||||
}
|
||||
// SetLedState holds details about calls to the SetLedState method.
|
||||
SetLedState []struct {
|
||||
// LedColor is the ledColor argument value.
|
||||
LedColor nvml.LedColor
|
||||
}
|
||||
}
|
||||
lockGetDevices sync.RWMutex
|
||||
lockGetFanSpeedInfo sync.RWMutex
|
||||
lockGetLedState sync.RWMutex
|
||||
lockGetPsuInfo sync.RWMutex
|
||||
lockGetTemperature sync.RWMutex
|
||||
lockGetUnitInfo sync.RWMutex
|
||||
lockSetLedState sync.RWMutex
|
||||
}
|
||||
|
||||
// GetDevices calls GetDevicesFunc.
|
||||
func (mock *Unit) GetDevices() ([]nvml.Device, nvml.Return) {
|
||||
if mock.GetDevicesFunc == nil {
|
||||
panic("Unit.GetDevicesFunc: method is nil but Unit.GetDevices was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetDevices.Lock()
|
||||
mock.calls.GetDevices = append(mock.calls.GetDevices, callInfo)
|
||||
mock.lockGetDevices.Unlock()
|
||||
return mock.GetDevicesFunc()
|
||||
}
|
||||
|
||||
// GetDevicesCalls gets all the calls that were made to GetDevices.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedUnit.GetDevicesCalls())
|
||||
func (mock *Unit) GetDevicesCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetDevices.RLock()
|
||||
calls = mock.calls.GetDevices
|
||||
mock.lockGetDevices.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetFanSpeedInfo calls GetFanSpeedInfoFunc.
|
||||
func (mock *Unit) GetFanSpeedInfo() (nvml.UnitFanSpeeds, nvml.Return) {
|
||||
if mock.GetFanSpeedInfoFunc == nil {
|
||||
panic("Unit.GetFanSpeedInfoFunc: method is nil but Unit.GetFanSpeedInfo was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetFanSpeedInfo.Lock()
|
||||
mock.calls.GetFanSpeedInfo = append(mock.calls.GetFanSpeedInfo, callInfo)
|
||||
mock.lockGetFanSpeedInfo.Unlock()
|
||||
return mock.GetFanSpeedInfoFunc()
|
||||
}
|
||||
|
||||
// GetFanSpeedInfoCalls gets all the calls that were made to GetFanSpeedInfo.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedUnit.GetFanSpeedInfoCalls())
|
||||
func (mock *Unit) GetFanSpeedInfoCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetFanSpeedInfo.RLock()
|
||||
calls = mock.calls.GetFanSpeedInfo
|
||||
mock.lockGetFanSpeedInfo.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetLedState calls GetLedStateFunc.
|
||||
func (mock *Unit) GetLedState() (nvml.LedState, nvml.Return) {
|
||||
if mock.GetLedStateFunc == nil {
|
||||
panic("Unit.GetLedStateFunc: method is nil but Unit.GetLedState was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetLedState.Lock()
|
||||
mock.calls.GetLedState = append(mock.calls.GetLedState, callInfo)
|
||||
mock.lockGetLedState.Unlock()
|
||||
return mock.GetLedStateFunc()
|
||||
}
|
||||
|
||||
// GetLedStateCalls gets all the calls that were made to GetLedState.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedUnit.GetLedStateCalls())
|
||||
func (mock *Unit) GetLedStateCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetLedState.RLock()
|
||||
calls = mock.calls.GetLedState
|
||||
mock.lockGetLedState.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetPsuInfo calls GetPsuInfoFunc.
|
||||
func (mock *Unit) GetPsuInfo() (nvml.PSUInfo, nvml.Return) {
|
||||
if mock.GetPsuInfoFunc == nil {
|
||||
panic("Unit.GetPsuInfoFunc: method is nil but Unit.GetPsuInfo was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetPsuInfo.Lock()
|
||||
mock.calls.GetPsuInfo = append(mock.calls.GetPsuInfo, callInfo)
|
||||
mock.lockGetPsuInfo.Unlock()
|
||||
return mock.GetPsuInfoFunc()
|
||||
}
|
||||
|
||||
// GetPsuInfoCalls gets all the calls that were made to GetPsuInfo.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedUnit.GetPsuInfoCalls())
|
||||
func (mock *Unit) GetPsuInfoCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetPsuInfo.RLock()
|
||||
calls = mock.calls.GetPsuInfo
|
||||
mock.lockGetPsuInfo.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetTemperature calls GetTemperatureFunc.
|
||||
func (mock *Unit) GetTemperature(n int) (uint32, nvml.Return) {
|
||||
if mock.GetTemperatureFunc == nil {
|
||||
panic("Unit.GetTemperatureFunc: method is nil but Unit.GetTemperature was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
N int
|
||||
}{
|
||||
N: n,
|
||||
}
|
||||
mock.lockGetTemperature.Lock()
|
||||
mock.calls.GetTemperature = append(mock.calls.GetTemperature, callInfo)
|
||||
mock.lockGetTemperature.Unlock()
|
||||
return mock.GetTemperatureFunc(n)
|
||||
}
|
||||
|
||||
// GetTemperatureCalls gets all the calls that were made to GetTemperature.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedUnit.GetTemperatureCalls())
|
||||
func (mock *Unit) GetTemperatureCalls() []struct {
|
||||
N int
|
||||
} {
|
||||
var calls []struct {
|
||||
N int
|
||||
}
|
||||
mock.lockGetTemperature.RLock()
|
||||
calls = mock.calls.GetTemperature
|
||||
mock.lockGetTemperature.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetUnitInfo calls GetUnitInfoFunc.
|
||||
func (mock *Unit) GetUnitInfo() (nvml.UnitInfo, nvml.Return) {
|
||||
if mock.GetUnitInfoFunc == nil {
|
||||
panic("Unit.GetUnitInfoFunc: method is nil but Unit.GetUnitInfo was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetUnitInfo.Lock()
|
||||
mock.calls.GetUnitInfo = append(mock.calls.GetUnitInfo, callInfo)
|
||||
mock.lockGetUnitInfo.Unlock()
|
||||
return mock.GetUnitInfoFunc()
|
||||
}
|
||||
|
||||
// GetUnitInfoCalls gets all the calls that were made to GetUnitInfo.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedUnit.GetUnitInfoCalls())
|
||||
func (mock *Unit) GetUnitInfoCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetUnitInfo.RLock()
|
||||
calls = mock.calls.GetUnitInfo
|
||||
mock.lockGetUnitInfo.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// SetLedState calls SetLedStateFunc.
|
||||
func (mock *Unit) SetLedState(ledColor nvml.LedColor) nvml.Return {
|
||||
if mock.SetLedStateFunc == nil {
|
||||
panic("Unit.SetLedStateFunc: method is nil but Unit.SetLedState was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
LedColor nvml.LedColor
|
||||
}{
|
||||
LedColor: ledColor,
|
||||
}
|
||||
mock.lockSetLedState.Lock()
|
||||
mock.calls.SetLedState = append(mock.calls.SetLedState, callInfo)
|
||||
mock.lockSetLedState.Unlock()
|
||||
return mock.SetLedStateFunc(ledColor)
|
||||
}
|
||||
|
||||
// SetLedStateCalls gets all the calls that were made to SetLedState.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedUnit.SetLedStateCalls())
|
||||
func (mock *Unit) SetLedStateCalls() []struct {
|
||||
LedColor nvml.LedColor
|
||||
} {
|
||||
var calls []struct {
|
||||
LedColor nvml.LedColor
|
||||
}
|
||||
mock.lockSetLedState.RLock()
|
||||
calls = mock.calls.SetLedState
|
||||
mock.lockSetLedState.RUnlock()
|
||||
return calls
|
||||
}
|
||||
896
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/vgpuinstance.go
generated
vendored
Normal file
896
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/vgpuinstance.go
generated
vendored
Normal file
@@ -0,0 +1,896 @@
|
||||
// Code generated by moq; DO NOT EDIT.
|
||||
// github.com/matryer/moq
|
||||
|
||||
package mock
|
||||
|
||||
import (
|
||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Ensure, that VgpuInstance does implement nvml.VgpuInstance.
|
||||
// If this is not the case, regenerate this file with moq.
|
||||
var _ nvml.VgpuInstance = &VgpuInstance{}
|
||||
|
||||
// VgpuInstance is a mock implementation of nvml.VgpuInstance.
|
||||
//
|
||||
// func TestSomethingThatUsesVgpuInstance(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked nvml.VgpuInstance
|
||||
// mockedVgpuInstance := &VgpuInstance{
|
||||
// ClearAccountingPidsFunc: func() nvml.Return {
|
||||
// panic("mock out the ClearAccountingPids method")
|
||||
// },
|
||||
// GetAccountingModeFunc: func() (nvml.EnableState, nvml.Return) {
|
||||
// panic("mock out the GetAccountingMode method")
|
||||
// },
|
||||
// GetAccountingPidsFunc: func() ([]int, nvml.Return) {
|
||||
// panic("mock out the GetAccountingPids method")
|
||||
// },
|
||||
// GetAccountingStatsFunc: func(n int) (nvml.AccountingStats, nvml.Return) {
|
||||
// panic("mock out the GetAccountingStats method")
|
||||
// },
|
||||
// GetEccModeFunc: func() (nvml.EnableState, nvml.Return) {
|
||||
// panic("mock out the GetEccMode method")
|
||||
// },
|
||||
// GetEncoderCapacityFunc: func() (int, nvml.Return) {
|
||||
// panic("mock out the GetEncoderCapacity method")
|
||||
// },
|
||||
// GetEncoderSessionsFunc: func() (int, nvml.EncoderSessionInfo, nvml.Return) {
|
||||
// panic("mock out the GetEncoderSessions method")
|
||||
// },
|
||||
// GetEncoderStatsFunc: func() (int, uint32, uint32, nvml.Return) {
|
||||
// panic("mock out the GetEncoderStats method")
|
||||
// },
|
||||
// GetFBCSessionsFunc: func() (int, nvml.FBCSessionInfo, nvml.Return) {
|
||||
// panic("mock out the GetFBCSessions method")
|
||||
// },
|
||||
// GetFBCStatsFunc: func() (nvml.FBCStats, nvml.Return) {
|
||||
// panic("mock out the GetFBCStats method")
|
||||
// },
|
||||
// GetFbUsageFunc: func() (uint64, nvml.Return) {
|
||||
// panic("mock out the GetFbUsage method")
|
||||
// },
|
||||
// GetFrameRateLimitFunc: func() (uint32, nvml.Return) {
|
||||
// panic("mock out the GetFrameRateLimit method")
|
||||
// },
|
||||
// GetGpuInstanceIdFunc: func() (int, nvml.Return) {
|
||||
// panic("mock out the GetGpuInstanceId method")
|
||||
// },
|
||||
// GetGpuPciIdFunc: func() (string, nvml.Return) {
|
||||
// panic("mock out the GetGpuPciId method")
|
||||
// },
|
||||
// GetLicenseInfoFunc: func() (nvml.VgpuLicenseInfo, nvml.Return) {
|
||||
// panic("mock out the GetLicenseInfo method")
|
||||
// },
|
||||
// GetLicenseStatusFunc: func() (int, nvml.Return) {
|
||||
// panic("mock out the GetLicenseStatus method")
|
||||
// },
|
||||
// GetMdevUUIDFunc: func() (string, nvml.Return) {
|
||||
// panic("mock out the GetMdevUUID method")
|
||||
// },
|
||||
// GetMetadataFunc: func() (nvml.VgpuMetadata, nvml.Return) {
|
||||
// panic("mock out the GetMetadata method")
|
||||
// },
|
||||
// GetTypeFunc: func() (nvml.VgpuTypeId, nvml.Return) {
|
||||
// panic("mock out the GetType method")
|
||||
// },
|
||||
// GetUUIDFunc: func() (string, nvml.Return) {
|
||||
// panic("mock out the GetUUID method")
|
||||
// },
|
||||
// GetVmDriverVersionFunc: func() (string, nvml.Return) {
|
||||
// panic("mock out the GetVmDriverVersion method")
|
||||
// },
|
||||
// GetVmIDFunc: func() (string, nvml.VgpuVmIdType, nvml.Return) {
|
||||
// panic("mock out the GetVmID method")
|
||||
// },
|
||||
// SetEncoderCapacityFunc: func(n int) nvml.Return {
|
||||
// panic("mock out the SetEncoderCapacity method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedVgpuInstance in code that requires nvml.VgpuInstance
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
type VgpuInstance struct {
|
||||
// ClearAccountingPidsFunc mocks the ClearAccountingPids method.
|
||||
ClearAccountingPidsFunc func() nvml.Return
|
||||
|
||||
// GetAccountingModeFunc mocks the GetAccountingMode method.
|
||||
GetAccountingModeFunc func() (nvml.EnableState, nvml.Return)
|
||||
|
||||
// GetAccountingPidsFunc mocks the GetAccountingPids method.
|
||||
GetAccountingPidsFunc func() ([]int, nvml.Return)
|
||||
|
||||
// GetAccountingStatsFunc mocks the GetAccountingStats method.
|
||||
GetAccountingStatsFunc func(n int) (nvml.AccountingStats, nvml.Return)
|
||||
|
||||
// GetEccModeFunc mocks the GetEccMode method.
|
||||
GetEccModeFunc func() (nvml.EnableState, nvml.Return)
|
||||
|
||||
// GetEncoderCapacityFunc mocks the GetEncoderCapacity method.
|
||||
GetEncoderCapacityFunc func() (int, nvml.Return)
|
||||
|
||||
// GetEncoderSessionsFunc mocks the GetEncoderSessions method.
|
||||
GetEncoderSessionsFunc func() (int, nvml.EncoderSessionInfo, nvml.Return)
|
||||
|
||||
// GetEncoderStatsFunc mocks the GetEncoderStats method.
|
||||
GetEncoderStatsFunc func() (int, uint32, uint32, nvml.Return)
|
||||
|
||||
// GetFBCSessionsFunc mocks the GetFBCSessions method.
|
||||
GetFBCSessionsFunc func() (int, nvml.FBCSessionInfo, nvml.Return)
|
||||
|
||||
// GetFBCStatsFunc mocks the GetFBCStats method.
|
||||
GetFBCStatsFunc func() (nvml.FBCStats, nvml.Return)
|
||||
|
||||
// GetFbUsageFunc mocks the GetFbUsage method.
|
||||
GetFbUsageFunc func() (uint64, nvml.Return)
|
||||
|
||||
// GetFrameRateLimitFunc mocks the GetFrameRateLimit method.
|
||||
GetFrameRateLimitFunc func() (uint32, nvml.Return)
|
||||
|
||||
// GetGpuInstanceIdFunc mocks the GetGpuInstanceId method.
|
||||
GetGpuInstanceIdFunc func() (int, nvml.Return)
|
||||
|
||||
// GetGpuPciIdFunc mocks the GetGpuPciId method.
|
||||
GetGpuPciIdFunc func() (string, nvml.Return)
|
||||
|
||||
// GetLicenseInfoFunc mocks the GetLicenseInfo method.
|
||||
GetLicenseInfoFunc func() (nvml.VgpuLicenseInfo, nvml.Return)
|
||||
|
||||
// GetLicenseStatusFunc mocks the GetLicenseStatus method.
|
||||
GetLicenseStatusFunc func() (int, nvml.Return)
|
||||
|
||||
// GetMdevUUIDFunc mocks the GetMdevUUID method.
|
||||
GetMdevUUIDFunc func() (string, nvml.Return)
|
||||
|
||||
// GetMetadataFunc mocks the GetMetadata method.
|
||||
GetMetadataFunc func() (nvml.VgpuMetadata, nvml.Return)
|
||||
|
||||
// GetTypeFunc mocks the GetType method.
|
||||
GetTypeFunc func() (nvml.VgpuTypeId, nvml.Return)
|
||||
|
||||
// GetUUIDFunc mocks the GetUUID method.
|
||||
GetUUIDFunc func() (string, nvml.Return)
|
||||
|
||||
// GetVmDriverVersionFunc mocks the GetVmDriverVersion method.
|
||||
GetVmDriverVersionFunc func() (string, nvml.Return)
|
||||
|
||||
// GetVmIDFunc mocks the GetVmID method.
|
||||
GetVmIDFunc func() (string, nvml.VgpuVmIdType, nvml.Return)
|
||||
|
||||
// SetEncoderCapacityFunc mocks the SetEncoderCapacity method.
|
||||
SetEncoderCapacityFunc func(n int) nvml.Return
|
||||
|
||||
// calls tracks calls to the methods.
|
||||
calls struct {
|
||||
// ClearAccountingPids holds details about calls to the ClearAccountingPids method.
|
||||
ClearAccountingPids []struct {
|
||||
}
|
||||
// GetAccountingMode holds details about calls to the GetAccountingMode method.
|
||||
GetAccountingMode []struct {
|
||||
}
|
||||
// GetAccountingPids holds details about calls to the GetAccountingPids method.
|
||||
GetAccountingPids []struct {
|
||||
}
|
||||
// GetAccountingStats holds details about calls to the GetAccountingStats method.
|
||||
GetAccountingStats []struct {
|
||||
// N is the n argument value.
|
||||
N int
|
||||
}
|
||||
// GetEccMode holds details about calls to the GetEccMode method.
|
||||
GetEccMode []struct {
|
||||
}
|
||||
// GetEncoderCapacity holds details about calls to the GetEncoderCapacity method.
|
||||
GetEncoderCapacity []struct {
|
||||
}
|
||||
// GetEncoderSessions holds details about calls to the GetEncoderSessions method.
|
||||
GetEncoderSessions []struct {
|
||||
}
|
||||
// GetEncoderStats holds details about calls to the GetEncoderStats method.
|
||||
GetEncoderStats []struct {
|
||||
}
|
||||
// GetFBCSessions holds details about calls to the GetFBCSessions method.
|
||||
GetFBCSessions []struct {
|
||||
}
|
||||
// GetFBCStats holds details about calls to the GetFBCStats method.
|
||||
GetFBCStats []struct {
|
||||
}
|
||||
// GetFbUsage holds details about calls to the GetFbUsage method.
|
||||
GetFbUsage []struct {
|
||||
}
|
||||
// GetFrameRateLimit holds details about calls to the GetFrameRateLimit method.
|
||||
GetFrameRateLimit []struct {
|
||||
}
|
||||
// GetGpuInstanceId holds details about calls to the GetGpuInstanceId method.
|
||||
GetGpuInstanceId []struct {
|
||||
}
|
||||
// GetGpuPciId holds details about calls to the GetGpuPciId method.
|
||||
GetGpuPciId []struct {
|
||||
}
|
||||
// GetLicenseInfo holds details about calls to the GetLicenseInfo method.
|
||||
GetLicenseInfo []struct {
|
||||
}
|
||||
// GetLicenseStatus holds details about calls to the GetLicenseStatus method.
|
||||
GetLicenseStatus []struct {
|
||||
}
|
||||
// GetMdevUUID holds details about calls to the GetMdevUUID method.
|
||||
GetMdevUUID []struct {
|
||||
}
|
||||
// GetMetadata holds details about calls to the GetMetadata method.
|
||||
GetMetadata []struct {
|
||||
}
|
||||
// GetType holds details about calls to the GetType method.
|
||||
GetType []struct {
|
||||
}
|
||||
// GetUUID holds details about calls to the GetUUID method.
|
||||
GetUUID []struct {
|
||||
}
|
||||
// GetVmDriverVersion holds details about calls to the GetVmDriverVersion method.
|
||||
GetVmDriverVersion []struct {
|
||||
}
|
||||
// GetVmID holds details about calls to the GetVmID method.
|
||||
GetVmID []struct {
|
||||
}
|
||||
// SetEncoderCapacity holds details about calls to the SetEncoderCapacity method.
|
||||
SetEncoderCapacity []struct {
|
||||
// N is the n argument value.
|
||||
N int
|
||||
}
|
||||
}
|
||||
lockClearAccountingPids sync.RWMutex
|
||||
lockGetAccountingMode sync.RWMutex
|
||||
lockGetAccountingPids sync.RWMutex
|
||||
lockGetAccountingStats sync.RWMutex
|
||||
lockGetEccMode sync.RWMutex
|
||||
lockGetEncoderCapacity sync.RWMutex
|
||||
lockGetEncoderSessions sync.RWMutex
|
||||
lockGetEncoderStats sync.RWMutex
|
||||
lockGetFBCSessions sync.RWMutex
|
||||
lockGetFBCStats sync.RWMutex
|
||||
lockGetFbUsage sync.RWMutex
|
||||
lockGetFrameRateLimit sync.RWMutex
|
||||
lockGetGpuInstanceId sync.RWMutex
|
||||
lockGetGpuPciId sync.RWMutex
|
||||
lockGetLicenseInfo sync.RWMutex
|
||||
lockGetLicenseStatus sync.RWMutex
|
||||
lockGetMdevUUID sync.RWMutex
|
||||
lockGetMetadata sync.RWMutex
|
||||
lockGetType sync.RWMutex
|
||||
lockGetUUID sync.RWMutex
|
||||
lockGetVmDriverVersion sync.RWMutex
|
||||
lockGetVmID sync.RWMutex
|
||||
lockSetEncoderCapacity sync.RWMutex
|
||||
}
|
||||
|
||||
// ClearAccountingPids calls ClearAccountingPidsFunc.
|
||||
func (mock *VgpuInstance) ClearAccountingPids() nvml.Return {
|
||||
if mock.ClearAccountingPidsFunc == nil {
|
||||
panic("VgpuInstance.ClearAccountingPidsFunc: method is nil but VgpuInstance.ClearAccountingPids was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockClearAccountingPids.Lock()
|
||||
mock.calls.ClearAccountingPids = append(mock.calls.ClearAccountingPids, callInfo)
|
||||
mock.lockClearAccountingPids.Unlock()
|
||||
return mock.ClearAccountingPidsFunc()
|
||||
}
|
||||
|
||||
// ClearAccountingPidsCalls gets all the calls that were made to ClearAccountingPids.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.ClearAccountingPidsCalls())
|
||||
func (mock *VgpuInstance) ClearAccountingPidsCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockClearAccountingPids.RLock()
|
||||
calls = mock.calls.ClearAccountingPids
|
||||
mock.lockClearAccountingPids.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetAccountingMode calls GetAccountingModeFunc.
|
||||
func (mock *VgpuInstance) GetAccountingMode() (nvml.EnableState, nvml.Return) {
|
||||
if mock.GetAccountingModeFunc == nil {
|
||||
panic("VgpuInstance.GetAccountingModeFunc: method is nil but VgpuInstance.GetAccountingMode was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetAccountingMode.Lock()
|
||||
mock.calls.GetAccountingMode = append(mock.calls.GetAccountingMode, callInfo)
|
||||
mock.lockGetAccountingMode.Unlock()
|
||||
return mock.GetAccountingModeFunc()
|
||||
}
|
||||
|
||||
// GetAccountingModeCalls gets all the calls that were made to GetAccountingMode.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetAccountingModeCalls())
|
||||
func (mock *VgpuInstance) GetAccountingModeCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetAccountingMode.RLock()
|
||||
calls = mock.calls.GetAccountingMode
|
||||
mock.lockGetAccountingMode.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetAccountingPids calls GetAccountingPidsFunc.
|
||||
func (mock *VgpuInstance) GetAccountingPids() ([]int, nvml.Return) {
|
||||
if mock.GetAccountingPidsFunc == nil {
|
||||
panic("VgpuInstance.GetAccountingPidsFunc: method is nil but VgpuInstance.GetAccountingPids was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetAccountingPids.Lock()
|
||||
mock.calls.GetAccountingPids = append(mock.calls.GetAccountingPids, callInfo)
|
||||
mock.lockGetAccountingPids.Unlock()
|
||||
return mock.GetAccountingPidsFunc()
|
||||
}
|
||||
|
||||
// GetAccountingPidsCalls gets all the calls that were made to GetAccountingPids.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetAccountingPidsCalls())
|
||||
func (mock *VgpuInstance) GetAccountingPidsCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetAccountingPids.RLock()
|
||||
calls = mock.calls.GetAccountingPids
|
||||
mock.lockGetAccountingPids.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetAccountingStats calls GetAccountingStatsFunc.
|
||||
func (mock *VgpuInstance) GetAccountingStats(n int) (nvml.AccountingStats, nvml.Return) {
|
||||
if mock.GetAccountingStatsFunc == nil {
|
||||
panic("VgpuInstance.GetAccountingStatsFunc: method is nil but VgpuInstance.GetAccountingStats was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
N int
|
||||
}{
|
||||
N: n,
|
||||
}
|
||||
mock.lockGetAccountingStats.Lock()
|
||||
mock.calls.GetAccountingStats = append(mock.calls.GetAccountingStats, callInfo)
|
||||
mock.lockGetAccountingStats.Unlock()
|
||||
return mock.GetAccountingStatsFunc(n)
|
||||
}
|
||||
|
||||
// GetAccountingStatsCalls gets all the calls that were made to GetAccountingStats.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetAccountingStatsCalls())
|
||||
func (mock *VgpuInstance) GetAccountingStatsCalls() []struct {
|
||||
N int
|
||||
} {
|
||||
var calls []struct {
|
||||
N int
|
||||
}
|
||||
mock.lockGetAccountingStats.RLock()
|
||||
calls = mock.calls.GetAccountingStats
|
||||
mock.lockGetAccountingStats.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetEccMode calls GetEccModeFunc.
|
||||
func (mock *VgpuInstance) GetEccMode() (nvml.EnableState, nvml.Return) {
|
||||
if mock.GetEccModeFunc == nil {
|
||||
panic("VgpuInstance.GetEccModeFunc: method is nil but VgpuInstance.GetEccMode was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetEccMode.Lock()
|
||||
mock.calls.GetEccMode = append(mock.calls.GetEccMode, callInfo)
|
||||
mock.lockGetEccMode.Unlock()
|
||||
return mock.GetEccModeFunc()
|
||||
}
|
||||
|
||||
// GetEccModeCalls gets all the calls that were made to GetEccMode.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetEccModeCalls())
|
||||
func (mock *VgpuInstance) GetEccModeCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetEccMode.RLock()
|
||||
calls = mock.calls.GetEccMode
|
||||
mock.lockGetEccMode.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetEncoderCapacity calls GetEncoderCapacityFunc.
|
||||
func (mock *VgpuInstance) GetEncoderCapacity() (int, nvml.Return) {
|
||||
if mock.GetEncoderCapacityFunc == nil {
|
||||
panic("VgpuInstance.GetEncoderCapacityFunc: method is nil but VgpuInstance.GetEncoderCapacity was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetEncoderCapacity.Lock()
|
||||
mock.calls.GetEncoderCapacity = append(mock.calls.GetEncoderCapacity, callInfo)
|
||||
mock.lockGetEncoderCapacity.Unlock()
|
||||
return mock.GetEncoderCapacityFunc()
|
||||
}
|
||||
|
||||
// GetEncoderCapacityCalls gets all the calls that were made to GetEncoderCapacity.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetEncoderCapacityCalls())
|
||||
func (mock *VgpuInstance) GetEncoderCapacityCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetEncoderCapacity.RLock()
|
||||
calls = mock.calls.GetEncoderCapacity
|
||||
mock.lockGetEncoderCapacity.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetEncoderSessions calls GetEncoderSessionsFunc.
|
||||
func (mock *VgpuInstance) GetEncoderSessions() (int, nvml.EncoderSessionInfo, nvml.Return) {
|
||||
if mock.GetEncoderSessionsFunc == nil {
|
||||
panic("VgpuInstance.GetEncoderSessionsFunc: method is nil but VgpuInstance.GetEncoderSessions was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetEncoderSessions.Lock()
|
||||
mock.calls.GetEncoderSessions = append(mock.calls.GetEncoderSessions, callInfo)
|
||||
mock.lockGetEncoderSessions.Unlock()
|
||||
return mock.GetEncoderSessionsFunc()
|
||||
}
|
||||
|
||||
// GetEncoderSessionsCalls gets all the calls that were made to GetEncoderSessions.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetEncoderSessionsCalls())
|
||||
func (mock *VgpuInstance) GetEncoderSessionsCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetEncoderSessions.RLock()
|
||||
calls = mock.calls.GetEncoderSessions
|
||||
mock.lockGetEncoderSessions.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetEncoderStats calls GetEncoderStatsFunc.
|
||||
func (mock *VgpuInstance) GetEncoderStats() (int, uint32, uint32, nvml.Return) {
|
||||
if mock.GetEncoderStatsFunc == nil {
|
||||
panic("VgpuInstance.GetEncoderStatsFunc: method is nil but VgpuInstance.GetEncoderStats was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetEncoderStats.Lock()
|
||||
mock.calls.GetEncoderStats = append(mock.calls.GetEncoderStats, callInfo)
|
||||
mock.lockGetEncoderStats.Unlock()
|
||||
return mock.GetEncoderStatsFunc()
|
||||
}
|
||||
|
||||
// GetEncoderStatsCalls gets all the calls that were made to GetEncoderStats.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetEncoderStatsCalls())
|
||||
func (mock *VgpuInstance) GetEncoderStatsCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetEncoderStats.RLock()
|
||||
calls = mock.calls.GetEncoderStats
|
||||
mock.lockGetEncoderStats.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetFBCSessions calls GetFBCSessionsFunc.
|
||||
func (mock *VgpuInstance) GetFBCSessions() (int, nvml.FBCSessionInfo, nvml.Return) {
|
||||
if mock.GetFBCSessionsFunc == nil {
|
||||
panic("VgpuInstance.GetFBCSessionsFunc: method is nil but VgpuInstance.GetFBCSessions was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetFBCSessions.Lock()
|
||||
mock.calls.GetFBCSessions = append(mock.calls.GetFBCSessions, callInfo)
|
||||
mock.lockGetFBCSessions.Unlock()
|
||||
return mock.GetFBCSessionsFunc()
|
||||
}
|
||||
|
||||
// GetFBCSessionsCalls gets all the calls that were made to GetFBCSessions.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetFBCSessionsCalls())
|
||||
func (mock *VgpuInstance) GetFBCSessionsCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetFBCSessions.RLock()
|
||||
calls = mock.calls.GetFBCSessions
|
||||
mock.lockGetFBCSessions.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetFBCStats calls GetFBCStatsFunc.
|
||||
func (mock *VgpuInstance) GetFBCStats() (nvml.FBCStats, nvml.Return) {
|
||||
if mock.GetFBCStatsFunc == nil {
|
||||
panic("VgpuInstance.GetFBCStatsFunc: method is nil but VgpuInstance.GetFBCStats was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetFBCStats.Lock()
|
||||
mock.calls.GetFBCStats = append(mock.calls.GetFBCStats, callInfo)
|
||||
mock.lockGetFBCStats.Unlock()
|
||||
return mock.GetFBCStatsFunc()
|
||||
}
|
||||
|
||||
// GetFBCStatsCalls gets all the calls that were made to GetFBCStats.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetFBCStatsCalls())
|
||||
func (mock *VgpuInstance) GetFBCStatsCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetFBCStats.RLock()
|
||||
calls = mock.calls.GetFBCStats
|
||||
mock.lockGetFBCStats.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetFbUsage calls GetFbUsageFunc.
|
||||
func (mock *VgpuInstance) GetFbUsage() (uint64, nvml.Return) {
|
||||
if mock.GetFbUsageFunc == nil {
|
||||
panic("VgpuInstance.GetFbUsageFunc: method is nil but VgpuInstance.GetFbUsage was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetFbUsage.Lock()
|
||||
mock.calls.GetFbUsage = append(mock.calls.GetFbUsage, callInfo)
|
||||
mock.lockGetFbUsage.Unlock()
|
||||
return mock.GetFbUsageFunc()
|
||||
}
|
||||
|
||||
// GetFbUsageCalls gets all the calls that were made to GetFbUsage.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetFbUsageCalls())
|
||||
func (mock *VgpuInstance) GetFbUsageCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetFbUsage.RLock()
|
||||
calls = mock.calls.GetFbUsage
|
||||
mock.lockGetFbUsage.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetFrameRateLimit calls GetFrameRateLimitFunc.
|
||||
func (mock *VgpuInstance) GetFrameRateLimit() (uint32, nvml.Return) {
|
||||
if mock.GetFrameRateLimitFunc == nil {
|
||||
panic("VgpuInstance.GetFrameRateLimitFunc: method is nil but VgpuInstance.GetFrameRateLimit was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetFrameRateLimit.Lock()
|
||||
mock.calls.GetFrameRateLimit = append(mock.calls.GetFrameRateLimit, callInfo)
|
||||
mock.lockGetFrameRateLimit.Unlock()
|
||||
return mock.GetFrameRateLimitFunc()
|
||||
}
|
||||
|
||||
// GetFrameRateLimitCalls gets all the calls that were made to GetFrameRateLimit.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetFrameRateLimitCalls())
|
||||
func (mock *VgpuInstance) GetFrameRateLimitCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetFrameRateLimit.RLock()
|
||||
calls = mock.calls.GetFrameRateLimit
|
||||
mock.lockGetFrameRateLimit.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetGpuInstanceId calls GetGpuInstanceIdFunc.
|
||||
func (mock *VgpuInstance) GetGpuInstanceId() (int, nvml.Return) {
|
||||
if mock.GetGpuInstanceIdFunc == nil {
|
||||
panic("VgpuInstance.GetGpuInstanceIdFunc: method is nil but VgpuInstance.GetGpuInstanceId was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetGpuInstanceId.Lock()
|
||||
mock.calls.GetGpuInstanceId = append(mock.calls.GetGpuInstanceId, callInfo)
|
||||
mock.lockGetGpuInstanceId.Unlock()
|
||||
return mock.GetGpuInstanceIdFunc()
|
||||
}
|
||||
|
||||
// GetGpuInstanceIdCalls gets all the calls that were made to GetGpuInstanceId.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetGpuInstanceIdCalls())
|
||||
func (mock *VgpuInstance) GetGpuInstanceIdCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetGpuInstanceId.RLock()
|
||||
calls = mock.calls.GetGpuInstanceId
|
||||
mock.lockGetGpuInstanceId.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetGpuPciId calls GetGpuPciIdFunc.
|
||||
func (mock *VgpuInstance) GetGpuPciId() (string, nvml.Return) {
|
||||
if mock.GetGpuPciIdFunc == nil {
|
||||
panic("VgpuInstance.GetGpuPciIdFunc: method is nil but VgpuInstance.GetGpuPciId was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetGpuPciId.Lock()
|
||||
mock.calls.GetGpuPciId = append(mock.calls.GetGpuPciId, callInfo)
|
||||
mock.lockGetGpuPciId.Unlock()
|
||||
return mock.GetGpuPciIdFunc()
|
||||
}
|
||||
|
||||
// GetGpuPciIdCalls gets all the calls that were made to GetGpuPciId.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetGpuPciIdCalls())
|
||||
func (mock *VgpuInstance) GetGpuPciIdCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetGpuPciId.RLock()
|
||||
calls = mock.calls.GetGpuPciId
|
||||
mock.lockGetGpuPciId.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetLicenseInfo calls GetLicenseInfoFunc.
|
||||
func (mock *VgpuInstance) GetLicenseInfo() (nvml.VgpuLicenseInfo, nvml.Return) {
|
||||
if mock.GetLicenseInfoFunc == nil {
|
||||
panic("VgpuInstance.GetLicenseInfoFunc: method is nil but VgpuInstance.GetLicenseInfo was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetLicenseInfo.Lock()
|
||||
mock.calls.GetLicenseInfo = append(mock.calls.GetLicenseInfo, callInfo)
|
||||
mock.lockGetLicenseInfo.Unlock()
|
||||
return mock.GetLicenseInfoFunc()
|
||||
}
|
||||
|
||||
// GetLicenseInfoCalls gets all the calls that were made to GetLicenseInfo.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetLicenseInfoCalls())
|
||||
func (mock *VgpuInstance) GetLicenseInfoCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetLicenseInfo.RLock()
|
||||
calls = mock.calls.GetLicenseInfo
|
||||
mock.lockGetLicenseInfo.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetLicenseStatus calls GetLicenseStatusFunc.
|
||||
func (mock *VgpuInstance) GetLicenseStatus() (int, nvml.Return) {
|
||||
if mock.GetLicenseStatusFunc == nil {
|
||||
panic("VgpuInstance.GetLicenseStatusFunc: method is nil but VgpuInstance.GetLicenseStatus was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetLicenseStatus.Lock()
|
||||
mock.calls.GetLicenseStatus = append(mock.calls.GetLicenseStatus, callInfo)
|
||||
mock.lockGetLicenseStatus.Unlock()
|
||||
return mock.GetLicenseStatusFunc()
|
||||
}
|
||||
|
||||
// GetLicenseStatusCalls gets all the calls that were made to GetLicenseStatus.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetLicenseStatusCalls())
|
||||
func (mock *VgpuInstance) GetLicenseStatusCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetLicenseStatus.RLock()
|
||||
calls = mock.calls.GetLicenseStatus
|
||||
mock.lockGetLicenseStatus.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetMdevUUID calls GetMdevUUIDFunc.
|
||||
func (mock *VgpuInstance) GetMdevUUID() (string, nvml.Return) {
|
||||
if mock.GetMdevUUIDFunc == nil {
|
||||
panic("VgpuInstance.GetMdevUUIDFunc: method is nil but VgpuInstance.GetMdevUUID was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetMdevUUID.Lock()
|
||||
mock.calls.GetMdevUUID = append(mock.calls.GetMdevUUID, callInfo)
|
||||
mock.lockGetMdevUUID.Unlock()
|
||||
return mock.GetMdevUUIDFunc()
|
||||
}
|
||||
|
||||
// GetMdevUUIDCalls gets all the calls that were made to GetMdevUUID.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetMdevUUIDCalls())
|
||||
func (mock *VgpuInstance) GetMdevUUIDCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetMdevUUID.RLock()
|
||||
calls = mock.calls.GetMdevUUID
|
||||
mock.lockGetMdevUUID.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetMetadata calls GetMetadataFunc.
|
||||
func (mock *VgpuInstance) GetMetadata() (nvml.VgpuMetadata, nvml.Return) {
|
||||
if mock.GetMetadataFunc == nil {
|
||||
panic("VgpuInstance.GetMetadataFunc: method is nil but VgpuInstance.GetMetadata was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetMetadata.Lock()
|
||||
mock.calls.GetMetadata = append(mock.calls.GetMetadata, callInfo)
|
||||
mock.lockGetMetadata.Unlock()
|
||||
return mock.GetMetadataFunc()
|
||||
}
|
||||
|
||||
// GetMetadataCalls gets all the calls that were made to GetMetadata.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetMetadataCalls())
|
||||
func (mock *VgpuInstance) GetMetadataCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetMetadata.RLock()
|
||||
calls = mock.calls.GetMetadata
|
||||
mock.lockGetMetadata.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetType calls GetTypeFunc.
|
||||
func (mock *VgpuInstance) GetType() (nvml.VgpuTypeId, nvml.Return) {
|
||||
if mock.GetTypeFunc == nil {
|
||||
panic("VgpuInstance.GetTypeFunc: method is nil but VgpuInstance.GetType was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetType.Lock()
|
||||
mock.calls.GetType = append(mock.calls.GetType, callInfo)
|
||||
mock.lockGetType.Unlock()
|
||||
return mock.GetTypeFunc()
|
||||
}
|
||||
|
||||
// GetTypeCalls gets all the calls that were made to GetType.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetTypeCalls())
|
||||
func (mock *VgpuInstance) GetTypeCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetType.RLock()
|
||||
calls = mock.calls.GetType
|
||||
mock.lockGetType.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetUUID calls GetUUIDFunc.
|
||||
func (mock *VgpuInstance) GetUUID() (string, nvml.Return) {
|
||||
if mock.GetUUIDFunc == nil {
|
||||
panic("VgpuInstance.GetUUIDFunc: method is nil but VgpuInstance.GetUUID was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetUUID.Lock()
|
||||
mock.calls.GetUUID = append(mock.calls.GetUUID, callInfo)
|
||||
mock.lockGetUUID.Unlock()
|
||||
return mock.GetUUIDFunc()
|
||||
}
|
||||
|
||||
// GetUUIDCalls gets all the calls that were made to GetUUID.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetUUIDCalls())
|
||||
func (mock *VgpuInstance) GetUUIDCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetUUID.RLock()
|
||||
calls = mock.calls.GetUUID
|
||||
mock.lockGetUUID.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetVmDriverVersion calls GetVmDriverVersionFunc.
|
||||
func (mock *VgpuInstance) GetVmDriverVersion() (string, nvml.Return) {
|
||||
if mock.GetVmDriverVersionFunc == nil {
|
||||
panic("VgpuInstance.GetVmDriverVersionFunc: method is nil but VgpuInstance.GetVmDriverVersion was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetVmDriverVersion.Lock()
|
||||
mock.calls.GetVmDriverVersion = append(mock.calls.GetVmDriverVersion, callInfo)
|
||||
mock.lockGetVmDriverVersion.Unlock()
|
||||
return mock.GetVmDriverVersionFunc()
|
||||
}
|
||||
|
||||
// GetVmDriverVersionCalls gets all the calls that were made to GetVmDriverVersion.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetVmDriverVersionCalls())
|
||||
func (mock *VgpuInstance) GetVmDriverVersionCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetVmDriverVersion.RLock()
|
||||
calls = mock.calls.GetVmDriverVersion
|
||||
mock.lockGetVmDriverVersion.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetVmID calls GetVmIDFunc.
|
||||
func (mock *VgpuInstance) GetVmID() (string, nvml.VgpuVmIdType, nvml.Return) {
|
||||
if mock.GetVmIDFunc == nil {
|
||||
panic("VgpuInstance.GetVmIDFunc: method is nil but VgpuInstance.GetVmID was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetVmID.Lock()
|
||||
mock.calls.GetVmID = append(mock.calls.GetVmID, callInfo)
|
||||
mock.lockGetVmID.Unlock()
|
||||
return mock.GetVmIDFunc()
|
||||
}
|
||||
|
||||
// GetVmIDCalls gets all the calls that were made to GetVmID.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.GetVmIDCalls())
|
||||
func (mock *VgpuInstance) GetVmIDCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetVmID.RLock()
|
||||
calls = mock.calls.GetVmID
|
||||
mock.lockGetVmID.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// SetEncoderCapacity calls SetEncoderCapacityFunc.
|
||||
func (mock *VgpuInstance) SetEncoderCapacity(n int) nvml.Return {
|
||||
if mock.SetEncoderCapacityFunc == nil {
|
||||
panic("VgpuInstance.SetEncoderCapacityFunc: method is nil but VgpuInstance.SetEncoderCapacity was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
N int
|
||||
}{
|
||||
N: n,
|
||||
}
|
||||
mock.lockSetEncoderCapacity.Lock()
|
||||
mock.calls.SetEncoderCapacity = append(mock.calls.SetEncoderCapacity, callInfo)
|
||||
mock.lockSetEncoderCapacity.Unlock()
|
||||
return mock.SetEncoderCapacityFunc(n)
|
||||
}
|
||||
|
||||
// SetEncoderCapacityCalls gets all the calls that were made to SetEncoderCapacity.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuInstance.SetEncoderCapacityCalls())
|
||||
func (mock *VgpuInstance) SetEncoderCapacityCalls() []struct {
|
||||
N int
|
||||
} {
|
||||
var calls []struct {
|
||||
N int
|
||||
}
|
||||
mock.lockSetEncoderCapacity.RLock()
|
||||
calls = mock.calls.SetEncoderCapacity
|
||||
mock.lockSetEncoderCapacity.RUnlock()
|
||||
return calls
|
||||
}
|
||||
496
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/vgputypeid.go
generated
vendored
Normal file
496
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/vgputypeid.go
generated
vendored
Normal file
@@ -0,0 +1,496 @@
|
||||
// Code generated by moq; DO NOT EDIT.
|
||||
// github.com/matryer/moq
|
||||
|
||||
package mock
|
||||
|
||||
import (
|
||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Ensure, that VgpuTypeId does implement nvml.VgpuTypeId.
|
||||
// If this is not the case, regenerate this file with moq.
|
||||
var _ nvml.VgpuTypeId = &VgpuTypeId{}
|
||||
|
||||
// VgpuTypeId is a mock implementation of nvml.VgpuTypeId.
|
||||
//
|
||||
// func TestSomethingThatUsesVgpuTypeId(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked nvml.VgpuTypeId
|
||||
// mockedVgpuTypeId := &VgpuTypeId{
|
||||
// GetCapabilitiesFunc: func(vgpuCapability nvml.VgpuCapability) (bool, nvml.Return) {
|
||||
// panic("mock out the GetCapabilities method")
|
||||
// },
|
||||
// GetClassFunc: func() (string, nvml.Return) {
|
||||
// panic("mock out the GetClass method")
|
||||
// },
|
||||
// GetDeviceIDFunc: func() (uint64, uint64, nvml.Return) {
|
||||
// panic("mock out the GetDeviceID method")
|
||||
// },
|
||||
// GetFrameRateLimitFunc: func() (uint32, nvml.Return) {
|
||||
// panic("mock out the GetFrameRateLimit method")
|
||||
// },
|
||||
// GetFramebufferSizeFunc: func() (uint64, nvml.Return) {
|
||||
// panic("mock out the GetFramebufferSize method")
|
||||
// },
|
||||
// GetGpuInstanceProfileIdFunc: func() (uint32, nvml.Return) {
|
||||
// panic("mock out the GetGpuInstanceProfileId method")
|
||||
// },
|
||||
// GetLicenseFunc: func() (string, nvml.Return) {
|
||||
// panic("mock out the GetLicense method")
|
||||
// },
|
||||
// GetMaxInstancesFunc: func(device nvml.Device) (int, nvml.Return) {
|
||||
// panic("mock out the GetMaxInstances method")
|
||||
// },
|
||||
// GetMaxInstancesPerVmFunc: func() (int, nvml.Return) {
|
||||
// panic("mock out the GetMaxInstancesPerVm method")
|
||||
// },
|
||||
// GetNameFunc: func() (string, nvml.Return) {
|
||||
// panic("mock out the GetName method")
|
||||
// },
|
||||
// GetNumDisplayHeadsFunc: func() (int, nvml.Return) {
|
||||
// panic("mock out the GetNumDisplayHeads method")
|
||||
// },
|
||||
// GetResolutionFunc: func(n int) (uint32, uint32, nvml.Return) {
|
||||
// panic("mock out the GetResolution method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedVgpuTypeId in code that requires nvml.VgpuTypeId
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
type VgpuTypeId struct {
|
||||
// GetCapabilitiesFunc mocks the GetCapabilities method.
|
||||
GetCapabilitiesFunc func(vgpuCapability nvml.VgpuCapability) (bool, nvml.Return)
|
||||
|
||||
// GetClassFunc mocks the GetClass method.
|
||||
GetClassFunc func() (string, nvml.Return)
|
||||
|
||||
// GetDeviceIDFunc mocks the GetDeviceID method.
|
||||
GetDeviceIDFunc func() (uint64, uint64, nvml.Return)
|
||||
|
||||
// GetFrameRateLimitFunc mocks the GetFrameRateLimit method.
|
||||
GetFrameRateLimitFunc func() (uint32, nvml.Return)
|
||||
|
||||
// GetFramebufferSizeFunc mocks the GetFramebufferSize method.
|
||||
GetFramebufferSizeFunc func() (uint64, nvml.Return)
|
||||
|
||||
// GetGpuInstanceProfileIdFunc mocks the GetGpuInstanceProfileId method.
|
||||
GetGpuInstanceProfileIdFunc func() (uint32, nvml.Return)
|
||||
|
||||
// GetLicenseFunc mocks the GetLicense method.
|
||||
GetLicenseFunc func() (string, nvml.Return)
|
||||
|
||||
// GetMaxInstancesFunc mocks the GetMaxInstances method.
|
||||
GetMaxInstancesFunc func(device nvml.Device) (int, nvml.Return)
|
||||
|
||||
// GetMaxInstancesPerVmFunc mocks the GetMaxInstancesPerVm method.
|
||||
GetMaxInstancesPerVmFunc func() (int, nvml.Return)
|
||||
|
||||
// GetNameFunc mocks the GetName method.
|
||||
GetNameFunc func() (string, nvml.Return)
|
||||
|
||||
// GetNumDisplayHeadsFunc mocks the GetNumDisplayHeads method.
|
||||
GetNumDisplayHeadsFunc func() (int, nvml.Return)
|
||||
|
||||
// GetResolutionFunc mocks the GetResolution method.
|
||||
GetResolutionFunc func(n int) (uint32, uint32, nvml.Return)
|
||||
|
||||
// calls tracks calls to the methods.
|
||||
calls struct {
|
||||
// GetCapabilities holds details about calls to the GetCapabilities method.
|
||||
GetCapabilities []struct {
|
||||
// VgpuCapability is the vgpuCapability argument value.
|
||||
VgpuCapability nvml.VgpuCapability
|
||||
}
|
||||
// GetClass holds details about calls to the GetClass method.
|
||||
GetClass []struct {
|
||||
}
|
||||
// GetDeviceID holds details about calls to the GetDeviceID method.
|
||||
GetDeviceID []struct {
|
||||
}
|
||||
// GetFrameRateLimit holds details about calls to the GetFrameRateLimit method.
|
||||
GetFrameRateLimit []struct {
|
||||
}
|
||||
// GetFramebufferSize holds details about calls to the GetFramebufferSize method.
|
||||
GetFramebufferSize []struct {
|
||||
}
|
||||
// GetGpuInstanceProfileId holds details about calls to the GetGpuInstanceProfileId method.
|
||||
GetGpuInstanceProfileId []struct {
|
||||
}
|
||||
// GetLicense holds details about calls to the GetLicense method.
|
||||
GetLicense []struct {
|
||||
}
|
||||
// GetMaxInstances holds details about calls to the GetMaxInstances method.
|
||||
GetMaxInstances []struct {
|
||||
// Device is the device argument value.
|
||||
Device nvml.Device
|
||||
}
|
||||
// GetMaxInstancesPerVm holds details about calls to the GetMaxInstancesPerVm method.
|
||||
GetMaxInstancesPerVm []struct {
|
||||
}
|
||||
// GetName holds details about calls to the GetName method.
|
||||
GetName []struct {
|
||||
}
|
||||
// GetNumDisplayHeads holds details about calls to the GetNumDisplayHeads method.
|
||||
GetNumDisplayHeads []struct {
|
||||
}
|
||||
// GetResolution holds details about calls to the GetResolution method.
|
||||
GetResolution []struct {
|
||||
// N is the n argument value.
|
||||
N int
|
||||
}
|
||||
}
|
||||
lockGetCapabilities sync.RWMutex
|
||||
lockGetClass sync.RWMutex
|
||||
lockGetDeviceID sync.RWMutex
|
||||
lockGetFrameRateLimit sync.RWMutex
|
||||
lockGetFramebufferSize sync.RWMutex
|
||||
lockGetGpuInstanceProfileId sync.RWMutex
|
||||
lockGetLicense sync.RWMutex
|
||||
lockGetMaxInstances sync.RWMutex
|
||||
lockGetMaxInstancesPerVm sync.RWMutex
|
||||
lockGetName sync.RWMutex
|
||||
lockGetNumDisplayHeads sync.RWMutex
|
||||
lockGetResolution sync.RWMutex
|
||||
}
|
||||
|
||||
// GetCapabilities calls GetCapabilitiesFunc.
|
||||
func (mock *VgpuTypeId) GetCapabilities(vgpuCapability nvml.VgpuCapability) (bool, nvml.Return) {
|
||||
if mock.GetCapabilitiesFunc == nil {
|
||||
panic("VgpuTypeId.GetCapabilitiesFunc: method is nil but VgpuTypeId.GetCapabilities was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
VgpuCapability nvml.VgpuCapability
|
||||
}{
|
||||
VgpuCapability: vgpuCapability,
|
||||
}
|
||||
mock.lockGetCapabilities.Lock()
|
||||
mock.calls.GetCapabilities = append(mock.calls.GetCapabilities, callInfo)
|
||||
mock.lockGetCapabilities.Unlock()
|
||||
return mock.GetCapabilitiesFunc(vgpuCapability)
|
||||
}
|
||||
|
||||
// GetCapabilitiesCalls gets all the calls that were made to GetCapabilities.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuTypeId.GetCapabilitiesCalls())
|
||||
func (mock *VgpuTypeId) GetCapabilitiesCalls() []struct {
|
||||
VgpuCapability nvml.VgpuCapability
|
||||
} {
|
||||
var calls []struct {
|
||||
VgpuCapability nvml.VgpuCapability
|
||||
}
|
||||
mock.lockGetCapabilities.RLock()
|
||||
calls = mock.calls.GetCapabilities
|
||||
mock.lockGetCapabilities.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetClass calls GetClassFunc.
|
||||
func (mock *VgpuTypeId) GetClass() (string, nvml.Return) {
|
||||
if mock.GetClassFunc == nil {
|
||||
panic("VgpuTypeId.GetClassFunc: method is nil but VgpuTypeId.GetClass was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetClass.Lock()
|
||||
mock.calls.GetClass = append(mock.calls.GetClass, callInfo)
|
||||
mock.lockGetClass.Unlock()
|
||||
return mock.GetClassFunc()
|
||||
}
|
||||
|
||||
// GetClassCalls gets all the calls that were made to GetClass.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuTypeId.GetClassCalls())
|
||||
func (mock *VgpuTypeId) GetClassCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetClass.RLock()
|
||||
calls = mock.calls.GetClass
|
||||
mock.lockGetClass.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetDeviceID calls GetDeviceIDFunc.
|
||||
func (mock *VgpuTypeId) GetDeviceID() (uint64, uint64, nvml.Return) {
|
||||
if mock.GetDeviceIDFunc == nil {
|
||||
panic("VgpuTypeId.GetDeviceIDFunc: method is nil but VgpuTypeId.GetDeviceID was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetDeviceID.Lock()
|
||||
mock.calls.GetDeviceID = append(mock.calls.GetDeviceID, callInfo)
|
||||
mock.lockGetDeviceID.Unlock()
|
||||
return mock.GetDeviceIDFunc()
|
||||
}
|
||||
|
||||
// GetDeviceIDCalls gets all the calls that were made to GetDeviceID.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuTypeId.GetDeviceIDCalls())
|
||||
func (mock *VgpuTypeId) GetDeviceIDCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetDeviceID.RLock()
|
||||
calls = mock.calls.GetDeviceID
|
||||
mock.lockGetDeviceID.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetFrameRateLimit calls GetFrameRateLimitFunc.
|
||||
func (mock *VgpuTypeId) GetFrameRateLimit() (uint32, nvml.Return) {
|
||||
if mock.GetFrameRateLimitFunc == nil {
|
||||
panic("VgpuTypeId.GetFrameRateLimitFunc: method is nil but VgpuTypeId.GetFrameRateLimit was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetFrameRateLimit.Lock()
|
||||
mock.calls.GetFrameRateLimit = append(mock.calls.GetFrameRateLimit, callInfo)
|
||||
mock.lockGetFrameRateLimit.Unlock()
|
||||
return mock.GetFrameRateLimitFunc()
|
||||
}
|
||||
|
||||
// GetFrameRateLimitCalls gets all the calls that were made to GetFrameRateLimit.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuTypeId.GetFrameRateLimitCalls())
|
||||
func (mock *VgpuTypeId) GetFrameRateLimitCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetFrameRateLimit.RLock()
|
||||
calls = mock.calls.GetFrameRateLimit
|
||||
mock.lockGetFrameRateLimit.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetFramebufferSize calls GetFramebufferSizeFunc.
|
||||
func (mock *VgpuTypeId) GetFramebufferSize() (uint64, nvml.Return) {
|
||||
if mock.GetFramebufferSizeFunc == nil {
|
||||
panic("VgpuTypeId.GetFramebufferSizeFunc: method is nil but VgpuTypeId.GetFramebufferSize was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetFramebufferSize.Lock()
|
||||
mock.calls.GetFramebufferSize = append(mock.calls.GetFramebufferSize, callInfo)
|
||||
mock.lockGetFramebufferSize.Unlock()
|
||||
return mock.GetFramebufferSizeFunc()
|
||||
}
|
||||
|
||||
// GetFramebufferSizeCalls gets all the calls that were made to GetFramebufferSize.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuTypeId.GetFramebufferSizeCalls())
|
||||
func (mock *VgpuTypeId) GetFramebufferSizeCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetFramebufferSize.RLock()
|
||||
calls = mock.calls.GetFramebufferSize
|
||||
mock.lockGetFramebufferSize.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetGpuInstanceProfileId calls GetGpuInstanceProfileIdFunc.
|
||||
func (mock *VgpuTypeId) GetGpuInstanceProfileId() (uint32, nvml.Return) {
|
||||
if mock.GetGpuInstanceProfileIdFunc == nil {
|
||||
panic("VgpuTypeId.GetGpuInstanceProfileIdFunc: method is nil but VgpuTypeId.GetGpuInstanceProfileId was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetGpuInstanceProfileId.Lock()
|
||||
mock.calls.GetGpuInstanceProfileId = append(mock.calls.GetGpuInstanceProfileId, callInfo)
|
||||
mock.lockGetGpuInstanceProfileId.Unlock()
|
||||
return mock.GetGpuInstanceProfileIdFunc()
|
||||
}
|
||||
|
||||
// GetGpuInstanceProfileIdCalls gets all the calls that were made to GetGpuInstanceProfileId.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuTypeId.GetGpuInstanceProfileIdCalls())
|
||||
func (mock *VgpuTypeId) GetGpuInstanceProfileIdCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetGpuInstanceProfileId.RLock()
|
||||
calls = mock.calls.GetGpuInstanceProfileId
|
||||
mock.lockGetGpuInstanceProfileId.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetLicense calls GetLicenseFunc.
|
||||
func (mock *VgpuTypeId) GetLicense() (string, nvml.Return) {
|
||||
if mock.GetLicenseFunc == nil {
|
||||
panic("VgpuTypeId.GetLicenseFunc: method is nil but VgpuTypeId.GetLicense was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetLicense.Lock()
|
||||
mock.calls.GetLicense = append(mock.calls.GetLicense, callInfo)
|
||||
mock.lockGetLicense.Unlock()
|
||||
return mock.GetLicenseFunc()
|
||||
}
|
||||
|
||||
// GetLicenseCalls gets all the calls that were made to GetLicense.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuTypeId.GetLicenseCalls())
|
||||
func (mock *VgpuTypeId) GetLicenseCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetLicense.RLock()
|
||||
calls = mock.calls.GetLicense
|
||||
mock.lockGetLicense.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetMaxInstances calls GetMaxInstancesFunc.
|
||||
func (mock *VgpuTypeId) GetMaxInstances(device nvml.Device) (int, nvml.Return) {
|
||||
if mock.GetMaxInstancesFunc == nil {
|
||||
panic("VgpuTypeId.GetMaxInstancesFunc: method is nil but VgpuTypeId.GetMaxInstances was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
Device nvml.Device
|
||||
}{
|
||||
Device: device,
|
||||
}
|
||||
mock.lockGetMaxInstances.Lock()
|
||||
mock.calls.GetMaxInstances = append(mock.calls.GetMaxInstances, callInfo)
|
||||
mock.lockGetMaxInstances.Unlock()
|
||||
return mock.GetMaxInstancesFunc(device)
|
||||
}
|
||||
|
||||
// GetMaxInstancesCalls gets all the calls that were made to GetMaxInstances.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuTypeId.GetMaxInstancesCalls())
|
||||
func (mock *VgpuTypeId) GetMaxInstancesCalls() []struct {
|
||||
Device nvml.Device
|
||||
} {
|
||||
var calls []struct {
|
||||
Device nvml.Device
|
||||
}
|
||||
mock.lockGetMaxInstances.RLock()
|
||||
calls = mock.calls.GetMaxInstances
|
||||
mock.lockGetMaxInstances.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetMaxInstancesPerVm calls GetMaxInstancesPerVmFunc.
|
||||
func (mock *VgpuTypeId) GetMaxInstancesPerVm() (int, nvml.Return) {
|
||||
if mock.GetMaxInstancesPerVmFunc == nil {
|
||||
panic("VgpuTypeId.GetMaxInstancesPerVmFunc: method is nil but VgpuTypeId.GetMaxInstancesPerVm was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetMaxInstancesPerVm.Lock()
|
||||
mock.calls.GetMaxInstancesPerVm = append(mock.calls.GetMaxInstancesPerVm, callInfo)
|
||||
mock.lockGetMaxInstancesPerVm.Unlock()
|
||||
return mock.GetMaxInstancesPerVmFunc()
|
||||
}
|
||||
|
||||
// GetMaxInstancesPerVmCalls gets all the calls that were made to GetMaxInstancesPerVm.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuTypeId.GetMaxInstancesPerVmCalls())
|
||||
func (mock *VgpuTypeId) GetMaxInstancesPerVmCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetMaxInstancesPerVm.RLock()
|
||||
calls = mock.calls.GetMaxInstancesPerVm
|
||||
mock.lockGetMaxInstancesPerVm.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetName calls GetNameFunc.
|
||||
func (mock *VgpuTypeId) GetName() (string, nvml.Return) {
|
||||
if mock.GetNameFunc == nil {
|
||||
panic("VgpuTypeId.GetNameFunc: method is nil but VgpuTypeId.GetName was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetName.Lock()
|
||||
mock.calls.GetName = append(mock.calls.GetName, callInfo)
|
||||
mock.lockGetName.Unlock()
|
||||
return mock.GetNameFunc()
|
||||
}
|
||||
|
||||
// GetNameCalls gets all the calls that were made to GetName.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuTypeId.GetNameCalls())
|
||||
func (mock *VgpuTypeId) GetNameCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetName.RLock()
|
||||
calls = mock.calls.GetName
|
||||
mock.lockGetName.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetNumDisplayHeads calls GetNumDisplayHeadsFunc.
|
||||
func (mock *VgpuTypeId) GetNumDisplayHeads() (int, nvml.Return) {
|
||||
if mock.GetNumDisplayHeadsFunc == nil {
|
||||
panic("VgpuTypeId.GetNumDisplayHeadsFunc: method is nil but VgpuTypeId.GetNumDisplayHeads was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
}{}
|
||||
mock.lockGetNumDisplayHeads.Lock()
|
||||
mock.calls.GetNumDisplayHeads = append(mock.calls.GetNumDisplayHeads, callInfo)
|
||||
mock.lockGetNumDisplayHeads.Unlock()
|
||||
return mock.GetNumDisplayHeadsFunc()
|
||||
}
|
||||
|
||||
// GetNumDisplayHeadsCalls gets all the calls that were made to GetNumDisplayHeads.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuTypeId.GetNumDisplayHeadsCalls())
|
||||
func (mock *VgpuTypeId) GetNumDisplayHeadsCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
}
|
||||
mock.lockGetNumDisplayHeads.RLock()
|
||||
calls = mock.calls.GetNumDisplayHeads
|
||||
mock.lockGetNumDisplayHeads.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// GetResolution calls GetResolutionFunc.
|
||||
func (mock *VgpuTypeId) GetResolution(n int) (uint32, uint32, nvml.Return) {
|
||||
if mock.GetResolutionFunc == nil {
|
||||
panic("VgpuTypeId.GetResolutionFunc: method is nil but VgpuTypeId.GetResolution was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
N int
|
||||
}{
|
||||
N: n,
|
||||
}
|
||||
mock.lockGetResolution.Lock()
|
||||
mock.calls.GetResolution = append(mock.calls.GetResolution, callInfo)
|
||||
mock.lockGetResolution.Unlock()
|
||||
return mock.GetResolutionFunc(n)
|
||||
}
|
||||
|
||||
// GetResolutionCalls gets all the calls that were made to GetResolution.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedVgpuTypeId.GetResolutionCalls())
|
||||
func (mock *VgpuTypeId) GetResolutionCalls() []struct {
|
||||
N int
|
||||
} {
|
||||
var calls []struct {
|
||||
N int
|
||||
}
|
||||
mock.lockGetResolution.RLock()
|
||||
calls = mock.calls.GetResolution
|
||||
mock.lockGetResolution.RUnlock()
|
||||
return calls
|
||||
}
|
||||
1688
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/nvml.go
generated
vendored
1688
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/nvml.go
generated
vendored
File diff suppressed because it is too large
Load Diff
24
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/return.go
generated
vendored
24
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/return.go
generated
vendored
@@ -19,17 +19,27 @@ import (
|
||||
)
|
||||
|
||||
// nvml.ErrorString()
|
||||
func ErrorString(r Return) string {
|
||||
if err := GetLibrary().Lookup("nvmlErrorString"); err != nil {
|
||||
return fallbackErrorStringFunc(r)
|
||||
}
|
||||
return nvmlErrorString(r)
|
||||
func (l *library) ErrorString(r Return) string {
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// fallbackErrorStringFunc provides a basic nvmlErrorString implementation.
|
||||
// String returns the string representation of a Return.
|
||||
func (r Return) String() string {
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// Error returns the string representation of a Return.
|
||||
func (r Return) Error() string {
|
||||
return errorStringFunc(r)
|
||||
}
|
||||
|
||||
// Assigned to nvml.ErrorString if the system nvml library is in use.
|
||||
var errorStringFunc = defaultErrorStringFunc
|
||||
|
||||
// defaultErrorStringFunc provides a basic nvmlErrorString implementation.
|
||||
// This allows the nvml.ErrorString function to be used even if the NVML library
|
||||
// is not loaded.
|
||||
var fallbackErrorStringFunc = func(r Return) string {
|
||||
var defaultErrorStringFunc = func(r Return) string {
|
||||
switch r {
|
||||
case SUCCESS:
|
||||
return "SUCCESS"
|
||||
|
||||
42
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/system.go
generated
vendored
42
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/system.go
generated
vendored
@@ -15,67 +15,67 @@
|
||||
package nvml
|
||||
|
||||
// nvml.SystemGetDriverVersion()
|
||||
func SystemGetDriverVersion() (string, Return) {
|
||||
func (l *library) SystemGetDriverVersion() (string, Return) {
|
||||
Version := make([]byte, SYSTEM_DRIVER_VERSION_BUFFER_SIZE)
|
||||
ret := nvmlSystemGetDriverVersion(&Version[0], SYSTEM_DRIVER_VERSION_BUFFER_SIZE)
|
||||
return string(Version[:clen(Version)]), ret
|
||||
}
|
||||
|
||||
// nvml.SystemGetNVMLVersion()
|
||||
func SystemGetNVMLVersion() (string, Return) {
|
||||
func (l *library) SystemGetNVMLVersion() (string, Return) {
|
||||
Version := make([]byte, SYSTEM_NVML_VERSION_BUFFER_SIZE)
|
||||
ret := nvmlSystemGetNVMLVersion(&Version[0], SYSTEM_NVML_VERSION_BUFFER_SIZE)
|
||||
return string(Version[:clen(Version)]), ret
|
||||
}
|
||||
|
||||
// nvml.SystemGetCudaDriverVersion()
|
||||
func SystemGetCudaDriverVersion() (int, Return) {
|
||||
func (l *library) SystemGetCudaDriverVersion() (int, Return) {
|
||||
var CudaDriverVersion int32
|
||||
ret := nvmlSystemGetCudaDriverVersion(&CudaDriverVersion)
|
||||
return int(CudaDriverVersion), ret
|
||||
}
|
||||
|
||||
// nvml.SystemGetCudaDriverVersion_v2()
|
||||
func SystemGetCudaDriverVersion_v2() (int, Return) {
|
||||
func (l *library) SystemGetCudaDriverVersion_v2() (int, Return) {
|
||||
var CudaDriverVersion int32
|
||||
ret := nvmlSystemGetCudaDriverVersion_v2(&CudaDriverVersion)
|
||||
return int(CudaDriverVersion), ret
|
||||
}
|
||||
|
||||
// nvml.SystemGetProcessName()
|
||||
func SystemGetProcessName(Pid int) (string, Return) {
|
||||
Name := make([]byte, SYSTEM_PROCESS_NAME_BUFFER_SIZE)
|
||||
ret := nvmlSystemGetProcessName(uint32(Pid), &Name[0], SYSTEM_PROCESS_NAME_BUFFER_SIZE)
|
||||
return string(Name[:clen(Name)]), ret
|
||||
func (l *library) SystemGetProcessName(pid int) (string, Return) {
|
||||
name := make([]byte, SYSTEM_PROCESS_NAME_BUFFER_SIZE)
|
||||
ret := nvmlSystemGetProcessName(uint32(pid), &name[0], SYSTEM_PROCESS_NAME_BUFFER_SIZE)
|
||||
return string(name[:clen(name)]), ret
|
||||
}
|
||||
|
||||
// nvml.SystemGetHicVersion()
|
||||
func SystemGetHicVersion() ([]HwbcEntry, Return) {
|
||||
var HwbcCount uint32 = 1 // Will be reduced upon returning
|
||||
func (l *library) SystemGetHicVersion() ([]HwbcEntry, Return) {
|
||||
var hwbcCount uint32 = 1 // Will be reduced upon returning
|
||||
for {
|
||||
HwbcEntries := make([]HwbcEntry, HwbcCount)
|
||||
ret := nvmlSystemGetHicVersion(&HwbcCount, &HwbcEntries[0])
|
||||
hwbcEntries := make([]HwbcEntry, hwbcCount)
|
||||
ret := nvmlSystemGetHicVersion(&hwbcCount, &hwbcEntries[0])
|
||||
if ret == SUCCESS {
|
||||
return HwbcEntries[:HwbcCount], ret
|
||||
return hwbcEntries[:hwbcCount], ret
|
||||
}
|
||||
if ret != ERROR_INSUFFICIENT_SIZE {
|
||||
return nil, ret
|
||||
}
|
||||
HwbcCount *= 2
|
||||
hwbcCount *= 2
|
||||
}
|
||||
}
|
||||
|
||||
// nvml.SystemGetTopologyGpuSet()
|
||||
func SystemGetTopologyGpuSet(CpuNumber int) ([]Device, Return) {
|
||||
var Count uint32
|
||||
ret := nvmlSystemGetTopologyGpuSet(uint32(CpuNumber), &Count, nil)
|
||||
func (l *library) SystemGetTopologyGpuSet(cpuNumber int) ([]Device, Return) {
|
||||
var count uint32
|
||||
ret := nvmlSystemGetTopologyGpuSet(uint32(cpuNumber), &count, nil)
|
||||
if ret != SUCCESS {
|
||||
return nil, ret
|
||||
}
|
||||
if Count == 0 {
|
||||
if count == 0 {
|
||||
return []Device{}, ret
|
||||
}
|
||||
DeviceArray := make([]Device, Count)
|
||||
ret = nvmlSystemGetTopologyGpuSet(uint32(CpuNumber), &Count, &DeviceArray[0])
|
||||
return DeviceArray, ret
|
||||
deviceArray := make([]nvmlDevice, count)
|
||||
ret = nvmlSystemGetTopologyGpuSet(uint32(cpuNumber), &count, &deviceArray[0])
|
||||
return convertSlice[nvmlDevice, Device](deviceArray), ret
|
||||
}
|
||||
|
||||
36
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/types_gen.go
generated
vendored
36
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/types_gen.go
generated
vendored
@@ -5,7 +5,7 @@ package nvml
|
||||
|
||||
import "unsafe"
|
||||
|
||||
type Device struct {
|
||||
type nvmlDevice struct {
|
||||
Handle *_Ctype_struct_nvmlDevice_st
|
||||
}
|
||||
|
||||
@@ -143,9 +143,9 @@ type ClkMonStatus struct {
|
||||
ClkMonList [32]ClkMonFaultInfo
|
||||
}
|
||||
|
||||
type VgpuTypeId uint32
|
||||
type nvmlVgpuTypeId uint32
|
||||
|
||||
type VgpuInstance uint32
|
||||
type nvmlVgpuInstance uint32
|
||||
|
||||
type VgpuInstanceUtilizationSample struct {
|
||||
VgpuInstance uint32
|
||||
@@ -316,7 +316,7 @@ type FieldValue struct {
|
||||
Value [8]byte
|
||||
}
|
||||
|
||||
type Unit struct {
|
||||
type nvmlUnit struct {
|
||||
Handle *_Ctype_struct_nvmlUnit_st
|
||||
}
|
||||
|
||||
@@ -354,12 +354,12 @@ type UnitFanSpeeds struct {
|
||||
Count uint32
|
||||
}
|
||||
|
||||
type EventSet struct {
|
||||
type nvmlEventSet struct {
|
||||
Handle *_Ctype_struct_nvmlEventSet_st
|
||||
}
|
||||
|
||||
type EventData struct {
|
||||
Device Device
|
||||
type nvmlEventData struct {
|
||||
Device nvmlDevice
|
||||
EventType uint64
|
||||
EventData uint64
|
||||
GpuInstanceId uint32
|
||||
@@ -494,14 +494,14 @@ type GpuInstanceProfileInfo_v2 struct {
|
||||
Name [96]int8
|
||||
}
|
||||
|
||||
type GpuInstanceInfo struct {
|
||||
Device Device
|
||||
type nvmlGpuInstanceInfo struct {
|
||||
Device nvmlDevice
|
||||
Id uint32
|
||||
ProfileId uint32
|
||||
Placement GpuInstancePlacement
|
||||
}
|
||||
|
||||
type GpuInstance struct {
|
||||
type nvmlGpuInstance struct {
|
||||
Handle *_Ctype_struct_nvmlGpuInstance_st
|
||||
}
|
||||
|
||||
@@ -536,19 +536,19 @@ type ComputeInstanceProfileInfo_v2 struct {
|
||||
Name [96]int8
|
||||
}
|
||||
|
||||
type ComputeInstanceInfo struct {
|
||||
Device Device
|
||||
GpuInstance GpuInstance
|
||||
type nvmlComputeInstanceInfo struct {
|
||||
Device nvmlDevice
|
||||
GpuInstance nvmlGpuInstance
|
||||
Id uint32
|
||||
ProfileId uint32
|
||||
Placement ComputeInstancePlacement
|
||||
}
|
||||
|
||||
type ComputeInstance struct {
|
||||
type nvmlComputeInstance struct {
|
||||
Handle *_Ctype_struct_nvmlComputeInstance_st
|
||||
}
|
||||
|
||||
type GpmSample struct {
|
||||
type nvmlGpmSample struct {
|
||||
Handle *_Ctype_struct_nvmlGpmSample_st
|
||||
}
|
||||
|
||||
@@ -565,11 +565,11 @@ type GpmMetric struct {
|
||||
MetricInfo GpmMetricMetricInfo
|
||||
}
|
||||
|
||||
type GpmMetricsGetType struct {
|
||||
type nvmlGpmMetricsGetType struct {
|
||||
Version uint32
|
||||
NumMetrics uint32
|
||||
Sample1 GpmSample
|
||||
Sample2 GpmSample
|
||||
Sample1 nvmlGpmSample
|
||||
Sample2 nvmlGpmSample
|
||||
Metrics [98]GpmMetric
|
||||
}
|
||||
|
||||
|
||||
98
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/unit.go
generated
vendored
98
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/unit.go
generated
vendored
@@ -15,99 +15,99 @@
|
||||
package nvml
|
||||
|
||||
// nvml.UnitGetCount()
|
||||
func UnitGetCount() (int, Return) {
|
||||
func (l *library) UnitGetCount() (int, Return) {
|
||||
var UnitCount uint32
|
||||
ret := nvmlUnitGetCount(&UnitCount)
|
||||
return int(UnitCount), ret
|
||||
}
|
||||
|
||||
// nvml.UnitGetHandleByIndex()
|
||||
func UnitGetHandleByIndex(Index int) (Unit, Return) {
|
||||
var Unit Unit
|
||||
ret := nvmlUnitGetHandleByIndex(uint32(Index), &Unit)
|
||||
return Unit, ret
|
||||
func (l *library) UnitGetHandleByIndex(index int) (Unit, Return) {
|
||||
var unit nvmlUnit
|
||||
ret := nvmlUnitGetHandleByIndex(uint32(index), &unit)
|
||||
return unit, ret
|
||||
}
|
||||
|
||||
// nvml.UnitGetUnitInfo()
|
||||
func UnitGetUnitInfo(Unit Unit) (UnitInfo, Return) {
|
||||
var Info UnitInfo
|
||||
ret := nvmlUnitGetUnitInfo(Unit, &Info)
|
||||
return Info, ret
|
||||
func (l *library) UnitGetUnitInfo(unit Unit) (UnitInfo, Return) {
|
||||
return unit.GetUnitInfo()
|
||||
}
|
||||
|
||||
func (Unit Unit) GetUnitInfo() (UnitInfo, Return) {
|
||||
return UnitGetUnitInfo(Unit)
|
||||
func (unit nvmlUnit) GetUnitInfo() (UnitInfo, Return) {
|
||||
var info UnitInfo
|
||||
ret := nvmlUnitGetUnitInfo(unit, &info)
|
||||
return info, ret
|
||||
}
|
||||
|
||||
// nvml.UnitGetLedState()
|
||||
func UnitGetLedState(Unit Unit) (LedState, Return) {
|
||||
var State LedState
|
||||
ret := nvmlUnitGetLedState(Unit, &State)
|
||||
return State, ret
|
||||
func (l *library) UnitGetLedState(unit Unit) (LedState, Return) {
|
||||
return unit.GetLedState()
|
||||
}
|
||||
|
||||
func (Unit Unit) GetLedState() (LedState, Return) {
|
||||
return UnitGetLedState(Unit)
|
||||
func (unit nvmlUnit) GetLedState() (LedState, Return) {
|
||||
var state LedState
|
||||
ret := nvmlUnitGetLedState(unit, &state)
|
||||
return state, ret
|
||||
}
|
||||
|
||||
// nvml.UnitGetPsuInfo()
|
||||
func UnitGetPsuInfo(Unit Unit) (PSUInfo, Return) {
|
||||
var Psu PSUInfo
|
||||
ret := nvmlUnitGetPsuInfo(Unit, &Psu)
|
||||
return Psu, ret
|
||||
func (l *library) UnitGetPsuInfo(unit Unit) (PSUInfo, Return) {
|
||||
return unit.GetPsuInfo()
|
||||
}
|
||||
|
||||
func (Unit Unit) GetPsuInfo() (PSUInfo, Return) {
|
||||
return UnitGetPsuInfo(Unit)
|
||||
func (unit nvmlUnit) GetPsuInfo() (PSUInfo, Return) {
|
||||
var psu PSUInfo
|
||||
ret := nvmlUnitGetPsuInfo(unit, &psu)
|
||||
return psu, ret
|
||||
}
|
||||
|
||||
// nvml.UnitGetTemperature()
|
||||
func UnitGetTemperature(Unit Unit, Type int) (uint32, Return) {
|
||||
var Temp uint32
|
||||
ret := nvmlUnitGetTemperature(Unit, uint32(Type), &Temp)
|
||||
return Temp, ret
|
||||
func (l *library) UnitGetTemperature(unit Unit, ttype int) (uint32, Return) {
|
||||
return unit.GetTemperature(ttype)
|
||||
}
|
||||
|
||||
func (Unit Unit) GetTemperature(Type int) (uint32, Return) {
|
||||
return UnitGetTemperature(Unit, Type)
|
||||
func (unit nvmlUnit) GetTemperature(ttype int) (uint32, Return) {
|
||||
var temp uint32
|
||||
ret := nvmlUnitGetTemperature(unit, uint32(ttype), &temp)
|
||||
return temp, ret
|
||||
}
|
||||
|
||||
// nvml.UnitGetFanSpeedInfo()
|
||||
func UnitGetFanSpeedInfo(Unit Unit) (UnitFanSpeeds, Return) {
|
||||
var FanSpeeds UnitFanSpeeds
|
||||
ret := nvmlUnitGetFanSpeedInfo(Unit, &FanSpeeds)
|
||||
return FanSpeeds, ret
|
||||
func (l *library) UnitGetFanSpeedInfo(unit Unit) (UnitFanSpeeds, Return) {
|
||||
return unit.GetFanSpeedInfo()
|
||||
}
|
||||
|
||||
func (Unit Unit) GetFanSpeedInfo() (UnitFanSpeeds, Return) {
|
||||
return UnitGetFanSpeedInfo(Unit)
|
||||
func (unit nvmlUnit) GetFanSpeedInfo() (UnitFanSpeeds, Return) {
|
||||
var fanSpeeds UnitFanSpeeds
|
||||
ret := nvmlUnitGetFanSpeedInfo(unit, &fanSpeeds)
|
||||
return fanSpeeds, ret
|
||||
}
|
||||
|
||||
// nvml.UnitGetDevices()
|
||||
func UnitGetDevices(Unit Unit) ([]Device, Return) {
|
||||
var DeviceCount uint32 = 1 // Will be reduced upon returning
|
||||
func (l *library) UnitGetDevices(unit Unit) ([]Device, Return) {
|
||||
return unit.GetDevices()
|
||||
}
|
||||
|
||||
func (unit nvmlUnit) GetDevices() ([]Device, Return) {
|
||||
var deviceCount uint32 = 1 // Will be reduced upon returning
|
||||
for {
|
||||
Devices := make([]Device, DeviceCount)
|
||||
ret := nvmlUnitGetDevices(Unit, &DeviceCount, &Devices[0])
|
||||
devices := make([]nvmlDevice, deviceCount)
|
||||
ret := nvmlUnitGetDevices(unit, &deviceCount, &devices[0])
|
||||
if ret == SUCCESS {
|
||||
return Devices[:DeviceCount], ret
|
||||
return convertSlice[nvmlDevice, Device](devices[:deviceCount]), ret
|
||||
}
|
||||
if ret != ERROR_INSUFFICIENT_SIZE {
|
||||
return nil, ret
|
||||
}
|
||||
DeviceCount *= 2
|
||||
deviceCount *= 2
|
||||
}
|
||||
}
|
||||
|
||||
func (Unit Unit) GetDevices() ([]Device, Return) {
|
||||
return UnitGetDevices(Unit)
|
||||
}
|
||||
|
||||
// nvml.UnitSetLedState()
|
||||
func UnitSetLedState(Unit Unit, Color LedColor) Return {
|
||||
return nvmlUnitSetLedState(Unit, Color)
|
||||
func (l *library) UnitSetLedState(unit Unit, color LedColor) Return {
|
||||
return unit.SetLedState(color)
|
||||
}
|
||||
|
||||
func (Unit Unit) SetLedState(Color LedColor) Return {
|
||||
return UnitSetLedState(Unit, Color)
|
||||
func (unit nvmlUnit) SetLedState(color LedColor) Return {
|
||||
return nvmlUnitSetLedState(unit, color)
|
||||
}
|
||||
|
||||
490
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/vgpu.go
generated
vendored
490
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/vgpu.go
generated
vendored
@@ -31,450 +31,450 @@ type VgpuPgpuMetadata struct {
|
||||
}
|
||||
|
||||
// nvml.VgpuTypeGetClass()
|
||||
func VgpuTypeGetClass(VgpuTypeId VgpuTypeId) (string, Return) {
|
||||
var Size uint32 = DEVICE_NAME_BUFFER_SIZE
|
||||
VgpuTypeClass := make([]byte, DEVICE_NAME_BUFFER_SIZE)
|
||||
ret := nvmlVgpuTypeGetClass(VgpuTypeId, &VgpuTypeClass[0], &Size)
|
||||
return string(VgpuTypeClass[:clen(VgpuTypeClass)]), ret
|
||||
func (l *library) VgpuTypeGetClass(vgpuTypeId VgpuTypeId) (string, Return) {
|
||||
return vgpuTypeId.GetClass()
|
||||
}
|
||||
|
||||
func (VgpuTypeId VgpuTypeId) GetClass() (string, Return) {
|
||||
return VgpuTypeGetClass(VgpuTypeId)
|
||||
func (vgpuTypeId nvmlVgpuTypeId) GetClass() (string, Return) {
|
||||
var size uint32 = DEVICE_NAME_BUFFER_SIZE
|
||||
vgpuTypeClass := make([]byte, DEVICE_NAME_BUFFER_SIZE)
|
||||
ret := nvmlVgpuTypeGetClass(vgpuTypeId, &vgpuTypeClass[0], &size)
|
||||
return string(vgpuTypeClass[:clen(vgpuTypeClass)]), ret
|
||||
}
|
||||
|
||||
// nvml.VgpuTypeGetName()
|
||||
func VgpuTypeGetName(VgpuTypeId VgpuTypeId) (string, Return) {
|
||||
var Size uint32 = DEVICE_NAME_BUFFER_SIZE
|
||||
VgpuTypeName := make([]byte, DEVICE_NAME_BUFFER_SIZE)
|
||||
ret := nvmlVgpuTypeGetName(VgpuTypeId, &VgpuTypeName[0], &Size)
|
||||
return string(VgpuTypeName[:clen(VgpuTypeName)]), ret
|
||||
func (l *library) VgpuTypeGetName(vgpuTypeId VgpuTypeId) (string, Return) {
|
||||
return vgpuTypeId.GetName()
|
||||
}
|
||||
|
||||
func (VgpuTypeId VgpuTypeId) GetName() (string, Return) {
|
||||
return VgpuTypeGetName(VgpuTypeId)
|
||||
func (vgpuTypeId nvmlVgpuTypeId) GetName() (string, Return) {
|
||||
var size uint32 = DEVICE_NAME_BUFFER_SIZE
|
||||
vgpuTypeName := make([]byte, DEVICE_NAME_BUFFER_SIZE)
|
||||
ret := nvmlVgpuTypeGetName(vgpuTypeId, &vgpuTypeName[0], &size)
|
||||
return string(vgpuTypeName[:clen(vgpuTypeName)]), ret
|
||||
}
|
||||
|
||||
// nvml.VgpuTypeGetGpuInstanceProfileId()
|
||||
func VgpuTypeGetGpuInstanceProfileId(VgpuTypeId VgpuTypeId) (uint32, Return) {
|
||||
var Size uint32
|
||||
ret := nvmlVgpuTypeGetGpuInstanceProfileId(VgpuTypeId, &Size)
|
||||
return Size, ret
|
||||
func (l *library) VgpuTypeGetGpuInstanceProfileId(vgpuTypeId VgpuTypeId) (uint32, Return) {
|
||||
return vgpuTypeId.GetGpuInstanceProfileId()
|
||||
}
|
||||
|
||||
func (VgpuTypeId VgpuTypeId) GetGpuInstanceProfileId() (uint32, Return) {
|
||||
return VgpuTypeGetGpuInstanceProfileId(VgpuTypeId)
|
||||
func (vgpuTypeId nvmlVgpuTypeId) GetGpuInstanceProfileId() (uint32, Return) {
|
||||
var size uint32
|
||||
ret := nvmlVgpuTypeGetGpuInstanceProfileId(vgpuTypeId, &size)
|
||||
return size, ret
|
||||
}
|
||||
|
||||
// nvml.VgpuTypeGetDeviceID()
|
||||
func VgpuTypeGetDeviceID(VgpuTypeId VgpuTypeId) (uint64, uint64, Return) {
|
||||
var DeviceID, SubsystemID uint64
|
||||
ret := nvmlVgpuTypeGetDeviceID(VgpuTypeId, &DeviceID, &SubsystemID)
|
||||
return DeviceID, SubsystemID, ret
|
||||
func (l *library) VgpuTypeGetDeviceID(vgpuTypeId VgpuTypeId) (uint64, uint64, Return) {
|
||||
return vgpuTypeId.GetDeviceID()
|
||||
}
|
||||
|
||||
func (VgpuTypeId VgpuTypeId) GetDeviceID() (uint64, uint64, Return) {
|
||||
return VgpuTypeGetDeviceID(VgpuTypeId)
|
||||
func (vgpuTypeId nvmlVgpuTypeId) GetDeviceID() (uint64, uint64, Return) {
|
||||
var deviceID, subsystemID uint64
|
||||
ret := nvmlVgpuTypeGetDeviceID(vgpuTypeId, &deviceID, &subsystemID)
|
||||
return deviceID, subsystemID, ret
|
||||
}
|
||||
|
||||
// nvml.VgpuTypeGetFramebufferSize()
|
||||
func VgpuTypeGetFramebufferSize(VgpuTypeId VgpuTypeId) (uint64, Return) {
|
||||
var FbSize uint64
|
||||
ret := nvmlVgpuTypeGetFramebufferSize(VgpuTypeId, &FbSize)
|
||||
return FbSize, ret
|
||||
func (l *library) VgpuTypeGetFramebufferSize(vgpuTypeId VgpuTypeId) (uint64, Return) {
|
||||
return vgpuTypeId.GetFramebufferSize()
|
||||
}
|
||||
|
||||
func (VgpuTypeId VgpuTypeId) GetFramebufferSize() (uint64, Return) {
|
||||
return VgpuTypeGetFramebufferSize(VgpuTypeId)
|
||||
func (vgpuTypeId nvmlVgpuTypeId) GetFramebufferSize() (uint64, Return) {
|
||||
var fbSize uint64
|
||||
ret := nvmlVgpuTypeGetFramebufferSize(vgpuTypeId, &fbSize)
|
||||
return fbSize, ret
|
||||
}
|
||||
|
||||
// nvml.VgpuTypeGetNumDisplayHeads()
|
||||
func VgpuTypeGetNumDisplayHeads(VgpuTypeId VgpuTypeId) (int, Return) {
|
||||
var NumDisplayHeads uint32
|
||||
ret := nvmlVgpuTypeGetNumDisplayHeads(VgpuTypeId, &NumDisplayHeads)
|
||||
return int(NumDisplayHeads), ret
|
||||
func (l *library) VgpuTypeGetNumDisplayHeads(vgpuTypeId VgpuTypeId) (int, Return) {
|
||||
return vgpuTypeId.GetNumDisplayHeads()
|
||||
}
|
||||
|
||||
func (VgpuTypeId VgpuTypeId) GetNumDisplayHeads() (int, Return) {
|
||||
return VgpuTypeGetNumDisplayHeads(VgpuTypeId)
|
||||
func (vgpuTypeId nvmlVgpuTypeId) GetNumDisplayHeads() (int, Return) {
|
||||
var numDisplayHeads uint32
|
||||
ret := nvmlVgpuTypeGetNumDisplayHeads(vgpuTypeId, &numDisplayHeads)
|
||||
return int(numDisplayHeads), ret
|
||||
}
|
||||
|
||||
// nvml.VgpuTypeGetResolution()
|
||||
func VgpuTypeGetResolution(VgpuTypeId VgpuTypeId, DisplayIndex int) (uint32, uint32, Return) {
|
||||
var Xdim, Ydim uint32
|
||||
ret := nvmlVgpuTypeGetResolution(VgpuTypeId, uint32(DisplayIndex), &Xdim, &Ydim)
|
||||
return Xdim, Ydim, ret
|
||||
func (l *library) VgpuTypeGetResolution(vgpuTypeId VgpuTypeId, displayIndex int) (uint32, uint32, Return) {
|
||||
return vgpuTypeId.GetResolution(displayIndex)
|
||||
}
|
||||
|
||||
func (VgpuTypeId VgpuTypeId) GetResolution(DisplayIndex int) (uint32, uint32, Return) {
|
||||
return VgpuTypeGetResolution(VgpuTypeId, DisplayIndex)
|
||||
func (vgpuTypeId nvmlVgpuTypeId) GetResolution(displayIndex int) (uint32, uint32, Return) {
|
||||
var xdim, ydim uint32
|
||||
ret := nvmlVgpuTypeGetResolution(vgpuTypeId, uint32(displayIndex), &xdim, &ydim)
|
||||
return xdim, ydim, ret
|
||||
}
|
||||
|
||||
// nvml.VgpuTypeGetLicense()
|
||||
func VgpuTypeGetLicense(VgpuTypeId VgpuTypeId) (string, Return) {
|
||||
VgpuTypeLicenseString := make([]byte, GRID_LICENSE_BUFFER_SIZE)
|
||||
ret := nvmlVgpuTypeGetLicense(VgpuTypeId, &VgpuTypeLicenseString[0], GRID_LICENSE_BUFFER_SIZE)
|
||||
return string(VgpuTypeLicenseString[:clen(VgpuTypeLicenseString)]), ret
|
||||
func (l *library) VgpuTypeGetLicense(vgpuTypeId VgpuTypeId) (string, Return) {
|
||||
return vgpuTypeId.GetLicense()
|
||||
}
|
||||
|
||||
func (VgpuTypeId VgpuTypeId) GetLicense() (string, Return) {
|
||||
return VgpuTypeGetLicense(VgpuTypeId)
|
||||
func (vgpuTypeId nvmlVgpuTypeId) GetLicense() (string, Return) {
|
||||
vgpuTypeLicenseString := make([]byte, GRID_LICENSE_BUFFER_SIZE)
|
||||
ret := nvmlVgpuTypeGetLicense(vgpuTypeId, &vgpuTypeLicenseString[0], GRID_LICENSE_BUFFER_SIZE)
|
||||
return string(vgpuTypeLicenseString[:clen(vgpuTypeLicenseString)]), ret
|
||||
}
|
||||
|
||||
// nvml.VgpuTypeGetFrameRateLimit()
|
||||
func VgpuTypeGetFrameRateLimit(VgpuTypeId VgpuTypeId) (uint32, Return) {
|
||||
var FrameRateLimit uint32
|
||||
ret := nvmlVgpuTypeGetFrameRateLimit(VgpuTypeId, &FrameRateLimit)
|
||||
return FrameRateLimit, ret
|
||||
func (l *library) VgpuTypeGetFrameRateLimit(vgpuTypeId VgpuTypeId) (uint32, Return) {
|
||||
return vgpuTypeId.GetFrameRateLimit()
|
||||
}
|
||||
|
||||
func (VgpuTypeId VgpuTypeId) GetFrameRateLimit() (uint32, Return) {
|
||||
return VgpuTypeGetFrameRateLimit(VgpuTypeId)
|
||||
func (vgpuTypeId nvmlVgpuTypeId) GetFrameRateLimit() (uint32, Return) {
|
||||
var frameRateLimit uint32
|
||||
ret := nvmlVgpuTypeGetFrameRateLimit(vgpuTypeId, &frameRateLimit)
|
||||
return frameRateLimit, ret
|
||||
}
|
||||
|
||||
// nvml.VgpuTypeGetMaxInstances()
|
||||
func VgpuTypeGetMaxInstances(Device Device, VgpuTypeId VgpuTypeId) (int, Return) {
|
||||
var VgpuInstanceCount uint32
|
||||
ret := nvmlVgpuTypeGetMaxInstances(Device, VgpuTypeId, &VgpuInstanceCount)
|
||||
return int(VgpuInstanceCount), ret
|
||||
func (l *library) VgpuTypeGetMaxInstances(device Device, vgpuTypeId VgpuTypeId) (int, Return) {
|
||||
return vgpuTypeId.GetMaxInstances(device)
|
||||
}
|
||||
|
||||
func (Device Device) VgpuTypeGetMaxInstances(VgpuTypeId VgpuTypeId) (int, Return) {
|
||||
return VgpuTypeGetMaxInstances(Device, VgpuTypeId)
|
||||
func (device nvmlDevice) VgpuTypeGetMaxInstances(vgpuTypeId VgpuTypeId) (int, Return) {
|
||||
return vgpuTypeId.GetMaxInstances(device)
|
||||
}
|
||||
|
||||
func (VgpuTypeId VgpuTypeId) GetMaxInstances(Device Device) (int, Return) {
|
||||
return VgpuTypeGetMaxInstances(Device, VgpuTypeId)
|
||||
func (vgpuTypeId nvmlVgpuTypeId) GetMaxInstances(device Device) (int, Return) {
|
||||
var vgpuInstanceCount uint32
|
||||
ret := nvmlVgpuTypeGetMaxInstances(device.(nvmlDevice), vgpuTypeId, &vgpuInstanceCount)
|
||||
return int(vgpuInstanceCount), ret
|
||||
}
|
||||
|
||||
// nvml.VgpuTypeGetMaxInstancesPerVm()
|
||||
func VgpuTypeGetMaxInstancesPerVm(VgpuTypeId VgpuTypeId) (int, Return) {
|
||||
var VgpuInstanceCountPerVm uint32
|
||||
ret := nvmlVgpuTypeGetMaxInstancesPerVm(VgpuTypeId, &VgpuInstanceCountPerVm)
|
||||
return int(VgpuInstanceCountPerVm), ret
|
||||
func (l *library) VgpuTypeGetMaxInstancesPerVm(vgpuTypeId VgpuTypeId) (int, Return) {
|
||||
return vgpuTypeId.GetMaxInstancesPerVm()
|
||||
}
|
||||
|
||||
func (VgpuTypeId VgpuTypeId) GetMaxInstancesPerVm() (int, Return) {
|
||||
return VgpuTypeGetMaxInstancesPerVm(VgpuTypeId)
|
||||
func (vgpuTypeId nvmlVgpuTypeId) GetMaxInstancesPerVm() (int, Return) {
|
||||
var vgpuInstanceCountPerVm uint32
|
||||
ret := nvmlVgpuTypeGetMaxInstancesPerVm(vgpuTypeId, &vgpuInstanceCountPerVm)
|
||||
return int(vgpuInstanceCountPerVm), ret
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetVmID()
|
||||
func VgpuInstanceGetVmID(VgpuInstance VgpuInstance) (string, VgpuVmIdType, Return) {
|
||||
var VmIdType VgpuVmIdType
|
||||
VmId := make([]byte, DEVICE_UUID_BUFFER_SIZE)
|
||||
ret := nvmlVgpuInstanceGetVmID(VgpuInstance, &VmId[0], DEVICE_UUID_BUFFER_SIZE, &VmIdType)
|
||||
return string(VmId[:clen(VmId)]), VmIdType, ret
|
||||
func (l *library) VgpuInstanceGetVmID(vgpuInstance VgpuInstance) (string, VgpuVmIdType, Return) {
|
||||
return vgpuInstance.GetVmID()
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetVmID() (string, VgpuVmIdType, Return) {
|
||||
return VgpuInstanceGetVmID(VgpuInstance)
|
||||
func (vgpuInstance nvmlVgpuInstance) GetVmID() (string, VgpuVmIdType, Return) {
|
||||
var vmIdType VgpuVmIdType
|
||||
vmId := make([]byte, DEVICE_UUID_BUFFER_SIZE)
|
||||
ret := nvmlVgpuInstanceGetVmID(vgpuInstance, &vmId[0], DEVICE_UUID_BUFFER_SIZE, &vmIdType)
|
||||
return string(vmId[:clen(vmId)]), vmIdType, ret
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetUUID()
|
||||
func VgpuInstanceGetUUID(VgpuInstance VgpuInstance) (string, Return) {
|
||||
Uuid := make([]byte, DEVICE_UUID_BUFFER_SIZE)
|
||||
ret := nvmlVgpuInstanceGetUUID(VgpuInstance, &Uuid[0], DEVICE_UUID_BUFFER_SIZE)
|
||||
return string(Uuid[:clen(Uuid)]), ret
|
||||
func (l *library) VgpuInstanceGetUUID(vgpuInstance VgpuInstance) (string, Return) {
|
||||
return vgpuInstance.GetUUID()
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetUUID() (string, Return) {
|
||||
return VgpuInstanceGetUUID(VgpuInstance)
|
||||
func (vgpuInstance nvmlVgpuInstance) GetUUID() (string, Return) {
|
||||
uuid := make([]byte, DEVICE_UUID_BUFFER_SIZE)
|
||||
ret := nvmlVgpuInstanceGetUUID(vgpuInstance, &uuid[0], DEVICE_UUID_BUFFER_SIZE)
|
||||
return string(uuid[:clen(uuid)]), ret
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetVmDriverVersion()
|
||||
func VgpuInstanceGetVmDriverVersion(VgpuInstance VgpuInstance) (string, Return) {
|
||||
Version := make([]byte, SYSTEM_DRIVER_VERSION_BUFFER_SIZE)
|
||||
ret := nvmlVgpuInstanceGetVmDriverVersion(VgpuInstance, &Version[0], SYSTEM_DRIVER_VERSION_BUFFER_SIZE)
|
||||
return string(Version[:clen(Version)]), ret
|
||||
func (l *library) VgpuInstanceGetVmDriverVersion(vgpuInstance VgpuInstance) (string, Return) {
|
||||
return vgpuInstance.GetVmDriverVersion()
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetVmDriverVersion() (string, Return) {
|
||||
return VgpuInstanceGetVmDriverVersion(VgpuInstance)
|
||||
func (vgpuInstance nvmlVgpuInstance) GetVmDriverVersion() (string, Return) {
|
||||
version := make([]byte, SYSTEM_DRIVER_VERSION_BUFFER_SIZE)
|
||||
ret := nvmlVgpuInstanceGetVmDriverVersion(vgpuInstance, &version[0], SYSTEM_DRIVER_VERSION_BUFFER_SIZE)
|
||||
return string(version[:clen(version)]), ret
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetFbUsage()
|
||||
func VgpuInstanceGetFbUsage(VgpuInstance VgpuInstance) (uint64, Return) {
|
||||
var FbUsage uint64
|
||||
ret := nvmlVgpuInstanceGetFbUsage(VgpuInstance, &FbUsage)
|
||||
return FbUsage, ret
|
||||
func (l *library) VgpuInstanceGetFbUsage(vgpuInstance VgpuInstance) (uint64, Return) {
|
||||
return vgpuInstance.GetFbUsage()
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetFbUsage() (uint64, Return) {
|
||||
return VgpuInstanceGetFbUsage(VgpuInstance)
|
||||
func (vgpuInstance nvmlVgpuInstance) GetFbUsage() (uint64, Return) {
|
||||
var fbUsage uint64
|
||||
ret := nvmlVgpuInstanceGetFbUsage(vgpuInstance, &fbUsage)
|
||||
return fbUsage, ret
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetLicenseInfo()
|
||||
func VgpuInstanceGetLicenseInfo(VgpuInstance VgpuInstance) (VgpuLicenseInfo, Return) {
|
||||
var LicenseInfo VgpuLicenseInfo
|
||||
ret := nvmlVgpuInstanceGetLicenseInfo(VgpuInstance, &LicenseInfo)
|
||||
return LicenseInfo, ret
|
||||
func (l *library) VgpuInstanceGetLicenseInfo(vgpuInstance VgpuInstance) (VgpuLicenseInfo, Return) {
|
||||
return vgpuInstance.GetLicenseInfo()
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetLicenseInfo() (VgpuLicenseInfo, Return) {
|
||||
return VgpuInstanceGetLicenseInfo(VgpuInstance)
|
||||
func (vgpuInstance nvmlVgpuInstance) GetLicenseInfo() (VgpuLicenseInfo, Return) {
|
||||
var licenseInfo VgpuLicenseInfo
|
||||
ret := nvmlVgpuInstanceGetLicenseInfo(vgpuInstance, &licenseInfo)
|
||||
return licenseInfo, ret
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetLicenseStatus()
|
||||
func VgpuInstanceGetLicenseStatus(VgpuInstance VgpuInstance) (int, Return) {
|
||||
var Licensed uint32
|
||||
ret := nvmlVgpuInstanceGetLicenseStatus(VgpuInstance, &Licensed)
|
||||
return int(Licensed), ret
|
||||
func (l *library) VgpuInstanceGetLicenseStatus(vgpuInstance VgpuInstance) (int, Return) {
|
||||
return vgpuInstance.GetLicenseStatus()
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetLicenseStatus() (int, Return) {
|
||||
return VgpuInstanceGetLicenseStatus(VgpuInstance)
|
||||
func (vgpuInstance nvmlVgpuInstance) GetLicenseStatus() (int, Return) {
|
||||
var licensed uint32
|
||||
ret := nvmlVgpuInstanceGetLicenseStatus(vgpuInstance, &licensed)
|
||||
return int(licensed), ret
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetType()
|
||||
func VgpuInstanceGetType(VgpuInstance VgpuInstance) (VgpuTypeId, Return) {
|
||||
var VgpuTypeId VgpuTypeId
|
||||
ret := nvmlVgpuInstanceGetType(VgpuInstance, &VgpuTypeId)
|
||||
return VgpuTypeId, ret
|
||||
func (l *library) VgpuInstanceGetType(vgpuInstance VgpuInstance) (VgpuTypeId, Return) {
|
||||
return vgpuInstance.GetType()
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetType() (VgpuTypeId, Return) {
|
||||
return VgpuInstanceGetType(VgpuInstance)
|
||||
func (vgpuInstance nvmlVgpuInstance) GetType() (VgpuTypeId, Return) {
|
||||
var vgpuTypeId nvmlVgpuTypeId
|
||||
ret := nvmlVgpuInstanceGetType(vgpuInstance, &vgpuTypeId)
|
||||
return vgpuTypeId, ret
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetFrameRateLimit()
|
||||
func VgpuInstanceGetFrameRateLimit(VgpuInstance VgpuInstance) (uint32, Return) {
|
||||
var FrameRateLimit uint32
|
||||
ret := nvmlVgpuInstanceGetFrameRateLimit(VgpuInstance, &FrameRateLimit)
|
||||
return FrameRateLimit, ret
|
||||
func (l *library) VgpuInstanceGetFrameRateLimit(vgpuInstance VgpuInstance) (uint32, Return) {
|
||||
return vgpuInstance.GetFrameRateLimit()
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetFrameRateLimit() (uint32, Return) {
|
||||
return VgpuInstanceGetFrameRateLimit(VgpuInstance)
|
||||
func (vgpuInstance nvmlVgpuInstance) GetFrameRateLimit() (uint32, Return) {
|
||||
var frameRateLimit uint32
|
||||
ret := nvmlVgpuInstanceGetFrameRateLimit(vgpuInstance, &frameRateLimit)
|
||||
return frameRateLimit, ret
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetEccMode()
|
||||
func VgpuInstanceGetEccMode(VgpuInstance VgpuInstance) (EnableState, Return) {
|
||||
var EccMode EnableState
|
||||
ret := nvmlVgpuInstanceGetEccMode(VgpuInstance, &EccMode)
|
||||
return EccMode, ret
|
||||
func (l *library) VgpuInstanceGetEccMode(vgpuInstance VgpuInstance) (EnableState, Return) {
|
||||
return vgpuInstance.GetEccMode()
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetEccMode() (EnableState, Return) {
|
||||
return VgpuInstanceGetEccMode(VgpuInstance)
|
||||
func (vgpuInstance nvmlVgpuInstance) GetEccMode() (EnableState, Return) {
|
||||
var eccMode EnableState
|
||||
ret := nvmlVgpuInstanceGetEccMode(vgpuInstance, &eccMode)
|
||||
return eccMode, ret
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetEncoderCapacity()
|
||||
func VgpuInstanceGetEncoderCapacity(VgpuInstance VgpuInstance) (int, Return) {
|
||||
var EncoderCapacity uint32
|
||||
ret := nvmlVgpuInstanceGetEncoderCapacity(VgpuInstance, &EncoderCapacity)
|
||||
return int(EncoderCapacity), ret
|
||||
func (l *library) VgpuInstanceGetEncoderCapacity(vgpuInstance VgpuInstance) (int, Return) {
|
||||
return vgpuInstance.GetEncoderCapacity()
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetEncoderCapacity() (int, Return) {
|
||||
return VgpuInstanceGetEncoderCapacity(VgpuInstance)
|
||||
func (vgpuInstance nvmlVgpuInstance) GetEncoderCapacity() (int, Return) {
|
||||
var encoderCapacity uint32
|
||||
ret := nvmlVgpuInstanceGetEncoderCapacity(vgpuInstance, &encoderCapacity)
|
||||
return int(encoderCapacity), ret
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceSetEncoderCapacity()
|
||||
func VgpuInstanceSetEncoderCapacity(VgpuInstance VgpuInstance, EncoderCapacity int) Return {
|
||||
return nvmlVgpuInstanceSetEncoderCapacity(VgpuInstance, uint32(EncoderCapacity))
|
||||
func (l *library) VgpuInstanceSetEncoderCapacity(vgpuInstance VgpuInstance, encoderCapacity int) Return {
|
||||
return vgpuInstance.SetEncoderCapacity(encoderCapacity)
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) SetEncoderCapacity(EncoderCapacity int) Return {
|
||||
return VgpuInstanceSetEncoderCapacity(VgpuInstance, EncoderCapacity)
|
||||
func (vgpuInstance nvmlVgpuInstance) SetEncoderCapacity(encoderCapacity int) Return {
|
||||
return nvmlVgpuInstanceSetEncoderCapacity(vgpuInstance, uint32(encoderCapacity))
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetEncoderStats()
|
||||
func VgpuInstanceGetEncoderStats(VgpuInstance VgpuInstance) (int, uint32, uint32, Return) {
|
||||
var SessionCount, AverageFps, AverageLatency uint32
|
||||
ret := nvmlVgpuInstanceGetEncoderStats(VgpuInstance, &SessionCount, &AverageFps, &AverageLatency)
|
||||
return int(SessionCount), AverageFps, AverageLatency, ret
|
||||
func (l *library) VgpuInstanceGetEncoderStats(vgpuInstance VgpuInstance) (int, uint32, uint32, Return) {
|
||||
return vgpuInstance.GetEncoderStats()
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetEncoderStats() (int, uint32, uint32, Return) {
|
||||
return VgpuInstanceGetEncoderStats(VgpuInstance)
|
||||
func (vgpuInstance nvmlVgpuInstance) GetEncoderStats() (int, uint32, uint32, Return) {
|
||||
var sessionCount, averageFps, averageLatency uint32
|
||||
ret := nvmlVgpuInstanceGetEncoderStats(vgpuInstance, &sessionCount, &averageFps, &averageLatency)
|
||||
return int(sessionCount), averageFps, averageLatency, ret
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetEncoderSessions()
|
||||
func VgpuInstanceGetEncoderSessions(VgpuInstance VgpuInstance) (int, EncoderSessionInfo, Return) {
|
||||
var SessionCount uint32
|
||||
var SessionInfo EncoderSessionInfo
|
||||
ret := nvmlVgpuInstanceGetEncoderSessions(VgpuInstance, &SessionCount, &SessionInfo)
|
||||
return int(SessionCount), SessionInfo, ret
|
||||
func (l *library) VgpuInstanceGetEncoderSessions(vgpuInstance VgpuInstance) (int, EncoderSessionInfo, Return) {
|
||||
return vgpuInstance.GetEncoderSessions()
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetEncoderSessions() (int, EncoderSessionInfo, Return) {
|
||||
return VgpuInstanceGetEncoderSessions(VgpuInstance)
|
||||
func (vgpuInstance nvmlVgpuInstance) GetEncoderSessions() (int, EncoderSessionInfo, Return) {
|
||||
var sessionCount uint32
|
||||
var sessionInfo EncoderSessionInfo
|
||||
ret := nvmlVgpuInstanceGetEncoderSessions(vgpuInstance, &sessionCount, &sessionInfo)
|
||||
return int(sessionCount), sessionInfo, ret
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetFBCStats()
|
||||
func VgpuInstanceGetFBCStats(VgpuInstance VgpuInstance) (FBCStats, Return) {
|
||||
var FbcStats FBCStats
|
||||
ret := nvmlVgpuInstanceGetFBCStats(VgpuInstance, &FbcStats)
|
||||
return FbcStats, ret
|
||||
func (l *library) VgpuInstanceGetFBCStats(vgpuInstance VgpuInstance) (FBCStats, Return) {
|
||||
return vgpuInstance.GetFBCStats()
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetFBCStats() (FBCStats, Return) {
|
||||
return VgpuInstanceGetFBCStats(VgpuInstance)
|
||||
func (vgpuInstance nvmlVgpuInstance) GetFBCStats() (FBCStats, Return) {
|
||||
var fbcStats FBCStats
|
||||
ret := nvmlVgpuInstanceGetFBCStats(vgpuInstance, &fbcStats)
|
||||
return fbcStats, ret
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetFBCSessions()
|
||||
func VgpuInstanceGetFBCSessions(VgpuInstance VgpuInstance) (int, FBCSessionInfo, Return) {
|
||||
var SessionCount uint32
|
||||
var SessionInfo FBCSessionInfo
|
||||
ret := nvmlVgpuInstanceGetFBCSessions(VgpuInstance, &SessionCount, &SessionInfo)
|
||||
return int(SessionCount), SessionInfo, ret
|
||||
func (l *library) VgpuInstanceGetFBCSessions(vgpuInstance VgpuInstance) (int, FBCSessionInfo, Return) {
|
||||
return vgpuInstance.GetFBCSessions()
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetFBCSessions() (int, FBCSessionInfo, Return) {
|
||||
return VgpuInstanceGetFBCSessions(VgpuInstance)
|
||||
func (vgpuInstance nvmlVgpuInstance) GetFBCSessions() (int, FBCSessionInfo, Return) {
|
||||
var sessionCount uint32
|
||||
var sessionInfo FBCSessionInfo
|
||||
ret := nvmlVgpuInstanceGetFBCSessions(vgpuInstance, &sessionCount, &sessionInfo)
|
||||
return int(sessionCount), sessionInfo, ret
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetGpuInstanceId()
|
||||
func VgpuInstanceGetGpuInstanceId(VgpuInstance VgpuInstance) (int, Return) {
|
||||
func (l *library) VgpuInstanceGetGpuInstanceId(vgpuInstance VgpuInstance) (int, Return) {
|
||||
return vgpuInstance.GetGpuInstanceId()
|
||||
}
|
||||
|
||||
func (vgpuInstance nvmlVgpuInstance) GetGpuInstanceId() (int, Return) {
|
||||
var gpuInstanceId uint32
|
||||
ret := nvmlVgpuInstanceGetGpuInstanceId(VgpuInstance, &gpuInstanceId)
|
||||
ret := nvmlVgpuInstanceGetGpuInstanceId(vgpuInstance, &gpuInstanceId)
|
||||
return int(gpuInstanceId), ret
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetGpuInstanceId() (int, Return) {
|
||||
return VgpuInstanceGetGpuInstanceId(VgpuInstance)
|
||||
// nvml.VgpuInstanceGetGpuPciId()
|
||||
func (l *library) VgpuInstanceGetGpuPciId(vgpuInstance VgpuInstance) (string, Return) {
|
||||
return vgpuInstance.GetGpuPciId()
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetGpuPciId()
|
||||
func VgpuInstanceGetGpuPciId(VgpuInstance VgpuInstance) (string, Return) {
|
||||
var Length uint32 = 1 // Will be reduced upon returning
|
||||
func (vgpuInstance nvmlVgpuInstance) GetGpuPciId() (string, Return) {
|
||||
var length uint32 = 1 // Will be reduced upon returning
|
||||
for {
|
||||
VgpuPciId := make([]byte, Length)
|
||||
ret := nvmlVgpuInstanceGetGpuPciId(VgpuInstance, &VgpuPciId[0], &Length)
|
||||
vgpuPciId := make([]byte, length)
|
||||
ret := nvmlVgpuInstanceGetGpuPciId(vgpuInstance, &vgpuPciId[0], &length)
|
||||
if ret == SUCCESS {
|
||||
return string(VgpuPciId[:clen(VgpuPciId)]), ret
|
||||
return string(vgpuPciId[:clen(vgpuPciId)]), ret
|
||||
}
|
||||
if ret != ERROR_INSUFFICIENT_SIZE {
|
||||
return "", ret
|
||||
}
|
||||
Length *= 2
|
||||
length *= 2
|
||||
}
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetGpuPciId() (string, Return) {
|
||||
return VgpuInstanceGetGpuPciId(VgpuInstance)
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetMetadata()
|
||||
func VgpuInstanceGetMetadata(VgpuInstance VgpuInstance) (VgpuMetadata, Return) {
|
||||
var VgpuMetadata VgpuMetadata
|
||||
OpaqueDataSize := unsafe.Sizeof(VgpuMetadata.nvmlVgpuMetadata.OpaqueData)
|
||||
VgpuMetadataSize := unsafe.Sizeof(VgpuMetadata.nvmlVgpuMetadata) - OpaqueDataSize
|
||||
func (l *library) VgpuInstanceGetMetadata(vgpuInstance VgpuInstance) (VgpuMetadata, Return) {
|
||||
return vgpuInstance.GetMetadata()
|
||||
}
|
||||
|
||||
func (vgpuInstance nvmlVgpuInstance) GetMetadata() (VgpuMetadata, Return) {
|
||||
var vgpuMetadata VgpuMetadata
|
||||
opaqueDataSize := unsafe.Sizeof(vgpuMetadata.nvmlVgpuMetadata.OpaqueData)
|
||||
vgpuMetadataSize := unsafe.Sizeof(vgpuMetadata.nvmlVgpuMetadata) - opaqueDataSize
|
||||
for {
|
||||
BufferSize := uint32(VgpuMetadataSize + OpaqueDataSize)
|
||||
Buffer := make([]byte, BufferSize)
|
||||
nvmlVgpuMetadataPtr := (*nvmlVgpuMetadata)(unsafe.Pointer(&Buffer[0]))
|
||||
ret := nvmlVgpuInstanceGetMetadata(VgpuInstance, nvmlVgpuMetadataPtr, &BufferSize)
|
||||
bufferSize := uint32(vgpuMetadataSize + opaqueDataSize)
|
||||
buffer := make([]byte, bufferSize)
|
||||
nvmlVgpuMetadataPtr := (*nvmlVgpuMetadata)(unsafe.Pointer(&buffer[0]))
|
||||
ret := nvmlVgpuInstanceGetMetadata(vgpuInstance, nvmlVgpuMetadataPtr, &bufferSize)
|
||||
if ret == SUCCESS {
|
||||
VgpuMetadata.nvmlVgpuMetadata = *nvmlVgpuMetadataPtr
|
||||
VgpuMetadata.OpaqueData = Buffer[VgpuMetadataSize:BufferSize]
|
||||
return VgpuMetadata, ret
|
||||
vgpuMetadata.nvmlVgpuMetadata = *nvmlVgpuMetadataPtr
|
||||
vgpuMetadata.OpaqueData = buffer[vgpuMetadataSize:bufferSize]
|
||||
return vgpuMetadata, ret
|
||||
}
|
||||
if ret != ERROR_INSUFFICIENT_SIZE {
|
||||
return VgpuMetadata, ret
|
||||
return vgpuMetadata, ret
|
||||
}
|
||||
OpaqueDataSize = 2 * OpaqueDataSize
|
||||
opaqueDataSize = 2 * opaqueDataSize
|
||||
}
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetMetadata() (VgpuMetadata, Return) {
|
||||
return VgpuInstanceGetMetadata(VgpuInstance)
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetAccountingMode()
|
||||
func VgpuInstanceGetAccountingMode(VgpuInstance VgpuInstance) (EnableState, Return) {
|
||||
var Mode EnableState
|
||||
ret := nvmlVgpuInstanceGetAccountingMode(VgpuInstance, &Mode)
|
||||
return Mode, ret
|
||||
func (l *library) VgpuInstanceGetAccountingMode(vgpuInstance VgpuInstance) (EnableState, Return) {
|
||||
return vgpuInstance.GetAccountingMode()
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetAccountingMode() (EnableState, Return) {
|
||||
return VgpuInstanceGetAccountingMode(VgpuInstance)
|
||||
func (vgpuInstance nvmlVgpuInstance) GetAccountingMode() (EnableState, Return) {
|
||||
var mode EnableState
|
||||
ret := nvmlVgpuInstanceGetAccountingMode(vgpuInstance, &mode)
|
||||
return mode, ret
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetAccountingPids()
|
||||
func VgpuInstanceGetAccountingPids(VgpuInstance VgpuInstance) ([]int, Return) {
|
||||
var Count uint32 = 1 // Will be reduced upon returning
|
||||
func (l *library) VgpuInstanceGetAccountingPids(vgpuInstance VgpuInstance) ([]int, Return) {
|
||||
return vgpuInstance.GetAccountingPids()
|
||||
}
|
||||
|
||||
func (vgpuInstance nvmlVgpuInstance) GetAccountingPids() ([]int, Return) {
|
||||
var count uint32 = 1 // Will be reduced upon returning
|
||||
for {
|
||||
Pids := make([]uint32, Count)
|
||||
ret := nvmlVgpuInstanceGetAccountingPids(VgpuInstance, &Count, &Pids[0])
|
||||
pids := make([]uint32, count)
|
||||
ret := nvmlVgpuInstanceGetAccountingPids(vgpuInstance, &count, &pids[0])
|
||||
if ret == SUCCESS {
|
||||
return uint32SliceToIntSlice(Pids[:Count]), ret
|
||||
return uint32SliceToIntSlice(pids[:count]), ret
|
||||
}
|
||||
if ret != ERROR_INSUFFICIENT_SIZE {
|
||||
return nil, ret
|
||||
}
|
||||
Count *= 2
|
||||
count *= 2
|
||||
}
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetAccountingPids() ([]int, Return) {
|
||||
return VgpuInstanceGetAccountingPids(VgpuInstance)
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetAccountingStats()
|
||||
func VgpuInstanceGetAccountingStats(VgpuInstance VgpuInstance, Pid int) (AccountingStats, Return) {
|
||||
var Stats AccountingStats
|
||||
ret := nvmlVgpuInstanceGetAccountingStats(VgpuInstance, uint32(Pid), &Stats)
|
||||
return Stats, ret
|
||||
func (l *library) VgpuInstanceGetAccountingStats(vgpuInstance VgpuInstance, pid int) (AccountingStats, Return) {
|
||||
return vgpuInstance.GetAccountingStats(pid)
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetAccountingStats(Pid int) (AccountingStats, Return) {
|
||||
return VgpuInstanceGetAccountingStats(VgpuInstance, Pid)
|
||||
func (vgpuInstance nvmlVgpuInstance) GetAccountingStats(pid int) (AccountingStats, Return) {
|
||||
var stats AccountingStats
|
||||
ret := nvmlVgpuInstanceGetAccountingStats(vgpuInstance, uint32(pid), &stats)
|
||||
return stats, ret
|
||||
}
|
||||
|
||||
// nvml.GetVgpuCompatibility()
|
||||
func GetVgpuCompatibility(nvmlVgpuMetadata *nvmlVgpuMetadata, PgpuMetadata *nvmlVgpuPgpuMetadata) (VgpuPgpuCompatibility, Return) {
|
||||
var CompatibilityInfo VgpuPgpuCompatibility
|
||||
ret := nvmlGetVgpuCompatibility(nvmlVgpuMetadata, PgpuMetadata, &CompatibilityInfo)
|
||||
return CompatibilityInfo, ret
|
||||
func (l *library) GetVgpuCompatibility(vgpuMetadata *VgpuMetadata, pgpuMetadata *VgpuPgpuMetadata) (VgpuPgpuCompatibility, Return) {
|
||||
var compatibilityInfo VgpuPgpuCompatibility
|
||||
ret := nvmlGetVgpuCompatibility(&vgpuMetadata.nvmlVgpuMetadata, &pgpuMetadata.nvmlVgpuPgpuMetadata, &compatibilityInfo)
|
||||
return compatibilityInfo, ret
|
||||
}
|
||||
|
||||
// nvml.GetVgpuVersion()
|
||||
func GetVgpuVersion() (VgpuVersion, VgpuVersion, Return) {
|
||||
var Supported, Current VgpuVersion
|
||||
ret := nvmlGetVgpuVersion(&Supported, &Current)
|
||||
return Supported, Current, ret
|
||||
func (l *library) GetVgpuVersion() (VgpuVersion, VgpuVersion, Return) {
|
||||
var supported, current VgpuVersion
|
||||
ret := nvmlGetVgpuVersion(&supported, ¤t)
|
||||
return supported, current, ret
|
||||
}
|
||||
|
||||
// nvml.SetVgpuVersion()
|
||||
func SetVgpuVersion(VgpuVersion *VgpuVersion) Return {
|
||||
return nvmlSetVgpuVersion(VgpuVersion)
|
||||
func (l *library) SetVgpuVersion(vgpuVersion *VgpuVersion) Return {
|
||||
return nvmlSetVgpuVersion(vgpuVersion)
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceClearAccountingPids()
|
||||
func VgpuInstanceClearAccountingPids(VgpuInstance VgpuInstance) Return {
|
||||
return nvmlVgpuInstanceClearAccountingPids(VgpuInstance)
|
||||
func (l *library) VgpuInstanceClearAccountingPids(vgpuInstance VgpuInstance) Return {
|
||||
return vgpuInstance.ClearAccountingPids()
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) ClearAccountingPids() Return {
|
||||
return VgpuInstanceClearAccountingPids(VgpuInstance)
|
||||
func (vgpuInstance nvmlVgpuInstance) ClearAccountingPids() Return {
|
||||
return nvmlVgpuInstanceClearAccountingPids(vgpuInstance)
|
||||
}
|
||||
|
||||
// nvml.VgpuInstanceGetMdevUUID()
|
||||
func VgpuInstanceGetMdevUUID(VgpuInstance VgpuInstance) (string, Return) {
|
||||
MdevUuid := make([]byte, DEVICE_UUID_BUFFER_SIZE)
|
||||
ret := nvmlVgpuInstanceGetMdevUUID(VgpuInstance, &MdevUuid[0], DEVICE_UUID_BUFFER_SIZE)
|
||||
return string(MdevUuid[:clen(MdevUuid)]), ret
|
||||
func (l *library) VgpuInstanceGetMdevUUID(vgpuInstance VgpuInstance) (string, Return) {
|
||||
return vgpuInstance.GetMdevUUID()
|
||||
}
|
||||
|
||||
func (VgpuInstance VgpuInstance) GetMdevUUID() (string, Return) {
|
||||
return VgpuInstanceGetMdevUUID(VgpuInstance)
|
||||
func (vgpuInstance nvmlVgpuInstance) GetMdevUUID() (string, Return) {
|
||||
mdevUUID := make([]byte, DEVICE_UUID_BUFFER_SIZE)
|
||||
ret := nvmlVgpuInstanceGetMdevUUID(vgpuInstance, &mdevUUID[0], DEVICE_UUID_BUFFER_SIZE)
|
||||
return string(mdevUUID[:clen(mdevUUID)]), ret
|
||||
}
|
||||
|
||||
// nvml.VgpuTypeGetCapabilities()
|
||||
func VgpuTypeGetCapabilities(VgpuTypeId VgpuTypeId, Capability VgpuCapability) (bool, Return) {
|
||||
var CapResult uint32
|
||||
ret := nvmlVgpuTypeGetCapabilities(VgpuTypeId, Capability, &CapResult)
|
||||
return (CapResult != 0), ret
|
||||
func (l *library) VgpuTypeGetCapabilities(vgpuTypeId VgpuTypeId, capability VgpuCapability) (bool, Return) {
|
||||
return vgpuTypeId.GetCapabilities(capability)
|
||||
}
|
||||
|
||||
func (VgpuTypeId VgpuTypeId) GetCapabilities(Capability VgpuCapability) (bool, Return) {
|
||||
return VgpuTypeGetCapabilities(VgpuTypeId, Capability)
|
||||
func (vgpuTypeId nvmlVgpuTypeId) GetCapabilities(capability VgpuCapability) (bool, Return) {
|
||||
var capResult uint32
|
||||
ret := nvmlVgpuTypeGetCapabilities(vgpuTypeId, capability, &capResult)
|
||||
return (capResult != 0), ret
|
||||
}
|
||||
|
||||
// nvml.GetVgpuDriverCapabilities()
|
||||
func GetVgpuDriverCapabilities(Capability VgpuDriverCapability) (bool, Return) {
|
||||
var CapResult uint32
|
||||
ret := nvmlGetVgpuDriverCapabilities(Capability, &CapResult)
|
||||
return (CapResult != 0), ret
|
||||
func (l *library) GetVgpuDriverCapabilities(capability VgpuDriverCapability) (bool, Return) {
|
||||
var capResult uint32
|
||||
ret := nvmlGetVgpuDriverCapabilities(capability, &capResult)
|
||||
return (capResult != 0), ret
|
||||
}
|
||||
|
||||
919
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/zz_generated.api.go
generated
vendored
Normal file
919
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/zz_generated.api.go
generated
vendored
Normal file
@@ -0,0 +1,919 @@
|
||||
/**
|
||||
# Copyright 2024 NVIDIA CORPORATION
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
**/
|
||||
|
||||
// Generated Code; DO NOT EDIT.
|
||||
|
||||
package nvml
|
||||
|
||||
// The variables below represent package level methods from the library type.
|
||||
var (
|
||||
ComputeInstanceDestroy = libnvml.ComputeInstanceDestroy
|
||||
ComputeInstanceGetInfo = libnvml.ComputeInstanceGetInfo
|
||||
DeviceCcuGetStreamState = libnvml.DeviceCcuGetStreamState
|
||||
DeviceCcuSetStreamState = libnvml.DeviceCcuSetStreamState
|
||||
DeviceClearAccountingPids = libnvml.DeviceClearAccountingPids
|
||||
DeviceClearCpuAffinity = libnvml.DeviceClearCpuAffinity
|
||||
DeviceClearEccErrorCounts = libnvml.DeviceClearEccErrorCounts
|
||||
DeviceClearFieldValues = libnvml.DeviceClearFieldValues
|
||||
DeviceCreateGpuInstance = libnvml.DeviceCreateGpuInstance
|
||||
DeviceCreateGpuInstanceWithPlacement = libnvml.DeviceCreateGpuInstanceWithPlacement
|
||||
DeviceDiscoverGpus = libnvml.DeviceDiscoverGpus
|
||||
DeviceFreezeNvLinkUtilizationCounter = libnvml.DeviceFreezeNvLinkUtilizationCounter
|
||||
DeviceGetAPIRestriction = libnvml.DeviceGetAPIRestriction
|
||||
DeviceGetAccountingBufferSize = libnvml.DeviceGetAccountingBufferSize
|
||||
DeviceGetAccountingMode = libnvml.DeviceGetAccountingMode
|
||||
DeviceGetAccountingPids = libnvml.DeviceGetAccountingPids
|
||||
DeviceGetAccountingStats = libnvml.DeviceGetAccountingStats
|
||||
DeviceGetActiveVgpus = libnvml.DeviceGetActiveVgpus
|
||||
DeviceGetAdaptiveClockInfoStatus = libnvml.DeviceGetAdaptiveClockInfoStatus
|
||||
DeviceGetApplicationsClock = libnvml.DeviceGetApplicationsClock
|
||||
DeviceGetArchitecture = libnvml.DeviceGetArchitecture
|
||||
DeviceGetAttributes = libnvml.DeviceGetAttributes
|
||||
DeviceGetAutoBoostedClocksEnabled = libnvml.DeviceGetAutoBoostedClocksEnabled
|
||||
DeviceGetBAR1MemoryInfo = libnvml.DeviceGetBAR1MemoryInfo
|
||||
DeviceGetBoardId = libnvml.DeviceGetBoardId
|
||||
DeviceGetBoardPartNumber = libnvml.DeviceGetBoardPartNumber
|
||||
DeviceGetBrand = libnvml.DeviceGetBrand
|
||||
DeviceGetBridgeChipInfo = libnvml.DeviceGetBridgeChipInfo
|
||||
DeviceGetBusType = libnvml.DeviceGetBusType
|
||||
DeviceGetClkMonStatus = libnvml.DeviceGetClkMonStatus
|
||||
DeviceGetClock = libnvml.DeviceGetClock
|
||||
DeviceGetClockInfo = libnvml.DeviceGetClockInfo
|
||||
DeviceGetComputeInstanceId = libnvml.DeviceGetComputeInstanceId
|
||||
DeviceGetComputeMode = libnvml.DeviceGetComputeMode
|
||||
DeviceGetComputeRunningProcesses = libnvml.DeviceGetComputeRunningProcesses
|
||||
DeviceGetCount = libnvml.DeviceGetCount
|
||||
DeviceGetCpuAffinity = libnvml.DeviceGetCpuAffinity
|
||||
DeviceGetCpuAffinityWithinScope = libnvml.DeviceGetCpuAffinityWithinScope
|
||||
DeviceGetCreatableVgpus = libnvml.DeviceGetCreatableVgpus
|
||||
DeviceGetCudaComputeCapability = libnvml.DeviceGetCudaComputeCapability
|
||||
DeviceGetCurrPcieLinkGeneration = libnvml.DeviceGetCurrPcieLinkGeneration
|
||||
DeviceGetCurrPcieLinkWidth = libnvml.DeviceGetCurrPcieLinkWidth
|
||||
DeviceGetCurrentClocksThrottleReasons = libnvml.DeviceGetCurrentClocksThrottleReasons
|
||||
DeviceGetDecoderUtilization = libnvml.DeviceGetDecoderUtilization
|
||||
DeviceGetDefaultApplicationsClock = libnvml.DeviceGetDefaultApplicationsClock
|
||||
DeviceGetDefaultEccMode = libnvml.DeviceGetDefaultEccMode
|
||||
DeviceGetDetailedEccErrors = libnvml.DeviceGetDetailedEccErrors
|
||||
DeviceGetDeviceHandleFromMigDeviceHandle = libnvml.DeviceGetDeviceHandleFromMigDeviceHandle
|
||||
DeviceGetDisplayActive = libnvml.DeviceGetDisplayActive
|
||||
DeviceGetDisplayMode = libnvml.DeviceGetDisplayMode
|
||||
DeviceGetDriverModel = libnvml.DeviceGetDriverModel
|
||||
DeviceGetDynamicPstatesInfo = libnvml.DeviceGetDynamicPstatesInfo
|
||||
DeviceGetEccMode = libnvml.DeviceGetEccMode
|
||||
DeviceGetEncoderCapacity = libnvml.DeviceGetEncoderCapacity
|
||||
DeviceGetEncoderSessions = libnvml.DeviceGetEncoderSessions
|
||||
DeviceGetEncoderStats = libnvml.DeviceGetEncoderStats
|
||||
DeviceGetEncoderUtilization = libnvml.DeviceGetEncoderUtilization
|
||||
DeviceGetEnforcedPowerLimit = libnvml.DeviceGetEnforcedPowerLimit
|
||||
DeviceGetFBCSessions = libnvml.DeviceGetFBCSessions
|
||||
DeviceGetFBCStats = libnvml.DeviceGetFBCStats
|
||||
DeviceGetFanControlPolicy_v2 = libnvml.DeviceGetFanControlPolicy_v2
|
||||
DeviceGetFanSpeed = libnvml.DeviceGetFanSpeed
|
||||
DeviceGetFanSpeed_v2 = libnvml.DeviceGetFanSpeed_v2
|
||||
DeviceGetFieldValues = libnvml.DeviceGetFieldValues
|
||||
DeviceGetGpcClkMinMaxVfOffset = libnvml.DeviceGetGpcClkMinMaxVfOffset
|
||||
DeviceGetGpcClkVfOffset = libnvml.DeviceGetGpcClkVfOffset
|
||||
DeviceGetGpuFabricInfo = libnvml.DeviceGetGpuFabricInfo
|
||||
DeviceGetGpuInstanceById = libnvml.DeviceGetGpuInstanceById
|
||||
DeviceGetGpuInstanceId = libnvml.DeviceGetGpuInstanceId
|
||||
DeviceGetGpuInstancePossiblePlacements = libnvml.DeviceGetGpuInstancePossiblePlacements
|
||||
DeviceGetGpuInstanceProfileInfo = libnvml.DeviceGetGpuInstanceProfileInfo
|
||||
DeviceGetGpuInstanceProfileInfoV = libnvml.DeviceGetGpuInstanceProfileInfoV
|
||||
DeviceGetGpuInstanceRemainingCapacity = libnvml.DeviceGetGpuInstanceRemainingCapacity
|
||||
DeviceGetGpuInstances = libnvml.DeviceGetGpuInstances
|
||||
DeviceGetGpuMaxPcieLinkGeneration = libnvml.DeviceGetGpuMaxPcieLinkGeneration
|
||||
DeviceGetGpuOperationMode = libnvml.DeviceGetGpuOperationMode
|
||||
DeviceGetGraphicsRunningProcesses = libnvml.DeviceGetGraphicsRunningProcesses
|
||||
DeviceGetGridLicensableFeatures = libnvml.DeviceGetGridLicensableFeatures
|
||||
DeviceGetGspFirmwareMode = libnvml.DeviceGetGspFirmwareMode
|
||||
DeviceGetGspFirmwareVersion = libnvml.DeviceGetGspFirmwareVersion
|
||||
DeviceGetHandleByIndex = libnvml.DeviceGetHandleByIndex
|
||||
DeviceGetHandleByPciBusId = libnvml.DeviceGetHandleByPciBusId
|
||||
DeviceGetHandleBySerial = libnvml.DeviceGetHandleBySerial
|
||||
DeviceGetHandleByUUID = libnvml.DeviceGetHandleByUUID
|
||||
DeviceGetHostVgpuMode = libnvml.DeviceGetHostVgpuMode
|
||||
DeviceGetIndex = libnvml.DeviceGetIndex
|
||||
DeviceGetInforomConfigurationChecksum = libnvml.DeviceGetInforomConfigurationChecksum
|
||||
DeviceGetInforomImageVersion = libnvml.DeviceGetInforomImageVersion
|
||||
DeviceGetInforomVersion = libnvml.DeviceGetInforomVersion
|
||||
DeviceGetIrqNum = libnvml.DeviceGetIrqNum
|
||||
DeviceGetMPSComputeRunningProcesses = libnvml.DeviceGetMPSComputeRunningProcesses
|
||||
DeviceGetMaxClockInfo = libnvml.DeviceGetMaxClockInfo
|
||||
DeviceGetMaxCustomerBoostClock = libnvml.DeviceGetMaxCustomerBoostClock
|
||||
DeviceGetMaxMigDeviceCount = libnvml.DeviceGetMaxMigDeviceCount
|
||||
DeviceGetMaxPcieLinkGeneration = libnvml.DeviceGetMaxPcieLinkGeneration
|
||||
DeviceGetMaxPcieLinkWidth = libnvml.DeviceGetMaxPcieLinkWidth
|
||||
DeviceGetMemClkMinMaxVfOffset = libnvml.DeviceGetMemClkMinMaxVfOffset
|
||||
DeviceGetMemClkVfOffset = libnvml.DeviceGetMemClkVfOffset
|
||||
DeviceGetMemoryAffinity = libnvml.DeviceGetMemoryAffinity
|
||||
DeviceGetMemoryBusWidth = libnvml.DeviceGetMemoryBusWidth
|
||||
DeviceGetMemoryErrorCounter = libnvml.DeviceGetMemoryErrorCounter
|
||||
DeviceGetMemoryInfo = libnvml.DeviceGetMemoryInfo
|
||||
DeviceGetMemoryInfo_v2 = libnvml.DeviceGetMemoryInfo_v2
|
||||
DeviceGetMigDeviceHandleByIndex = libnvml.DeviceGetMigDeviceHandleByIndex
|
||||
DeviceGetMigMode = libnvml.DeviceGetMigMode
|
||||
DeviceGetMinMaxClockOfPState = libnvml.DeviceGetMinMaxClockOfPState
|
||||
DeviceGetMinMaxFanSpeed = libnvml.DeviceGetMinMaxFanSpeed
|
||||
DeviceGetMinorNumber = libnvml.DeviceGetMinorNumber
|
||||
DeviceGetMultiGpuBoard = libnvml.DeviceGetMultiGpuBoard
|
||||
DeviceGetName = libnvml.DeviceGetName
|
||||
DeviceGetNumFans = libnvml.DeviceGetNumFans
|
||||
DeviceGetNumGpuCores = libnvml.DeviceGetNumGpuCores
|
||||
DeviceGetNvLinkCapability = libnvml.DeviceGetNvLinkCapability
|
||||
DeviceGetNvLinkErrorCounter = libnvml.DeviceGetNvLinkErrorCounter
|
||||
DeviceGetNvLinkRemoteDeviceType = libnvml.DeviceGetNvLinkRemoteDeviceType
|
||||
DeviceGetNvLinkRemotePciInfo = libnvml.DeviceGetNvLinkRemotePciInfo
|
||||
DeviceGetNvLinkState = libnvml.DeviceGetNvLinkState
|
||||
DeviceGetNvLinkUtilizationControl = libnvml.DeviceGetNvLinkUtilizationControl
|
||||
DeviceGetNvLinkUtilizationCounter = libnvml.DeviceGetNvLinkUtilizationCounter
|
||||
DeviceGetNvLinkVersion = libnvml.DeviceGetNvLinkVersion
|
||||
DeviceGetP2PStatus = libnvml.DeviceGetP2PStatus
|
||||
DeviceGetPciInfo = libnvml.DeviceGetPciInfo
|
||||
DeviceGetPcieLinkMaxSpeed = libnvml.DeviceGetPcieLinkMaxSpeed
|
||||
DeviceGetPcieReplayCounter = libnvml.DeviceGetPcieReplayCounter
|
||||
DeviceGetPcieSpeed = libnvml.DeviceGetPcieSpeed
|
||||
DeviceGetPcieThroughput = libnvml.DeviceGetPcieThroughput
|
||||
DeviceGetPerformanceState = libnvml.DeviceGetPerformanceState
|
||||
DeviceGetPersistenceMode = libnvml.DeviceGetPersistenceMode
|
||||
DeviceGetPgpuMetadataString = libnvml.DeviceGetPgpuMetadataString
|
||||
DeviceGetPowerManagementDefaultLimit = libnvml.DeviceGetPowerManagementDefaultLimit
|
||||
DeviceGetPowerManagementLimit = libnvml.DeviceGetPowerManagementLimit
|
||||
DeviceGetPowerManagementLimitConstraints = libnvml.DeviceGetPowerManagementLimitConstraints
|
||||
DeviceGetPowerManagementMode = libnvml.DeviceGetPowerManagementMode
|
||||
DeviceGetPowerSource = libnvml.DeviceGetPowerSource
|
||||
DeviceGetPowerState = libnvml.DeviceGetPowerState
|
||||
DeviceGetPowerUsage = libnvml.DeviceGetPowerUsage
|
||||
DeviceGetProcessUtilization = libnvml.DeviceGetProcessUtilization
|
||||
DeviceGetRemappedRows = libnvml.DeviceGetRemappedRows
|
||||
DeviceGetRetiredPages = libnvml.DeviceGetRetiredPages
|
||||
DeviceGetRetiredPagesPendingStatus = libnvml.DeviceGetRetiredPagesPendingStatus
|
||||
DeviceGetRetiredPages_v2 = libnvml.DeviceGetRetiredPages_v2
|
||||
DeviceGetRowRemapperHistogram = libnvml.DeviceGetRowRemapperHistogram
|
||||
DeviceGetSamples = libnvml.DeviceGetSamples
|
||||
DeviceGetSerial = libnvml.DeviceGetSerial
|
||||
DeviceGetSupportedClocksThrottleReasons = libnvml.DeviceGetSupportedClocksThrottleReasons
|
||||
DeviceGetSupportedEventTypes = libnvml.DeviceGetSupportedEventTypes
|
||||
DeviceGetSupportedGraphicsClocks = libnvml.DeviceGetSupportedGraphicsClocks
|
||||
DeviceGetSupportedMemoryClocks = libnvml.DeviceGetSupportedMemoryClocks
|
||||
DeviceGetSupportedPerformanceStates = libnvml.DeviceGetSupportedPerformanceStates
|
||||
DeviceGetSupportedVgpus = libnvml.DeviceGetSupportedVgpus
|
||||
DeviceGetTargetFanSpeed = libnvml.DeviceGetTargetFanSpeed
|
||||
DeviceGetTemperature = libnvml.DeviceGetTemperature
|
||||
DeviceGetTemperatureThreshold = libnvml.DeviceGetTemperatureThreshold
|
||||
DeviceGetThermalSettings = libnvml.DeviceGetThermalSettings
|
||||
DeviceGetTopologyCommonAncestor = libnvml.DeviceGetTopologyCommonAncestor
|
||||
DeviceGetTopologyNearestGpus = libnvml.DeviceGetTopologyNearestGpus
|
||||
DeviceGetTotalEccErrors = libnvml.DeviceGetTotalEccErrors
|
||||
DeviceGetTotalEnergyConsumption = libnvml.DeviceGetTotalEnergyConsumption
|
||||
DeviceGetUUID = libnvml.DeviceGetUUID
|
||||
DeviceGetUtilizationRates = libnvml.DeviceGetUtilizationRates
|
||||
DeviceGetVbiosVersion = libnvml.DeviceGetVbiosVersion
|
||||
DeviceGetVgpuCapabilities = libnvml.DeviceGetVgpuCapabilities
|
||||
DeviceGetVgpuMetadata = libnvml.DeviceGetVgpuMetadata
|
||||
DeviceGetVgpuProcessUtilization = libnvml.DeviceGetVgpuProcessUtilization
|
||||
DeviceGetVgpuSchedulerCapabilities = libnvml.DeviceGetVgpuSchedulerCapabilities
|
||||
DeviceGetVgpuSchedulerLog = libnvml.DeviceGetVgpuSchedulerLog
|
||||
DeviceGetVgpuSchedulerState = libnvml.DeviceGetVgpuSchedulerState
|
||||
DeviceGetVgpuUtilization = libnvml.DeviceGetVgpuUtilization
|
||||
DeviceGetViolationStatus = libnvml.DeviceGetViolationStatus
|
||||
DeviceGetVirtualizationMode = libnvml.DeviceGetVirtualizationMode
|
||||
DeviceIsMigDeviceHandle = libnvml.DeviceIsMigDeviceHandle
|
||||
DeviceModifyDrainState = libnvml.DeviceModifyDrainState
|
||||
DeviceOnSameBoard = libnvml.DeviceOnSameBoard
|
||||
DeviceQueryDrainState = libnvml.DeviceQueryDrainState
|
||||
DeviceRegisterEvents = libnvml.DeviceRegisterEvents
|
||||
DeviceRemoveGpu = libnvml.DeviceRemoveGpu
|
||||
DeviceRemoveGpu_v2 = libnvml.DeviceRemoveGpu_v2
|
||||
DeviceResetApplicationsClocks = libnvml.DeviceResetApplicationsClocks
|
||||
DeviceResetGpuLockedClocks = libnvml.DeviceResetGpuLockedClocks
|
||||
DeviceResetMemoryLockedClocks = libnvml.DeviceResetMemoryLockedClocks
|
||||
DeviceResetNvLinkErrorCounters = libnvml.DeviceResetNvLinkErrorCounters
|
||||
DeviceResetNvLinkUtilizationCounter = libnvml.DeviceResetNvLinkUtilizationCounter
|
||||
DeviceSetAPIRestriction = libnvml.DeviceSetAPIRestriction
|
||||
DeviceSetAccountingMode = libnvml.DeviceSetAccountingMode
|
||||
DeviceSetApplicationsClocks = libnvml.DeviceSetApplicationsClocks
|
||||
DeviceSetAutoBoostedClocksEnabled = libnvml.DeviceSetAutoBoostedClocksEnabled
|
||||
DeviceSetComputeMode = libnvml.DeviceSetComputeMode
|
||||
DeviceSetCpuAffinity = libnvml.DeviceSetCpuAffinity
|
||||
DeviceSetDefaultAutoBoostedClocksEnabled = libnvml.DeviceSetDefaultAutoBoostedClocksEnabled
|
||||
DeviceSetDefaultFanSpeed_v2 = libnvml.DeviceSetDefaultFanSpeed_v2
|
||||
DeviceSetDriverModel = libnvml.DeviceSetDriverModel
|
||||
DeviceSetEccMode = libnvml.DeviceSetEccMode
|
||||
DeviceSetFanControlPolicy = libnvml.DeviceSetFanControlPolicy
|
||||
DeviceSetFanSpeed_v2 = libnvml.DeviceSetFanSpeed_v2
|
||||
DeviceSetGpcClkVfOffset = libnvml.DeviceSetGpcClkVfOffset
|
||||
DeviceSetGpuLockedClocks = libnvml.DeviceSetGpuLockedClocks
|
||||
DeviceSetGpuOperationMode = libnvml.DeviceSetGpuOperationMode
|
||||
DeviceSetMemClkVfOffset = libnvml.DeviceSetMemClkVfOffset
|
||||
DeviceSetMemoryLockedClocks = libnvml.DeviceSetMemoryLockedClocks
|
||||
DeviceSetMigMode = libnvml.DeviceSetMigMode
|
||||
DeviceSetNvLinkDeviceLowPowerThreshold = libnvml.DeviceSetNvLinkDeviceLowPowerThreshold
|
||||
DeviceSetNvLinkUtilizationControl = libnvml.DeviceSetNvLinkUtilizationControl
|
||||
DeviceSetPersistenceMode = libnvml.DeviceSetPersistenceMode
|
||||
DeviceSetPowerManagementLimit = libnvml.DeviceSetPowerManagementLimit
|
||||
DeviceSetTemperatureThreshold = libnvml.DeviceSetTemperatureThreshold
|
||||
DeviceSetVgpuSchedulerState = libnvml.DeviceSetVgpuSchedulerState
|
||||
DeviceSetVirtualizationMode = libnvml.DeviceSetVirtualizationMode
|
||||
DeviceValidateInforom = libnvml.DeviceValidateInforom
|
||||
ErrorString = libnvml.ErrorString
|
||||
EventSetCreate = libnvml.EventSetCreate
|
||||
EventSetFree = libnvml.EventSetFree
|
||||
EventSetWait = libnvml.EventSetWait
|
||||
Extensions = libnvml.Extensions
|
||||
GetExcludedDeviceCount = libnvml.GetExcludedDeviceCount
|
||||
GetExcludedDeviceInfoByIndex = libnvml.GetExcludedDeviceInfoByIndex
|
||||
GetVgpuCompatibility = libnvml.GetVgpuCompatibility
|
||||
GetVgpuDriverCapabilities = libnvml.GetVgpuDriverCapabilities
|
||||
GetVgpuVersion = libnvml.GetVgpuVersion
|
||||
GpmMetricsGet = libnvml.GpmMetricsGet
|
||||
GpmMetricsGetV = libnvml.GpmMetricsGetV
|
||||
GpmMigSampleGet = libnvml.GpmMigSampleGet
|
||||
GpmQueryDeviceSupport = libnvml.GpmQueryDeviceSupport
|
||||
GpmQueryDeviceSupportV = libnvml.GpmQueryDeviceSupportV
|
||||
GpmSampleAlloc = libnvml.GpmSampleAlloc
|
||||
GpmSampleFree = libnvml.GpmSampleFree
|
||||
GpmSampleGet = libnvml.GpmSampleGet
|
||||
GpuInstanceCreateComputeInstance = libnvml.GpuInstanceCreateComputeInstance
|
||||
GpuInstanceCreateComputeInstanceWithPlacement = libnvml.GpuInstanceCreateComputeInstanceWithPlacement
|
||||
GpuInstanceDestroy = libnvml.GpuInstanceDestroy
|
||||
GpuInstanceGetComputeInstanceById = libnvml.GpuInstanceGetComputeInstanceById
|
||||
GpuInstanceGetComputeInstancePossiblePlacements = libnvml.GpuInstanceGetComputeInstancePossiblePlacements
|
||||
GpuInstanceGetComputeInstanceProfileInfo = libnvml.GpuInstanceGetComputeInstanceProfileInfo
|
||||
GpuInstanceGetComputeInstanceProfileInfoV = libnvml.GpuInstanceGetComputeInstanceProfileInfoV
|
||||
GpuInstanceGetComputeInstanceRemainingCapacity = libnvml.GpuInstanceGetComputeInstanceRemainingCapacity
|
||||
GpuInstanceGetComputeInstances = libnvml.GpuInstanceGetComputeInstances
|
||||
GpuInstanceGetInfo = libnvml.GpuInstanceGetInfo
|
||||
Init = libnvml.Init
|
||||
InitWithFlags = libnvml.InitWithFlags
|
||||
SetVgpuVersion = libnvml.SetVgpuVersion
|
||||
Shutdown = libnvml.Shutdown
|
||||
SystemGetCudaDriverVersion = libnvml.SystemGetCudaDriverVersion
|
||||
SystemGetCudaDriverVersion_v2 = libnvml.SystemGetCudaDriverVersion_v2
|
||||
SystemGetDriverVersion = libnvml.SystemGetDriverVersion
|
||||
SystemGetHicVersion = libnvml.SystemGetHicVersion
|
||||
SystemGetNVMLVersion = libnvml.SystemGetNVMLVersion
|
||||
SystemGetProcessName = libnvml.SystemGetProcessName
|
||||
SystemGetTopologyGpuSet = libnvml.SystemGetTopologyGpuSet
|
||||
UnitGetCount = libnvml.UnitGetCount
|
||||
UnitGetDevices = libnvml.UnitGetDevices
|
||||
UnitGetFanSpeedInfo = libnvml.UnitGetFanSpeedInfo
|
||||
UnitGetHandleByIndex = libnvml.UnitGetHandleByIndex
|
||||
UnitGetLedState = libnvml.UnitGetLedState
|
||||
UnitGetPsuInfo = libnvml.UnitGetPsuInfo
|
||||
UnitGetTemperature = libnvml.UnitGetTemperature
|
||||
UnitGetUnitInfo = libnvml.UnitGetUnitInfo
|
||||
UnitSetLedState = libnvml.UnitSetLedState
|
||||
VgpuInstanceClearAccountingPids = libnvml.VgpuInstanceClearAccountingPids
|
||||
VgpuInstanceGetAccountingMode = libnvml.VgpuInstanceGetAccountingMode
|
||||
VgpuInstanceGetAccountingPids = libnvml.VgpuInstanceGetAccountingPids
|
||||
VgpuInstanceGetAccountingStats = libnvml.VgpuInstanceGetAccountingStats
|
||||
VgpuInstanceGetEccMode = libnvml.VgpuInstanceGetEccMode
|
||||
VgpuInstanceGetEncoderCapacity = libnvml.VgpuInstanceGetEncoderCapacity
|
||||
VgpuInstanceGetEncoderSessions = libnvml.VgpuInstanceGetEncoderSessions
|
||||
VgpuInstanceGetEncoderStats = libnvml.VgpuInstanceGetEncoderStats
|
||||
VgpuInstanceGetFBCSessions = libnvml.VgpuInstanceGetFBCSessions
|
||||
VgpuInstanceGetFBCStats = libnvml.VgpuInstanceGetFBCStats
|
||||
VgpuInstanceGetFbUsage = libnvml.VgpuInstanceGetFbUsage
|
||||
VgpuInstanceGetFrameRateLimit = libnvml.VgpuInstanceGetFrameRateLimit
|
||||
VgpuInstanceGetGpuInstanceId = libnvml.VgpuInstanceGetGpuInstanceId
|
||||
VgpuInstanceGetGpuPciId = libnvml.VgpuInstanceGetGpuPciId
|
||||
VgpuInstanceGetLicenseInfo = libnvml.VgpuInstanceGetLicenseInfo
|
||||
VgpuInstanceGetLicenseStatus = libnvml.VgpuInstanceGetLicenseStatus
|
||||
VgpuInstanceGetMdevUUID = libnvml.VgpuInstanceGetMdevUUID
|
||||
VgpuInstanceGetMetadata = libnvml.VgpuInstanceGetMetadata
|
||||
VgpuInstanceGetType = libnvml.VgpuInstanceGetType
|
||||
VgpuInstanceGetUUID = libnvml.VgpuInstanceGetUUID
|
||||
VgpuInstanceGetVmDriverVersion = libnvml.VgpuInstanceGetVmDriverVersion
|
||||
VgpuInstanceGetVmID = libnvml.VgpuInstanceGetVmID
|
||||
VgpuInstanceSetEncoderCapacity = libnvml.VgpuInstanceSetEncoderCapacity
|
||||
VgpuTypeGetCapabilities = libnvml.VgpuTypeGetCapabilities
|
||||
VgpuTypeGetClass = libnvml.VgpuTypeGetClass
|
||||
VgpuTypeGetDeviceID = libnvml.VgpuTypeGetDeviceID
|
||||
VgpuTypeGetFrameRateLimit = libnvml.VgpuTypeGetFrameRateLimit
|
||||
VgpuTypeGetFramebufferSize = libnvml.VgpuTypeGetFramebufferSize
|
||||
VgpuTypeGetGpuInstanceProfileId = libnvml.VgpuTypeGetGpuInstanceProfileId
|
||||
VgpuTypeGetLicense = libnvml.VgpuTypeGetLicense
|
||||
VgpuTypeGetMaxInstances = libnvml.VgpuTypeGetMaxInstances
|
||||
VgpuTypeGetMaxInstancesPerVm = libnvml.VgpuTypeGetMaxInstancesPerVm
|
||||
VgpuTypeGetName = libnvml.VgpuTypeGetName
|
||||
VgpuTypeGetNumDisplayHeads = libnvml.VgpuTypeGetNumDisplayHeads
|
||||
VgpuTypeGetResolution = libnvml.VgpuTypeGetResolution
|
||||
)
|
||||
|
||||
// Interface represents the interface for the library type.
|
||||
//
|
||||
//go:generate moq -out mock/interface.go -pkg mock . Interface:Interface
|
||||
type Interface interface {
|
||||
ComputeInstanceDestroy(ComputeInstance) Return
|
||||
ComputeInstanceGetInfo(ComputeInstance) (ComputeInstanceInfo, Return)
|
||||
DeviceCcuGetStreamState(Device) (int, Return)
|
||||
DeviceCcuSetStreamState(Device, int) Return
|
||||
DeviceClearAccountingPids(Device) Return
|
||||
DeviceClearCpuAffinity(Device) Return
|
||||
DeviceClearEccErrorCounts(Device, EccCounterType) Return
|
||||
DeviceClearFieldValues(Device, []FieldValue) Return
|
||||
DeviceCreateGpuInstance(Device, *GpuInstanceProfileInfo) (GpuInstance, Return)
|
||||
DeviceCreateGpuInstanceWithPlacement(Device, *GpuInstanceProfileInfo, *GpuInstancePlacement) (GpuInstance, Return)
|
||||
DeviceDiscoverGpus() (PciInfo, Return)
|
||||
DeviceFreezeNvLinkUtilizationCounter(Device, int, int, EnableState) Return
|
||||
DeviceGetAPIRestriction(Device, RestrictedAPI) (EnableState, Return)
|
||||
DeviceGetAccountingBufferSize(Device) (int, Return)
|
||||
DeviceGetAccountingMode(Device) (EnableState, Return)
|
||||
DeviceGetAccountingPids(Device) ([]int, Return)
|
||||
DeviceGetAccountingStats(Device, uint32) (AccountingStats, Return)
|
||||
DeviceGetActiveVgpus(Device) ([]VgpuInstance, Return)
|
||||
DeviceGetAdaptiveClockInfoStatus(Device) (uint32, Return)
|
||||
DeviceGetApplicationsClock(Device, ClockType) (uint32, Return)
|
||||
DeviceGetArchitecture(Device) (DeviceArchitecture, Return)
|
||||
DeviceGetAttributes(Device) (DeviceAttributes, Return)
|
||||
DeviceGetAutoBoostedClocksEnabled(Device) (EnableState, EnableState, Return)
|
||||
DeviceGetBAR1MemoryInfo(Device) (BAR1Memory, Return)
|
||||
DeviceGetBoardId(Device) (uint32, Return)
|
||||
DeviceGetBoardPartNumber(Device) (string, Return)
|
||||
DeviceGetBrand(Device) (BrandType, Return)
|
||||
DeviceGetBridgeChipInfo(Device) (BridgeChipHierarchy, Return)
|
||||
DeviceGetBusType(Device) (BusType, Return)
|
||||
DeviceGetClkMonStatus(Device) (ClkMonStatus, Return)
|
||||
DeviceGetClock(Device, ClockType, ClockId) (uint32, Return)
|
||||
DeviceGetClockInfo(Device, ClockType) (uint32, Return)
|
||||
DeviceGetComputeInstanceId(Device) (int, Return)
|
||||
DeviceGetComputeMode(Device) (ComputeMode, Return)
|
||||
DeviceGetComputeRunningProcesses(Device) ([]ProcessInfo, Return)
|
||||
DeviceGetCount() (int, Return)
|
||||
DeviceGetCpuAffinity(Device, int) ([]uint, Return)
|
||||
DeviceGetCpuAffinityWithinScope(Device, int, AffinityScope) ([]uint, Return)
|
||||
DeviceGetCreatableVgpus(Device) ([]VgpuTypeId, Return)
|
||||
DeviceGetCudaComputeCapability(Device) (int, int, Return)
|
||||
DeviceGetCurrPcieLinkGeneration(Device) (int, Return)
|
||||
DeviceGetCurrPcieLinkWidth(Device) (int, Return)
|
||||
DeviceGetCurrentClocksThrottleReasons(Device) (uint64, Return)
|
||||
DeviceGetDecoderUtilization(Device) (uint32, uint32, Return)
|
||||
DeviceGetDefaultApplicationsClock(Device, ClockType) (uint32, Return)
|
||||
DeviceGetDefaultEccMode(Device) (EnableState, Return)
|
||||
DeviceGetDetailedEccErrors(Device, MemoryErrorType, EccCounterType) (EccErrorCounts, Return)
|
||||
DeviceGetDeviceHandleFromMigDeviceHandle(Device) (Device, Return)
|
||||
DeviceGetDisplayActive(Device) (EnableState, Return)
|
||||
DeviceGetDisplayMode(Device) (EnableState, Return)
|
||||
DeviceGetDriverModel(Device) (DriverModel, DriverModel, Return)
|
||||
DeviceGetDynamicPstatesInfo(Device) (GpuDynamicPstatesInfo, Return)
|
||||
DeviceGetEccMode(Device) (EnableState, EnableState, Return)
|
||||
DeviceGetEncoderCapacity(Device, EncoderType) (int, Return)
|
||||
DeviceGetEncoderSessions(Device) ([]EncoderSessionInfo, Return)
|
||||
DeviceGetEncoderStats(Device) (int, uint32, uint32, Return)
|
||||
DeviceGetEncoderUtilization(Device) (uint32, uint32, Return)
|
||||
DeviceGetEnforcedPowerLimit(Device) (uint32, Return)
|
||||
DeviceGetFBCSessions(Device) ([]FBCSessionInfo, Return)
|
||||
DeviceGetFBCStats(Device) (FBCStats, Return)
|
||||
DeviceGetFanControlPolicy_v2(Device, int) (FanControlPolicy, Return)
|
||||
DeviceGetFanSpeed(Device) (uint32, Return)
|
||||
DeviceGetFanSpeed_v2(Device, int) (uint32, Return)
|
||||
DeviceGetFieldValues(Device, []FieldValue) Return
|
||||
DeviceGetGpcClkMinMaxVfOffset(Device) (int, int, Return)
|
||||
DeviceGetGpcClkVfOffset(Device) (int, Return)
|
||||
DeviceGetGpuFabricInfo(Device) (GpuFabricInfo, Return)
|
||||
DeviceGetGpuInstanceById(Device, int) (GpuInstance, Return)
|
||||
DeviceGetGpuInstanceId(Device) (int, Return)
|
||||
DeviceGetGpuInstancePossiblePlacements(Device, *GpuInstanceProfileInfo) ([]GpuInstancePlacement, Return)
|
||||
DeviceGetGpuInstanceProfileInfo(Device, int) (GpuInstanceProfileInfo, Return)
|
||||
DeviceGetGpuInstanceProfileInfoV(Device, int) GpuInstanceProfileInfoV
|
||||
DeviceGetGpuInstanceRemainingCapacity(Device, *GpuInstanceProfileInfo) (int, Return)
|
||||
DeviceGetGpuInstances(Device, *GpuInstanceProfileInfo) ([]GpuInstance, Return)
|
||||
DeviceGetGpuMaxPcieLinkGeneration(Device) (int, Return)
|
||||
DeviceGetGpuOperationMode(Device) (GpuOperationMode, GpuOperationMode, Return)
|
||||
DeviceGetGraphicsRunningProcesses(Device) ([]ProcessInfo, Return)
|
||||
DeviceGetGridLicensableFeatures(Device) (GridLicensableFeatures, Return)
|
||||
DeviceGetGspFirmwareMode(Device) (bool, bool, Return)
|
||||
DeviceGetGspFirmwareVersion(Device) (string, Return)
|
||||
DeviceGetHandleByIndex(int) (Device, Return)
|
||||
DeviceGetHandleByPciBusId(string) (Device, Return)
|
||||
DeviceGetHandleBySerial(string) (Device, Return)
|
||||
DeviceGetHandleByUUID(string) (Device, Return)
|
||||
DeviceGetHostVgpuMode(Device) (HostVgpuMode, Return)
|
||||
DeviceGetIndex(Device) (int, Return)
|
||||
DeviceGetInforomConfigurationChecksum(Device) (uint32, Return)
|
||||
DeviceGetInforomImageVersion(Device) (string, Return)
|
||||
DeviceGetInforomVersion(Device, InforomObject) (string, Return)
|
||||
DeviceGetIrqNum(Device) (int, Return)
|
||||
DeviceGetMPSComputeRunningProcesses(Device) ([]ProcessInfo, Return)
|
||||
DeviceGetMaxClockInfo(Device, ClockType) (uint32, Return)
|
||||
DeviceGetMaxCustomerBoostClock(Device, ClockType) (uint32, Return)
|
||||
DeviceGetMaxMigDeviceCount(Device) (int, Return)
|
||||
DeviceGetMaxPcieLinkGeneration(Device) (int, Return)
|
||||
DeviceGetMaxPcieLinkWidth(Device) (int, Return)
|
||||
DeviceGetMemClkMinMaxVfOffset(Device) (int, int, Return)
|
||||
DeviceGetMemClkVfOffset(Device) (int, Return)
|
||||
DeviceGetMemoryAffinity(Device, int, AffinityScope) ([]uint, Return)
|
||||
DeviceGetMemoryBusWidth(Device) (uint32, Return)
|
||||
DeviceGetMemoryErrorCounter(Device, MemoryErrorType, EccCounterType, MemoryLocation) (uint64, Return)
|
||||
DeviceGetMemoryInfo(Device) (Memory, Return)
|
||||
DeviceGetMemoryInfo_v2(Device) (Memory_v2, Return)
|
||||
DeviceGetMigDeviceHandleByIndex(Device, int) (Device, Return)
|
||||
DeviceGetMigMode(Device) (int, int, Return)
|
||||
DeviceGetMinMaxClockOfPState(Device, ClockType, Pstates) (uint32, uint32, Return)
|
||||
DeviceGetMinMaxFanSpeed(Device) (int, int, Return)
|
||||
DeviceGetMinorNumber(Device) (int, Return)
|
||||
DeviceGetMultiGpuBoard(Device) (int, Return)
|
||||
DeviceGetName(Device) (string, Return)
|
||||
DeviceGetNumFans(Device) (int, Return)
|
||||
DeviceGetNumGpuCores(Device) (int, Return)
|
||||
DeviceGetNvLinkCapability(Device, int, NvLinkCapability) (uint32, Return)
|
||||
DeviceGetNvLinkErrorCounter(Device, int, NvLinkErrorCounter) (uint64, Return)
|
||||
DeviceGetNvLinkRemoteDeviceType(Device, int) (IntNvLinkDeviceType, Return)
|
||||
DeviceGetNvLinkRemotePciInfo(Device, int) (PciInfo, Return)
|
||||
DeviceGetNvLinkState(Device, int) (EnableState, Return)
|
||||
DeviceGetNvLinkUtilizationControl(Device, int, int) (NvLinkUtilizationControl, Return)
|
||||
DeviceGetNvLinkUtilizationCounter(Device, int, int) (uint64, uint64, Return)
|
||||
DeviceGetNvLinkVersion(Device, int) (uint32, Return)
|
||||
DeviceGetP2PStatus(Device, Device, GpuP2PCapsIndex) (GpuP2PStatus, Return)
|
||||
DeviceGetPciInfo(Device) (PciInfo, Return)
|
||||
DeviceGetPcieLinkMaxSpeed(Device) (uint32, Return)
|
||||
DeviceGetPcieReplayCounter(Device) (int, Return)
|
||||
DeviceGetPcieSpeed(Device) (int, Return)
|
||||
DeviceGetPcieThroughput(Device, PcieUtilCounter) (uint32, Return)
|
||||
DeviceGetPerformanceState(Device) (Pstates, Return)
|
||||
DeviceGetPersistenceMode(Device) (EnableState, Return)
|
||||
DeviceGetPgpuMetadataString(Device) (string, Return)
|
||||
DeviceGetPowerManagementDefaultLimit(Device) (uint32, Return)
|
||||
DeviceGetPowerManagementLimit(Device) (uint32, Return)
|
||||
DeviceGetPowerManagementLimitConstraints(Device) (uint32, uint32, Return)
|
||||
DeviceGetPowerManagementMode(Device) (EnableState, Return)
|
||||
DeviceGetPowerSource(Device) (PowerSource, Return)
|
||||
DeviceGetPowerState(Device) (Pstates, Return)
|
||||
DeviceGetPowerUsage(Device) (uint32, Return)
|
||||
DeviceGetProcessUtilization(Device, uint64) ([]ProcessUtilizationSample, Return)
|
||||
DeviceGetRemappedRows(Device) (int, int, bool, bool, Return)
|
||||
DeviceGetRetiredPages(Device, PageRetirementCause) ([]uint64, Return)
|
||||
DeviceGetRetiredPagesPendingStatus(Device) (EnableState, Return)
|
||||
DeviceGetRetiredPages_v2(Device, PageRetirementCause) ([]uint64, []uint64, Return)
|
||||
DeviceGetRowRemapperHistogram(Device) (RowRemapperHistogramValues, Return)
|
||||
DeviceGetSamples(Device, SamplingType, uint64) (ValueType, []Sample, Return)
|
||||
DeviceGetSerial(Device) (string, Return)
|
||||
DeviceGetSupportedClocksThrottleReasons(Device) (uint64, Return)
|
||||
DeviceGetSupportedEventTypes(Device) (uint64, Return)
|
||||
DeviceGetSupportedGraphicsClocks(Device, int) (int, uint32, Return)
|
||||
DeviceGetSupportedMemoryClocks(Device) (int, uint32, Return)
|
||||
DeviceGetSupportedPerformanceStates(Device) ([]Pstates, Return)
|
||||
DeviceGetSupportedVgpus(Device) ([]VgpuTypeId, Return)
|
||||
DeviceGetTargetFanSpeed(Device, int) (int, Return)
|
||||
DeviceGetTemperature(Device, TemperatureSensors) (uint32, Return)
|
||||
DeviceGetTemperatureThreshold(Device, TemperatureThresholds) (uint32, Return)
|
||||
DeviceGetThermalSettings(Device, uint32) (GpuThermalSettings, Return)
|
||||
DeviceGetTopologyCommonAncestor(Device, Device) (GpuTopologyLevel, Return)
|
||||
DeviceGetTopologyNearestGpus(Device, GpuTopologyLevel) ([]Device, Return)
|
||||
DeviceGetTotalEccErrors(Device, MemoryErrorType, EccCounterType) (uint64, Return)
|
||||
DeviceGetTotalEnergyConsumption(Device) (uint64, Return)
|
||||
DeviceGetUUID(Device) (string, Return)
|
||||
DeviceGetUtilizationRates(Device) (Utilization, Return)
|
||||
DeviceGetVbiosVersion(Device) (string, Return)
|
||||
DeviceGetVgpuCapabilities(Device, DeviceVgpuCapability) (bool, Return)
|
||||
DeviceGetVgpuMetadata(Device) (VgpuPgpuMetadata, Return)
|
||||
DeviceGetVgpuProcessUtilization(Device, uint64) ([]VgpuProcessUtilizationSample, Return)
|
||||
DeviceGetVgpuSchedulerCapabilities(Device) (VgpuSchedulerCapabilities, Return)
|
||||
DeviceGetVgpuSchedulerLog(Device) (VgpuSchedulerLog, Return)
|
||||
DeviceGetVgpuSchedulerState(Device) (VgpuSchedulerGetState, Return)
|
||||
DeviceGetVgpuUtilization(Device, uint64) (ValueType, []VgpuInstanceUtilizationSample, Return)
|
||||
DeviceGetViolationStatus(Device, PerfPolicyType) (ViolationTime, Return)
|
||||
DeviceGetVirtualizationMode(Device) (GpuVirtualizationMode, Return)
|
||||
DeviceIsMigDeviceHandle(Device) (bool, Return)
|
||||
DeviceModifyDrainState(*PciInfo, EnableState) Return
|
||||
DeviceOnSameBoard(Device, Device) (int, Return)
|
||||
DeviceQueryDrainState(*PciInfo) (EnableState, Return)
|
||||
DeviceRegisterEvents(Device, uint64, EventSet) Return
|
||||
DeviceRemoveGpu(*PciInfo) Return
|
||||
DeviceRemoveGpu_v2(*PciInfo, DetachGpuState, PcieLinkState) Return
|
||||
DeviceResetApplicationsClocks(Device) Return
|
||||
DeviceResetGpuLockedClocks(Device) Return
|
||||
DeviceResetMemoryLockedClocks(Device) Return
|
||||
DeviceResetNvLinkErrorCounters(Device, int) Return
|
||||
DeviceResetNvLinkUtilizationCounter(Device, int, int) Return
|
||||
DeviceSetAPIRestriction(Device, RestrictedAPI, EnableState) Return
|
||||
DeviceSetAccountingMode(Device, EnableState) Return
|
||||
DeviceSetApplicationsClocks(Device, uint32, uint32) Return
|
||||
DeviceSetAutoBoostedClocksEnabled(Device, EnableState) Return
|
||||
DeviceSetComputeMode(Device, ComputeMode) Return
|
||||
DeviceSetCpuAffinity(Device) Return
|
||||
DeviceSetDefaultAutoBoostedClocksEnabled(Device, EnableState, uint32) Return
|
||||
DeviceSetDefaultFanSpeed_v2(Device, int) Return
|
||||
DeviceSetDriverModel(Device, DriverModel, uint32) Return
|
||||
DeviceSetEccMode(Device, EnableState) Return
|
||||
DeviceSetFanControlPolicy(Device, int, FanControlPolicy) Return
|
||||
DeviceSetFanSpeed_v2(Device, int, int) Return
|
||||
DeviceSetGpcClkVfOffset(Device, int) Return
|
||||
DeviceSetGpuLockedClocks(Device, uint32, uint32) Return
|
||||
DeviceSetGpuOperationMode(Device, GpuOperationMode) Return
|
||||
DeviceSetMemClkVfOffset(Device, int) Return
|
||||
DeviceSetMemoryLockedClocks(Device, uint32, uint32) Return
|
||||
DeviceSetMigMode(Device, int) (Return, Return)
|
||||
DeviceSetNvLinkDeviceLowPowerThreshold(Device, *NvLinkPowerThres) Return
|
||||
DeviceSetNvLinkUtilizationControl(Device, int, int, *NvLinkUtilizationControl, bool) Return
|
||||
DeviceSetPersistenceMode(Device, EnableState) Return
|
||||
DeviceSetPowerManagementLimit(Device, uint32) Return
|
||||
DeviceSetTemperatureThreshold(Device, TemperatureThresholds, int) Return
|
||||
DeviceSetVgpuSchedulerState(Device, *VgpuSchedulerSetState) Return
|
||||
DeviceSetVirtualizationMode(Device, GpuVirtualizationMode) Return
|
||||
DeviceValidateInforom(Device) Return
|
||||
ErrorString(Return) string
|
||||
EventSetCreate() (EventSet, Return)
|
||||
EventSetFree(EventSet) Return
|
||||
EventSetWait(EventSet, uint32) (EventData, Return)
|
||||
Extensions() ExtendedInterface
|
||||
GetExcludedDeviceCount() (int, Return)
|
||||
GetExcludedDeviceInfoByIndex(int) (ExcludedDeviceInfo, Return)
|
||||
GetVgpuCompatibility(*VgpuMetadata, *VgpuPgpuMetadata) (VgpuPgpuCompatibility, Return)
|
||||
GetVgpuDriverCapabilities(VgpuDriverCapability) (bool, Return)
|
||||
GetVgpuVersion() (VgpuVersion, VgpuVersion, Return)
|
||||
GpmMetricsGet(*GpmMetricsGetType) Return
|
||||
GpmMetricsGetV(*GpmMetricsGetType) GpmMetricsGetVType
|
||||
GpmMigSampleGet(Device, int, GpmSample) Return
|
||||
GpmQueryDeviceSupport(Device) (GpmSupport, Return)
|
||||
GpmQueryDeviceSupportV(Device) GpmSupportV
|
||||
GpmSampleAlloc() (GpmSample, Return)
|
||||
GpmSampleFree(GpmSample) Return
|
||||
GpmSampleGet(Device, GpmSample) Return
|
||||
GpuInstanceCreateComputeInstance(GpuInstance, *ComputeInstanceProfileInfo) (ComputeInstance, Return)
|
||||
GpuInstanceCreateComputeInstanceWithPlacement(GpuInstance, *ComputeInstanceProfileInfo, *ComputeInstancePlacement) (ComputeInstance, Return)
|
||||
GpuInstanceDestroy(GpuInstance) Return
|
||||
GpuInstanceGetComputeInstanceById(GpuInstance, int) (ComputeInstance, Return)
|
||||
GpuInstanceGetComputeInstancePossiblePlacements(GpuInstance, *ComputeInstanceProfileInfo) ([]ComputeInstancePlacement, Return)
|
||||
GpuInstanceGetComputeInstanceProfileInfo(GpuInstance, int, int) (ComputeInstanceProfileInfo, Return)
|
||||
GpuInstanceGetComputeInstanceProfileInfoV(GpuInstance, int, int) ComputeInstanceProfileInfoV
|
||||
GpuInstanceGetComputeInstanceRemainingCapacity(GpuInstance, *ComputeInstanceProfileInfo) (int, Return)
|
||||
GpuInstanceGetComputeInstances(GpuInstance, *ComputeInstanceProfileInfo) ([]ComputeInstance, Return)
|
||||
GpuInstanceGetInfo(GpuInstance) (GpuInstanceInfo, Return)
|
||||
Init() Return
|
||||
InitWithFlags(uint32) Return
|
||||
SetVgpuVersion(*VgpuVersion) Return
|
||||
Shutdown() Return
|
||||
SystemGetCudaDriverVersion() (int, Return)
|
||||
SystemGetCudaDriverVersion_v2() (int, Return)
|
||||
SystemGetDriverVersion() (string, Return)
|
||||
SystemGetHicVersion() ([]HwbcEntry, Return)
|
||||
SystemGetNVMLVersion() (string, Return)
|
||||
SystemGetProcessName(int) (string, Return)
|
||||
SystemGetTopologyGpuSet(int) ([]Device, Return)
|
||||
UnitGetCount() (int, Return)
|
||||
UnitGetDevices(Unit) ([]Device, Return)
|
||||
UnitGetFanSpeedInfo(Unit) (UnitFanSpeeds, Return)
|
||||
UnitGetHandleByIndex(int) (Unit, Return)
|
||||
UnitGetLedState(Unit) (LedState, Return)
|
||||
UnitGetPsuInfo(Unit) (PSUInfo, Return)
|
||||
UnitGetTemperature(Unit, int) (uint32, Return)
|
||||
UnitGetUnitInfo(Unit) (UnitInfo, Return)
|
||||
UnitSetLedState(Unit, LedColor) Return
|
||||
VgpuInstanceClearAccountingPids(VgpuInstance) Return
|
||||
VgpuInstanceGetAccountingMode(VgpuInstance) (EnableState, Return)
|
||||
VgpuInstanceGetAccountingPids(VgpuInstance) ([]int, Return)
|
||||
VgpuInstanceGetAccountingStats(VgpuInstance, int) (AccountingStats, Return)
|
||||
VgpuInstanceGetEccMode(VgpuInstance) (EnableState, Return)
|
||||
VgpuInstanceGetEncoderCapacity(VgpuInstance) (int, Return)
|
||||
VgpuInstanceGetEncoderSessions(VgpuInstance) (int, EncoderSessionInfo, Return)
|
||||
VgpuInstanceGetEncoderStats(VgpuInstance) (int, uint32, uint32, Return)
|
||||
VgpuInstanceGetFBCSessions(VgpuInstance) (int, FBCSessionInfo, Return)
|
||||
VgpuInstanceGetFBCStats(VgpuInstance) (FBCStats, Return)
|
||||
VgpuInstanceGetFbUsage(VgpuInstance) (uint64, Return)
|
||||
VgpuInstanceGetFrameRateLimit(VgpuInstance) (uint32, Return)
|
||||
VgpuInstanceGetGpuInstanceId(VgpuInstance) (int, Return)
|
||||
VgpuInstanceGetGpuPciId(VgpuInstance) (string, Return)
|
||||
VgpuInstanceGetLicenseInfo(VgpuInstance) (VgpuLicenseInfo, Return)
|
||||
VgpuInstanceGetLicenseStatus(VgpuInstance) (int, Return)
|
||||
VgpuInstanceGetMdevUUID(VgpuInstance) (string, Return)
|
||||
VgpuInstanceGetMetadata(VgpuInstance) (VgpuMetadata, Return)
|
||||
VgpuInstanceGetType(VgpuInstance) (VgpuTypeId, Return)
|
||||
VgpuInstanceGetUUID(VgpuInstance) (string, Return)
|
||||
VgpuInstanceGetVmDriverVersion(VgpuInstance) (string, Return)
|
||||
VgpuInstanceGetVmID(VgpuInstance) (string, VgpuVmIdType, Return)
|
||||
VgpuInstanceSetEncoderCapacity(VgpuInstance, int) Return
|
||||
VgpuTypeGetCapabilities(VgpuTypeId, VgpuCapability) (bool, Return)
|
||||
VgpuTypeGetClass(VgpuTypeId) (string, Return)
|
||||
VgpuTypeGetDeviceID(VgpuTypeId) (uint64, uint64, Return)
|
||||
VgpuTypeGetFrameRateLimit(VgpuTypeId) (uint32, Return)
|
||||
VgpuTypeGetFramebufferSize(VgpuTypeId) (uint64, Return)
|
||||
VgpuTypeGetGpuInstanceProfileId(VgpuTypeId) (uint32, Return)
|
||||
VgpuTypeGetLicense(VgpuTypeId) (string, Return)
|
||||
VgpuTypeGetMaxInstances(Device, VgpuTypeId) (int, Return)
|
||||
VgpuTypeGetMaxInstancesPerVm(VgpuTypeId) (int, Return)
|
||||
VgpuTypeGetName(VgpuTypeId) (string, Return)
|
||||
VgpuTypeGetNumDisplayHeads(VgpuTypeId) (int, Return)
|
||||
VgpuTypeGetResolution(VgpuTypeId, int) (uint32, uint32, Return)
|
||||
}
|
||||
|
||||
// Device represents the interface for the nvmlDevice type.
|
||||
//
|
||||
//go:generate moq -out mock/device.go -pkg mock . Device:Device
|
||||
type Device interface {
|
||||
CcuGetStreamState() (int, Return)
|
||||
CcuSetStreamState(int) Return
|
||||
ClearAccountingPids() Return
|
||||
ClearCpuAffinity() Return
|
||||
ClearEccErrorCounts(EccCounterType) Return
|
||||
ClearFieldValues([]FieldValue) Return
|
||||
CreateGpuInstance(*GpuInstanceProfileInfo) (GpuInstance, Return)
|
||||
CreateGpuInstanceWithPlacement(*GpuInstanceProfileInfo, *GpuInstancePlacement) (GpuInstance, Return)
|
||||
FreezeNvLinkUtilizationCounter(int, int, EnableState) Return
|
||||
GetAPIRestriction(RestrictedAPI) (EnableState, Return)
|
||||
GetAccountingBufferSize() (int, Return)
|
||||
GetAccountingMode() (EnableState, Return)
|
||||
GetAccountingPids() ([]int, Return)
|
||||
GetAccountingStats(uint32) (AccountingStats, Return)
|
||||
GetActiveVgpus() ([]VgpuInstance, Return)
|
||||
GetAdaptiveClockInfoStatus() (uint32, Return)
|
||||
GetApplicationsClock(ClockType) (uint32, Return)
|
||||
GetArchitecture() (DeviceArchitecture, Return)
|
||||
GetAttributes() (DeviceAttributes, Return)
|
||||
GetAutoBoostedClocksEnabled() (EnableState, EnableState, Return)
|
||||
GetBAR1MemoryInfo() (BAR1Memory, Return)
|
||||
GetBoardId() (uint32, Return)
|
||||
GetBoardPartNumber() (string, Return)
|
||||
GetBrand() (BrandType, Return)
|
||||
GetBridgeChipInfo() (BridgeChipHierarchy, Return)
|
||||
GetBusType() (BusType, Return)
|
||||
GetClkMonStatus() (ClkMonStatus, Return)
|
||||
GetClock(ClockType, ClockId) (uint32, Return)
|
||||
GetClockInfo(ClockType) (uint32, Return)
|
||||
GetComputeInstanceId() (int, Return)
|
||||
GetComputeMode() (ComputeMode, Return)
|
||||
GetComputeRunningProcesses() ([]ProcessInfo, Return)
|
||||
GetCpuAffinity(int) ([]uint, Return)
|
||||
GetCpuAffinityWithinScope(int, AffinityScope) ([]uint, Return)
|
||||
GetCreatableVgpus() ([]VgpuTypeId, Return)
|
||||
GetCudaComputeCapability() (int, int, Return)
|
||||
GetCurrPcieLinkGeneration() (int, Return)
|
||||
GetCurrPcieLinkWidth() (int, Return)
|
||||
GetCurrentClocksThrottleReasons() (uint64, Return)
|
||||
GetDecoderUtilization() (uint32, uint32, Return)
|
||||
GetDefaultApplicationsClock(ClockType) (uint32, Return)
|
||||
GetDefaultEccMode() (EnableState, Return)
|
||||
GetDetailedEccErrors(MemoryErrorType, EccCounterType) (EccErrorCounts, Return)
|
||||
GetDeviceHandleFromMigDeviceHandle() (Device, Return)
|
||||
GetDisplayActive() (EnableState, Return)
|
||||
GetDisplayMode() (EnableState, Return)
|
||||
GetDriverModel() (DriverModel, DriverModel, Return)
|
||||
GetDynamicPstatesInfo() (GpuDynamicPstatesInfo, Return)
|
||||
GetEccMode() (EnableState, EnableState, Return)
|
||||
GetEncoderCapacity(EncoderType) (int, Return)
|
||||
GetEncoderSessions() ([]EncoderSessionInfo, Return)
|
||||
GetEncoderStats() (int, uint32, uint32, Return)
|
||||
GetEncoderUtilization() (uint32, uint32, Return)
|
||||
GetEnforcedPowerLimit() (uint32, Return)
|
||||
GetFBCSessions() ([]FBCSessionInfo, Return)
|
||||
GetFBCStats() (FBCStats, Return)
|
||||
GetFanControlPolicy_v2(int) (FanControlPolicy, Return)
|
||||
GetFanSpeed() (uint32, Return)
|
||||
GetFanSpeed_v2(int) (uint32, Return)
|
||||
GetFieldValues([]FieldValue) Return
|
||||
GetGpcClkMinMaxVfOffset() (int, int, Return)
|
||||
GetGpcClkVfOffset() (int, Return)
|
||||
GetGpuFabricInfo() (GpuFabricInfo, Return)
|
||||
GetGpuInstanceById(int) (GpuInstance, Return)
|
||||
GetGpuInstanceId() (int, Return)
|
||||
GetGpuInstancePossiblePlacements(*GpuInstanceProfileInfo) ([]GpuInstancePlacement, Return)
|
||||
GetGpuInstanceProfileInfo(int) (GpuInstanceProfileInfo, Return)
|
||||
GetGpuInstanceProfileInfoV(int) GpuInstanceProfileInfoV
|
||||
GetGpuInstanceRemainingCapacity(*GpuInstanceProfileInfo) (int, Return)
|
||||
GetGpuInstances(*GpuInstanceProfileInfo) ([]GpuInstance, Return)
|
||||
GetGpuMaxPcieLinkGeneration() (int, Return)
|
||||
GetGpuOperationMode() (GpuOperationMode, GpuOperationMode, Return)
|
||||
GetGraphicsRunningProcesses() ([]ProcessInfo, Return)
|
||||
GetGridLicensableFeatures() (GridLicensableFeatures, Return)
|
||||
GetGspFirmwareMode() (bool, bool, Return)
|
||||
GetGspFirmwareVersion() (string, Return)
|
||||
GetHostVgpuMode() (HostVgpuMode, Return)
|
||||
GetIndex() (int, Return)
|
||||
GetInforomConfigurationChecksum() (uint32, Return)
|
||||
GetInforomImageVersion() (string, Return)
|
||||
GetInforomVersion(InforomObject) (string, Return)
|
||||
GetIrqNum() (int, Return)
|
||||
GetMPSComputeRunningProcesses() ([]ProcessInfo, Return)
|
||||
GetMaxClockInfo(ClockType) (uint32, Return)
|
||||
GetMaxCustomerBoostClock(ClockType) (uint32, Return)
|
||||
GetMaxMigDeviceCount() (int, Return)
|
||||
GetMaxPcieLinkGeneration() (int, Return)
|
||||
GetMaxPcieLinkWidth() (int, Return)
|
||||
GetMemClkMinMaxVfOffset() (int, int, Return)
|
||||
GetMemClkVfOffset() (int, Return)
|
||||
GetMemoryAffinity(int, AffinityScope) ([]uint, Return)
|
||||
GetMemoryBusWidth() (uint32, Return)
|
||||
GetMemoryErrorCounter(MemoryErrorType, EccCounterType, MemoryLocation) (uint64, Return)
|
||||
GetMemoryInfo() (Memory, Return)
|
||||
GetMemoryInfo_v2() (Memory_v2, Return)
|
||||
GetMigDeviceHandleByIndex(int) (Device, Return)
|
||||
GetMigMode() (int, int, Return)
|
||||
GetMinMaxClockOfPState(ClockType, Pstates) (uint32, uint32, Return)
|
||||
GetMinMaxFanSpeed() (int, int, Return)
|
||||
GetMinorNumber() (int, Return)
|
||||
GetMultiGpuBoard() (int, Return)
|
||||
GetName() (string, Return)
|
||||
GetNumFans() (int, Return)
|
||||
GetNumGpuCores() (int, Return)
|
||||
GetNvLinkCapability(int, NvLinkCapability) (uint32, Return)
|
||||
GetNvLinkErrorCounter(int, NvLinkErrorCounter) (uint64, Return)
|
||||
GetNvLinkRemoteDeviceType(int) (IntNvLinkDeviceType, Return)
|
||||
GetNvLinkRemotePciInfo(int) (PciInfo, Return)
|
||||
GetNvLinkState(int) (EnableState, Return)
|
||||
GetNvLinkUtilizationControl(int, int) (NvLinkUtilizationControl, Return)
|
||||
GetNvLinkUtilizationCounter(int, int) (uint64, uint64, Return)
|
||||
GetNvLinkVersion(int) (uint32, Return)
|
||||
GetP2PStatus(Device, GpuP2PCapsIndex) (GpuP2PStatus, Return)
|
||||
GetPciInfo() (PciInfo, Return)
|
||||
GetPcieLinkMaxSpeed() (uint32, Return)
|
||||
GetPcieReplayCounter() (int, Return)
|
||||
GetPcieSpeed() (int, Return)
|
||||
GetPcieThroughput(PcieUtilCounter) (uint32, Return)
|
||||
GetPerformanceState() (Pstates, Return)
|
||||
GetPersistenceMode() (EnableState, Return)
|
||||
GetPgpuMetadataString() (string, Return)
|
||||
GetPowerManagementDefaultLimit() (uint32, Return)
|
||||
GetPowerManagementLimit() (uint32, Return)
|
||||
GetPowerManagementLimitConstraints() (uint32, uint32, Return)
|
||||
GetPowerManagementMode() (EnableState, Return)
|
||||
GetPowerSource() (PowerSource, Return)
|
||||
GetPowerState() (Pstates, Return)
|
||||
GetPowerUsage() (uint32, Return)
|
||||
GetProcessUtilization(uint64) ([]ProcessUtilizationSample, Return)
|
||||
GetRemappedRows() (int, int, bool, bool, Return)
|
||||
GetRetiredPages(PageRetirementCause) ([]uint64, Return)
|
||||
GetRetiredPagesPendingStatus() (EnableState, Return)
|
||||
GetRetiredPages_v2(PageRetirementCause) ([]uint64, []uint64, Return)
|
||||
GetRowRemapperHistogram() (RowRemapperHistogramValues, Return)
|
||||
GetSamples(SamplingType, uint64) (ValueType, []Sample, Return)
|
||||
GetSerial() (string, Return)
|
||||
GetSupportedClocksThrottleReasons() (uint64, Return)
|
||||
GetSupportedEventTypes() (uint64, Return)
|
||||
GetSupportedGraphicsClocks(int) (int, uint32, Return)
|
||||
GetSupportedMemoryClocks() (int, uint32, Return)
|
||||
GetSupportedPerformanceStates() ([]Pstates, Return)
|
||||
GetSupportedVgpus() ([]VgpuTypeId, Return)
|
||||
GetTargetFanSpeed(int) (int, Return)
|
||||
GetTemperature(TemperatureSensors) (uint32, Return)
|
||||
GetTemperatureThreshold(TemperatureThresholds) (uint32, Return)
|
||||
GetThermalSettings(uint32) (GpuThermalSettings, Return)
|
||||
GetTopologyCommonAncestor(Device) (GpuTopologyLevel, Return)
|
||||
GetTopologyNearestGpus(GpuTopologyLevel) ([]Device, Return)
|
||||
GetTotalEccErrors(MemoryErrorType, EccCounterType) (uint64, Return)
|
||||
GetTotalEnergyConsumption() (uint64, Return)
|
||||
GetUUID() (string, Return)
|
||||
GetUtilizationRates() (Utilization, Return)
|
||||
GetVbiosVersion() (string, Return)
|
||||
GetVgpuCapabilities(DeviceVgpuCapability) (bool, Return)
|
||||
GetVgpuMetadata() (VgpuPgpuMetadata, Return)
|
||||
GetVgpuProcessUtilization(uint64) ([]VgpuProcessUtilizationSample, Return)
|
||||
GetVgpuSchedulerCapabilities() (VgpuSchedulerCapabilities, Return)
|
||||
GetVgpuSchedulerLog() (VgpuSchedulerLog, Return)
|
||||
GetVgpuSchedulerState() (VgpuSchedulerGetState, Return)
|
||||
GetVgpuUtilization(uint64) (ValueType, []VgpuInstanceUtilizationSample, Return)
|
||||
GetViolationStatus(PerfPolicyType) (ViolationTime, Return)
|
||||
GetVirtualizationMode() (GpuVirtualizationMode, Return)
|
||||
GpmMigSampleGet(int, GpmSample) Return
|
||||
GpmQueryDeviceSupport() (GpmSupport, Return)
|
||||
GpmQueryDeviceSupportV() GpmSupportV
|
||||
GpmSampleGet(GpmSample) Return
|
||||
IsMigDeviceHandle() (bool, Return)
|
||||
OnSameBoard(Device) (int, Return)
|
||||
RegisterEvents(uint64, EventSet) Return
|
||||
ResetApplicationsClocks() Return
|
||||
ResetGpuLockedClocks() Return
|
||||
ResetMemoryLockedClocks() Return
|
||||
ResetNvLinkErrorCounters(int) Return
|
||||
ResetNvLinkUtilizationCounter(int, int) Return
|
||||
SetAPIRestriction(RestrictedAPI, EnableState) Return
|
||||
SetAccountingMode(EnableState) Return
|
||||
SetApplicationsClocks(uint32, uint32) Return
|
||||
SetAutoBoostedClocksEnabled(EnableState) Return
|
||||
SetComputeMode(ComputeMode) Return
|
||||
SetCpuAffinity() Return
|
||||
SetDefaultAutoBoostedClocksEnabled(EnableState, uint32) Return
|
||||
SetDefaultFanSpeed_v2(int) Return
|
||||
SetDriverModel(DriverModel, uint32) Return
|
||||
SetEccMode(EnableState) Return
|
||||
SetFanControlPolicy(int, FanControlPolicy) Return
|
||||
SetFanSpeed_v2(int, int) Return
|
||||
SetGpcClkVfOffset(int) Return
|
||||
SetGpuLockedClocks(uint32, uint32) Return
|
||||
SetGpuOperationMode(GpuOperationMode) Return
|
||||
SetMemClkVfOffset(int) Return
|
||||
SetMemoryLockedClocks(uint32, uint32) Return
|
||||
SetMigMode(int) (Return, Return)
|
||||
SetNvLinkDeviceLowPowerThreshold(*NvLinkPowerThres) Return
|
||||
SetNvLinkUtilizationControl(int, int, *NvLinkUtilizationControl, bool) Return
|
||||
SetPersistenceMode(EnableState) Return
|
||||
SetPowerManagementLimit(uint32) Return
|
||||
SetTemperatureThreshold(TemperatureThresholds, int) Return
|
||||
SetVgpuSchedulerState(*VgpuSchedulerSetState) Return
|
||||
SetVirtualizationMode(GpuVirtualizationMode) Return
|
||||
ValidateInforom() Return
|
||||
VgpuTypeGetMaxInstances(VgpuTypeId) (int, Return)
|
||||
}
|
||||
|
||||
// GpuInstance represents the interface for the nvmlGpuInstance type.
|
||||
//
|
||||
//go:generate moq -out mock/gpuinstance.go -pkg mock . GpuInstance:GpuInstance
|
||||
type GpuInstance interface {
|
||||
CreateComputeInstance(*ComputeInstanceProfileInfo) (ComputeInstance, Return)
|
||||
CreateComputeInstanceWithPlacement(*ComputeInstanceProfileInfo, *ComputeInstancePlacement) (ComputeInstance, Return)
|
||||
Destroy() Return
|
||||
GetComputeInstanceById(int) (ComputeInstance, Return)
|
||||
GetComputeInstancePossiblePlacements(*ComputeInstanceProfileInfo) ([]ComputeInstancePlacement, Return)
|
||||
GetComputeInstanceProfileInfo(int, int) (ComputeInstanceProfileInfo, Return)
|
||||
GetComputeInstanceProfileInfoV(int, int) ComputeInstanceProfileInfoV
|
||||
GetComputeInstanceRemainingCapacity(*ComputeInstanceProfileInfo) (int, Return)
|
||||
GetComputeInstances(*ComputeInstanceProfileInfo) ([]ComputeInstance, Return)
|
||||
GetInfo() (GpuInstanceInfo, Return)
|
||||
}
|
||||
|
||||
// ComputeInstance represents the interface for the nvmlComputeInstance type.
|
||||
//
|
||||
//go:generate moq -out mock/computeinstance.go -pkg mock . ComputeInstance:ComputeInstance
|
||||
type ComputeInstance interface {
|
||||
Destroy() Return
|
||||
GetInfo() (ComputeInstanceInfo, Return)
|
||||
}
|
||||
|
||||
// EventSet represents the interface for the nvmlEventSet type.
|
||||
//
|
||||
//go:generate moq -out mock/eventset.go -pkg mock . EventSet:EventSet
|
||||
type EventSet interface {
|
||||
Free() Return
|
||||
Wait(uint32) (EventData, Return)
|
||||
}
|
||||
|
||||
// GpmSample represents the interface for the nvmlGpmSample type.
|
||||
//
|
||||
//go:generate moq -out mock/gpmsample.go -pkg mock . GpmSample:GpmSample
|
||||
type GpmSample interface {
|
||||
Free() Return
|
||||
Get(Device) Return
|
||||
MigGet(Device, int) Return
|
||||
}
|
||||
|
||||
// Unit represents the interface for the nvmlUnit type.
|
||||
//
|
||||
//go:generate moq -out mock/unit.go -pkg mock . Unit:Unit
|
||||
type Unit interface {
|
||||
GetDevices() ([]Device, Return)
|
||||
GetFanSpeedInfo() (UnitFanSpeeds, Return)
|
||||
GetLedState() (LedState, Return)
|
||||
GetPsuInfo() (PSUInfo, Return)
|
||||
GetTemperature(int) (uint32, Return)
|
||||
GetUnitInfo() (UnitInfo, Return)
|
||||
SetLedState(LedColor) Return
|
||||
}
|
||||
|
||||
// VgpuInstance represents the interface for the nvmlVgpuInstance type.
|
||||
//
|
||||
//go:generate moq -out mock/vgpuinstance.go -pkg mock . VgpuInstance:VgpuInstance
|
||||
type VgpuInstance interface {
|
||||
ClearAccountingPids() Return
|
||||
GetAccountingMode() (EnableState, Return)
|
||||
GetAccountingPids() ([]int, Return)
|
||||
GetAccountingStats(int) (AccountingStats, Return)
|
||||
GetEccMode() (EnableState, Return)
|
||||
GetEncoderCapacity() (int, Return)
|
||||
GetEncoderSessions() (int, EncoderSessionInfo, Return)
|
||||
GetEncoderStats() (int, uint32, uint32, Return)
|
||||
GetFBCSessions() (int, FBCSessionInfo, Return)
|
||||
GetFBCStats() (FBCStats, Return)
|
||||
GetFbUsage() (uint64, Return)
|
||||
GetFrameRateLimit() (uint32, Return)
|
||||
GetGpuInstanceId() (int, Return)
|
||||
GetGpuPciId() (string, Return)
|
||||
GetLicenseInfo() (VgpuLicenseInfo, Return)
|
||||
GetLicenseStatus() (int, Return)
|
||||
GetMdevUUID() (string, Return)
|
||||
GetMetadata() (VgpuMetadata, Return)
|
||||
GetType() (VgpuTypeId, Return)
|
||||
GetUUID() (string, Return)
|
||||
GetVmDriverVersion() (string, Return)
|
||||
GetVmID() (string, VgpuVmIdType, Return)
|
||||
SetEncoderCapacity(int) Return
|
||||
}
|
||||
|
||||
// VgpuTypeId represents the interface for the nvmlVgpuTypeId type.
|
||||
//
|
||||
//go:generate moq -out mock/vgputypeid.go -pkg mock . VgpuTypeId:VgpuTypeId
|
||||
type VgpuTypeId interface {
|
||||
GetCapabilities(VgpuCapability) (bool, Return)
|
||||
GetClass() (string, Return)
|
||||
GetDeviceID() (uint64, uint64, Return)
|
||||
GetFrameRateLimit() (uint32, Return)
|
||||
GetFramebufferSize() (uint64, Return)
|
||||
GetGpuInstanceProfileId() (uint32, Return)
|
||||
GetLicense() (string, Return)
|
||||
GetMaxInstances(Device) (int, Return)
|
||||
GetMaxInstancesPerVm() (int, Return)
|
||||
GetName() (string, Return)
|
||||
GetNumDisplayHeads() (int, Return)
|
||||
GetResolution(int) (uint32, uint32, Return)
|
||||
}
|
||||
6
vendor/modules.txt
vendored
6
vendor/modules.txt
vendored
@@ -1,16 +1,16 @@
|
||||
# github.com/NVIDIA/go-nvlib v0.2.0
|
||||
# github.com/NVIDIA/go-nvlib v0.3.0
|
||||
## explicit; go 1.20
|
||||
github.com/NVIDIA/go-nvlib/pkg/nvlib/device
|
||||
github.com/NVIDIA/go-nvlib/pkg/nvlib/info
|
||||
github.com/NVIDIA/go-nvlib/pkg/nvml
|
||||
github.com/NVIDIA/go-nvlib/pkg/nvpci
|
||||
github.com/NVIDIA/go-nvlib/pkg/nvpci/bytes
|
||||
github.com/NVIDIA/go-nvlib/pkg/nvpci/mmio
|
||||
github.com/NVIDIA/go-nvlib/pkg/pciids
|
||||
# github.com/NVIDIA/go-nvml v0.12.0-3
|
||||
# github.com/NVIDIA/go-nvml v0.12.0-4
|
||||
## explicit; go 1.20
|
||||
github.com/NVIDIA/go-nvml/pkg/dl
|
||||
github.com/NVIDIA/go-nvml/pkg/nvml
|
||||
github.com/NVIDIA/go-nvml/pkg/nvml/mock
|
||||
# github.com/cpuguy83/go-md2man/v2 v2.0.2
|
||||
## explicit; go 1.11
|
||||
github.com/cpuguy83/go-md2man/v2/md2man
|
||||
|
||||
Reference in New Issue
Block a user