From 44a74e0a4b6fa6150c8ddfacf8f52f67e5ca60ef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 28 Sep 2025 09:03:40 +0000 Subject: [PATCH] Bump github.com/NVIDIA/go-nvlib from 0.7.3 to 0.8.1 Bumps [github.com/NVIDIA/go-nvlib](https://github.com/NVIDIA/go-nvlib) from 0.7.3 to 0.8.1. - [Release notes](https://github.com/NVIDIA/go-nvlib/releases) - [Commits](https://github.com/NVIDIA/go-nvlib/compare/v0.7.3...v0.8.1) --- updated-dependencies: - dependency-name: github.com/NVIDIA/go-nvlib dependency-version: 0.8.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 6 +- go.sum | 12 +- .../go-nvlib/pkg/nvlib/device/device.go | 24 +- .../go-nvlib/pkg/nvlib/device/mig_profile.go | 104 +- .../NVIDIA/go-nvml/pkg/nvml/const.go | 67 +- .../NVIDIA/go-nvml/pkg/nvml/device.go | 214 +++- .../NVIDIA/go-nvml/pkg/nvml/mock/device.go | 334 +++++- .../NVIDIA/go-nvml/pkg/nvml/mock/interface.go | 392 ++++++- .../NVIDIA/go-nvml/pkg/nvml/nvml.go | 100 +- .../github.com/NVIDIA/go-nvml/pkg/nvml/nvml.h | 958 ++++++++++++------ .../NVIDIA/go-nvml/pkg/nvml/types_gen.go | 227 +++-- .../NVIDIA/go-nvml/pkg/nvml/vgpu.go | 2 + .../go-nvml/pkg/nvml/zz_generated.api.go | 28 +- .../testify/assert/assertion_compare.go | 22 +- .../testify/assert/assertion_format.go | 51 +- .../testify/assert/assertion_forward.go | 102 +- .../testify/assert/assertion_order.go | 2 +- .../stretchr/testify/assert/assertions.go | 367 ++++--- .../github.com/stretchr/testify/assert/doc.go | 4 + .../testify/assert/http_assertions.go | 4 +- .../testify/assert/yaml/yaml_custom.go | 1 - .../testify/assert/yaml/yaml_default.go | 1 - .../stretchr/testify/assert/yaml/yaml_fail.go | 1 - .../stretchr/testify/require/doc.go | 2 + .../stretchr/testify/require/require.go | 108 +- .../testify/require/require_forward.go | 102 +- vendor/modules.txt | 6 +- 27 files changed, 2533 insertions(+), 708 deletions(-) diff --git a/go.mod b/go.mod index 845a90c..d15362c 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,9 @@ module github.com/NVIDIA/go-gpuallocator go 1.20 require ( - github.com/NVIDIA/go-nvlib v0.7.3 - github.com/NVIDIA/go-nvml v0.12.9-0 - github.com/stretchr/testify v1.10.0 + github.com/NVIDIA/go-nvlib v0.8.1 + github.com/NVIDIA/go-nvml v0.13.0-1 + github.com/stretchr/testify v1.11.1 ) require ( diff --git a/go.sum b/go.sum index f0e9e1d..85fa665 100644 --- a/go.sum +++ b/go.sum @@ -1,15 +1,15 @@ -github.com/NVIDIA/go-nvlib v0.7.3 h1:kXc8PkWUlrwedSpM4fR8xT/DAq1NKy8HqhpgteFcGAw= -github.com/NVIDIA/go-nvlib v0.7.3/go.mod h1:i95Je7GinMy/+BDs++DAdbPmT2TubjNP8i8joC7DD7I= -github.com/NVIDIA/go-nvml v0.12.9-0 h1:e344UK8ZkeMeeLkdQtRhmXRxNf+u532LDZPGMtkdus0= -github.com/NVIDIA/go-nvml v0.12.9-0/go.mod h1:+KNA7c7gIBH7SKSJ1ntlwkfN80zdx8ovl4hrK3LmPt4= +github.com/NVIDIA/go-nvlib v0.8.1 h1:OPEHVvn3zcV5OXB68A7WRpeCnYMRSPl7LdeJH/d3gZI= +github.com/NVIDIA/go-nvlib v0.8.1/go.mod h1:7mzx9FSdO9fXWP9NKuZmWkCwhkEcSWQFe2tmFwtLb9c= +github.com/NVIDIA/go-nvml v0.13.0-1 h1:OLX8Jq3dONuPOQPC7rndB6+iDmDakw0XTYgzMxObkEw= +github.com/NVIDIA/go-nvml v0.13.0-1/go.mod h1:+KNA7c7gIBH7SKSJ1ntlwkfN80zdx8ovl4hrK3LmPt4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= -github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/device.go b/vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/device.go index f00d1ac..e2089f7 100644 --- a/vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/device.go +++ b/vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/device.go @@ -32,6 +32,7 @@ type Device interface { GetMigDevices() ([]MigDevice, error) GetMigProfiles() ([]MigProfile, error) GetPCIBusID() (string, error) + IsCoherent() (bool, error) IsFabricAttached() (bool, error) IsMigCapable() (bool, error) IsMigEnabled() (bool, error) @@ -91,8 +92,6 @@ func (d *device) GetArchitectureAsString() (string, error) { return "Hopper", nil case nvml.DEVICE_ARCH_BLACKWELL: return "Blackwell", nil - case nvml.DEVICE_ARCH_T23X: - return "Orin", nil case nvml.DEVICE_ARCH_UNKNOWN: return "Unknown", nil } @@ -179,6 +178,27 @@ func (d *device) GetCudaComputeCapabilityAsString() (string, error) { return fmt.Sprintf("%d.%d", major, minor), nil } +// IsCoherent returns whether the device is capable of coherent access to system +// memory. +func (d *device) IsCoherent() (bool, error) { + if !d.lib.hasSymbol("nvmlDeviceGetAddressingMode") { + return false, nil + } + + mode, ret := nvml.Device(d).GetAddressingMode() + if ret == nvml.ERROR_NOT_SUPPORTED { + return false, nil + } + if ret != nvml.SUCCESS { + return false, fmt.Errorf("error getting addressing mode: %v", ret) + } + + if nvml.DeviceAddressingModeType(mode.Value) == nvml.DEVICE_ADDRESSING_MODE_ATS { + return true, nil + } + return false, nil +} + // 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") { diff --git a/vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/mig_profile.go b/vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/mig_profile.go index c1f0190..6ab94ad 100644 --- a/vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/mig_profile.go +++ b/vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/mig_profile.go @@ -28,7 +28,9 @@ import ( const ( // AttributeMediaExtensions holds the string representation for the media extension MIG profile attribute. - AttributeMediaExtensions = "me" + AttributeMediaExtensions = "me" + AttributeMediaExtensionsAll = "me.all" + AttributeGraphics = "gfx" ) // MigProfile represents a specific MIG profile. @@ -46,6 +48,7 @@ type MigProfileInfo struct { G int GB int Attributes []string + NegAttributes []string GIProfileID int CIProfileID int CIEngProfileID int @@ -59,14 +62,21 @@ func (d *devicelib) NewMigProfile(giProfileID, ciProfileID, ciEngProfileID int, switch giProfileID { case nvml.GPU_INSTANCE_PROFILE_1_SLICE, nvml.GPU_INSTANCE_PROFILE_1_SLICE_REV1, - nvml.GPU_INSTANCE_PROFILE_1_SLICE_REV2: + nvml.GPU_INSTANCE_PROFILE_1_SLICE_REV2, + nvml.GPU_INSTANCE_PROFILE_1_SLICE_GFX, + nvml.GPU_INSTANCE_PROFILE_1_SLICE_NO_ME, + nvml.GPU_INSTANCE_PROFILE_1_SLICE_ALL_ME: giSlices = 1 case nvml.GPU_INSTANCE_PROFILE_2_SLICE, - nvml.GPU_INSTANCE_PROFILE_2_SLICE_REV1: + nvml.GPU_INSTANCE_PROFILE_2_SLICE_REV1, + nvml.GPU_INSTANCE_PROFILE_2_SLICE_GFX, + nvml.GPU_INSTANCE_PROFILE_2_SLICE_NO_ME, + nvml.GPU_INSTANCE_PROFILE_2_SLICE_ALL_ME: giSlices = 2 case nvml.GPU_INSTANCE_PROFILE_3_SLICE: giSlices = 3 - case nvml.GPU_INSTANCE_PROFILE_4_SLICE: + case nvml.GPU_INSTANCE_PROFILE_4_SLICE, + nvml.GPU_INSTANCE_PROFILE_4_SLICE_GFX: giSlices = 4 case nvml.GPU_INSTANCE_PROFILE_6_SLICE: giSlices = 6 @@ -104,6 +114,19 @@ func (d *devicelib) NewMigProfile(giProfileID, ciProfileID, ciEngProfileID int, case nvml.GPU_INSTANCE_PROFILE_1_SLICE_REV1, nvml.GPU_INSTANCE_PROFILE_2_SLICE_REV1: attrs = append(attrs, AttributeMediaExtensions) + case nvml.GPU_INSTANCE_PROFILE_1_SLICE_ALL_ME, + nvml.GPU_INSTANCE_PROFILE_2_SLICE_ALL_ME: + attrs = append(attrs, AttributeMediaExtensionsAll) + case nvml.GPU_INSTANCE_PROFILE_1_SLICE_GFX, + nvml.GPU_INSTANCE_PROFILE_2_SLICE_GFX, + nvml.GPU_INSTANCE_PROFILE_4_SLICE_GFX: + attrs = append(attrs, AttributeGraphics) + } + var negAttrs []string + switch giProfileID { + case nvml.GPU_INSTANCE_PROFILE_1_SLICE_NO_ME, + nvml.GPU_INSTANCE_PROFILE_2_SLICE_NO_ME: + negAttrs = append(negAttrs, AttributeMediaExtensions) } p := &MigProfileInfo{ @@ -111,6 +134,7 @@ func (d *devicelib) NewMigProfile(giProfileID, ciProfileID, ciEngProfileID int, G: giSlices, GB: int(getMigMemorySizeGB(deviceMemorySizeBytes, migMemorySizeMB)), Attributes: attrs, + NegAttributes: negAttrs, GIProfileID: giProfileID, CIProfileID: ciProfileID, CIEngProfileID: ciEngProfileID, @@ -121,7 +145,7 @@ func (d *devicelib) NewMigProfile(giProfileID, ciProfileID, ciEngProfileID int, // 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) + _, err := parseMigProfile(profile) return err } @@ -147,6 +171,9 @@ func (p MigProfileInfo) String() string { if len(p.Attributes) > 0 { suffix = "+" + strings.Join(p.Attributes, ",") } + if len(p.NegAttributes) > 0 { + suffix = "-" + strings.Join(p.NegAttributes, ",") + } if p.C == p.G { return fmt.Sprintf("%dg.%dgb%s", p.G, p.GB, suffix) } @@ -184,59 +211,89 @@ func (p MigProfileInfo) Equals(other MigProfile) bool { // Matches checks if a MigProfile matches the string passed in. func (p MigProfileInfo) Matches(profile string) bool { - c, g, gb, attrs, err := parseMigProfile(profile) + migProfileInfo, err := parseMigProfile(profile) if err != nil { return false } - if c != p.C { + if migProfileInfo.C != p.C { + return false + } + if migProfileInfo.G != p.G { return false } - if g != p.G { + if migProfileInfo.GB != p.GB { return false } - if gb != p.GB { + if !matchAttributes(migProfileInfo.Attributes, p.Attributes) { return false } - if len(attrs) != len(p.Attributes) { + if !matchAttributes(migProfileInfo.NegAttributes, p.NegAttributes) { return false } - sort.Strings(attrs) - sort.Strings(p.Attributes) - for i, a := range p.Attributes { - if a != attrs[i] { + return true +} + +func matchAttributes(attrs1, attrs2 []string) bool { + if len(attrs1) != len(attrs2) { + return false + } + sort.Strings(attrs1) + sort.Strings(attrs2) + for i, a := range attrs2 { + if a != attrs1[i] { return false } } return true } -func parseMigProfile(profile string) (int, int, int, []string, error) { +func parseMigProfile(profile string) (*MigProfileInfo, error) { // 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") + return 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) + negsplit := strings.SplitN(profile, "-", 2) + // Make sure we don't get both positive and negative attributes. + if len(split) == 2 && len(negsplit) == 2 { + return nil, fmt.Errorf("profile '%v' contains both '+/-' attributes", profile) + } + + if len(split) == 1 { + split = negsplit + } // 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) + return nil, fmt.Errorf("cannot parse fields of '%v': %v", profile, err) } + migProfileInfo := &MigProfileInfo{ + C: c, + G: g, + GB: gb, + } // If we have no attributes we are done. if len(split) == 1 { - return c, g, gb, nil, nil + return migProfileInfo, nil } // 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) + return nil, fmt.Errorf("cannot parse attributes of '%v': %v", profile, err) + } + + if len(negsplit) == 2 { + migProfileInfo.NegAttributes = attrs + return migProfileInfo, nil } - return c, g, gb, attrs, nil + migProfileInfo.Attributes = attrs + return migProfileInfo, nil } func parseMigProfileField(s string, field string) (int, error) { @@ -310,8 +367,11 @@ func parseMigProfileAttributes(s string) ([]string, error) { if a[0] >= '0' && a[0] <= '9' { return nil, fmt.Errorf("attribute begins with a number") } + if a[0] == '.' || a[len(a)-1] == '.' { + return nil, fmt.Errorf("attribute begins/ends with a dot") + } for _, c := range a { - if (c < 'a' || c > 'z') && (c < 'A' || c > 'Z') && (c < '0' || c > '9') { + if (c < 'a' || c > 'z') && (c < 'A' || c > 'Z') && (c < '0' || c > '9') && c != '.' { return nil, fmt.Errorf("non alpha-numeric character or digit in attribute") } } diff --git a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/const.go b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/const.go index 09e82fc..8a6a93c 100644 --- a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/const.go +++ b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/const.go @@ -31,9 +31,9 @@ const ( // NO_UNVERSIONED_FUNC_DEFS as defined in go-nvml/:24 NO_UNVERSIONED_FUNC_DEFS = 1 // API_VERSION as defined in nvml/nvml.h - API_VERSION = 12 + API_VERSION = 13 // API_VERSION_STR as defined in nvml/nvml.h - API_VERSION_STR = "12" + API_VERSION_STR = "13" // VALUE_NOT_AVAILABLE as defined in nvml/nvml.h VALUE_NOT_AVAILABLE = -1 // DEVICE_PCI_BUS_ID_BUFFER_SIZE as defined in nvml/nvml.h @@ -68,6 +68,14 @@ const ( MAX_GPU_PERF_PSTATES = 16 // PERF_MODES_BUFFER_SIZE as defined in nvml/nvml.h PERF_MODES_BUFFER_SIZE = 2048 + // POWER_MIZER_MODE_ADAPTIVE as defined in nvml/nvml.h + POWER_MIZER_MODE_ADAPTIVE = 0 + // POWER_MIZER_MODE_PREFER_MAXIMUM_PERFORMANCE as defined in nvml/nvml.h + POWER_MIZER_MODE_PREFER_MAXIMUM_PERFORMANCE = 1 + // POWER_MIZER_MODE_AUTO as defined in nvml/nvml.h + POWER_MIZER_MODE_AUTO = 2 + // POWER_MIZER_MODE_PREFER_CONSISTENT_PERFORMANCE as defined in nvml/nvml.h + POWER_MIZER_MODE_PREFER_CONSISTENT_PERFORMANCE = 3 // GSP_FIRMWARE_VERSION_BUF_SIZE as defined in nvml/nvml.h GSP_FIRMWARE_VERSION_BUF_SIZE = 64 // DEVICE_ARCH_KEPLER as defined in nvml/nvml.h @@ -88,8 +96,6 @@ const ( DEVICE_ARCH_HOPPER = 9 // DEVICE_ARCH_BLACKWELL as defined in nvml/nvml.h DEVICE_ARCH_BLACKWELL = 10 - // DEVICE_ARCH_T23X as defined in nvml/nvml.h - DEVICE_ARCH_T23X = 11 // DEVICE_ARCH_UNKNOWN as defined in nvml/nvml.h DEVICE_ARCH_UNKNOWN = 4294967295 // BUS_TYPE_UNKNOWN as defined in nvml/nvml.h @@ -900,6 +906,8 @@ const ( CC_SYSTEM_MULTIGPU_NONE = 0 // CC_SYSTEM_MULTIGPU_PROTECTED_PCIE as defined in nvml/nvml.h CC_SYSTEM_MULTIGPU_PROTECTED_PCIE = 1 + // CC_SYSTEM_MULTIGPU_NVLE as defined in nvml/nvml.h + CC_SYSTEM_MULTIGPU_NVLE = 2 // CC_ACCEPTING_CLIENT_REQUESTS_FALSE as defined in nvml/nvml.h CC_ACCEPTING_CLIENT_REQUESTS_FALSE = 0 // CC_ACCEPTING_CLIENT_REQUESTS_TRUE as defined in nvml/nvml.h @@ -972,6 +980,30 @@ const ( GPU_FABRIC_HEALTH_MASK_SHIFT_ACCESS_TIMEOUT_RECOVERY = 6 // GPU_FABRIC_HEALTH_MASK_WIDTH_ACCESS_TIMEOUT_RECOVERY as defined in nvml/nvml.h GPU_FABRIC_HEALTH_MASK_WIDTH_ACCESS_TIMEOUT_RECOVERY = 3 + // GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_NOT_SUPPORTED as defined in nvml/nvml.h + GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_NOT_SUPPORTED = 0 + // GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_NONE as defined in nvml/nvml.h + GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_NONE = 1 + // GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_INCORRECT_SYSGUID as defined in nvml/nvml.h + GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_INCORRECT_SYSGUID = 2 + // GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_INCORRECT_CHASSIS_SN as defined in nvml/nvml.h + GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_INCORRECT_CHASSIS_SN = 3 + // GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_NO_PARTITION as defined in nvml/nvml.h + GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_NO_PARTITION = 4 + // GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_INSUFFICIENT_NVLINKS as defined in nvml/nvml.h + GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_INSUFFICIENT_NVLINKS = 5 + // GPU_FABRIC_HEALTH_MASK_SHIFT_INCORRECT_CONFIGURATION as defined in nvml/nvml.h + GPU_FABRIC_HEALTH_MASK_SHIFT_INCORRECT_CONFIGURATION = 8 + // GPU_FABRIC_HEALTH_MASK_WIDTH_INCORRECT_CONFIGURATION as defined in nvml/nvml.h + GPU_FABRIC_HEALTH_MASK_WIDTH_INCORRECT_CONFIGURATION = 15 + // GPU_FABRIC_HEALTH_SUMMARY_NOT_SUPPORTED as defined in nvml/nvml.h + GPU_FABRIC_HEALTH_SUMMARY_NOT_SUPPORTED = 0 + // GPU_FABRIC_HEALTH_SUMMARY_HEALTHY as defined in nvml/nvml.h + GPU_FABRIC_HEALTH_SUMMARY_HEALTHY = 1 + // GPU_FABRIC_HEALTH_SUMMARY_UNHEALTHY as defined in nvml/nvml.h + GPU_FABRIC_HEALTH_SUMMARY_UNHEALTHY = 2 + // GPU_FABRIC_HEALTH_SUMMARY_LIMITED_CAPACITY as defined in nvml/nvml.h + GPU_FABRIC_HEALTH_SUMMARY_LIMITED_CAPACITY = 3 // INIT_FLAG_NO_GPUS as defined in nvml/nvml.h INIT_FLAG_NO_GPUS = 1 // INIT_FLAG_NO_ATTACH as defined in nvml/nvml.h @@ -1016,6 +1048,20 @@ const ( NVLINK_STATE_SLEEP = 2 // NVLINK_TOTAL_SUPPORTED_BW_MODES as defined in nvml/nvml.h NVLINK_TOTAL_SUPPORTED_BW_MODES = 23 + // NVLINK_FIRMWARE_UCODE_TYPE_MSE as defined in nvml/nvml.h + NVLINK_FIRMWARE_UCODE_TYPE_MSE = 1 + // NVLINK_FIRMWARE_UCODE_TYPE_NETIR as defined in nvml/nvml.h + NVLINK_FIRMWARE_UCODE_TYPE_NETIR = 2 + // NVLINK_FIRMWARE_UCODE_TYPE_NETIR_UPHY as defined in nvml/nvml.h + NVLINK_FIRMWARE_UCODE_TYPE_NETIR_UPHY = 3 + // NVLINK_FIRMWARE_UCODE_TYPE_NETIR_CLN as defined in nvml/nvml.h + NVLINK_FIRMWARE_UCODE_TYPE_NETIR_CLN = 4 + // NVLINK_FIRMWARE_UCODE_TYPE_NETIR_DLN as defined in nvml/nvml.h + NVLINK_FIRMWARE_UCODE_TYPE_NETIR_DLN = 5 + // NVLINK_FIRMWARE_VERSION_LENGTH as defined in nvml/nvml.h + NVLINK_FIRMWARE_VERSION_LENGTH = 100 + // PRM_DATA_MAX_SIZE as defined in nvml/nvml.h + PRM_DATA_MAX_SIZE = 496 // DEVICE_MIG_DISABLE as defined in nvml/nvml.h DEVICE_MIG_DISABLE = 0 // DEVICE_MIG_ENABLE as defined in nvml/nvml.h @@ -1341,7 +1387,7 @@ const ( BRAND_NVIDIA BrandType = 14 BRAND_GEFORCE_RTX BrandType = 15 BRAND_TITAN_RTX BrandType = 16 - BRAND_COUNT BrandType = 17 + BRAND_COUNT BrandType = 18 ) // TemperatureThresholds as declared in nvml/nvml.h @@ -1531,6 +1577,7 @@ const ( ERROR_NOT_READY Return = 27 ERROR_GPU_NOT_FOUND Return = 28 ERROR_INVALID_STATE Return = 29 + ERROR_RESET_TYPE_NOT_SUPPORTED Return = 30 ERROR_UNKNOWN Return = 999 ) @@ -1769,6 +1816,16 @@ const ( VGPU_COMPATIBILITY_LIMIT_OTHER VgpuPgpuCompatibilityLimitCode = -2147483648 ) +// DeviceAddressingModeType as declared in nvml/nvml.h +type DeviceAddressingModeType int32 + +// DeviceAddressingModeType enumeration from nvml/nvml.h +const ( + DEVICE_ADDRESSING_MODE_NONE DeviceAddressingModeType = iota + DEVICE_ADDRESSING_MODE_HMM DeviceAddressingModeType = 1 + DEVICE_ADDRESSING_MODE_ATS DeviceAddressingModeType = 2 +) + // ThermalTarget as declared in nvml/nvml.h type ThermalTarget int32 diff --git a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/device.go b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/device.go index 4784cd4..d341e15 100644 --- a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/device.go +++ b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/device.go @@ -113,6 +113,8 @@ func (l *library) DeviceGetHandleByIndex(index int) (Device, Return) { } // nvml.DeviceGetHandleBySerial() +// +// Deprecated: Use DeviceGetHandleByUUID instead. func (l *library) DeviceGetHandleBySerial(serial string) (Device, Return) { var device nvmlDevice ret := nvmlDeviceGetHandleBySerial(serial+string(rune(0)), &device) @@ -490,10 +492,13 @@ func (device nvmlDevice) GetMaxClockInfo(clockType ClockType) (uint32, Return) { } // nvml.DeviceGetApplicationsClock() +// +// Deprecated: Applications clocks are deprecated and will be removed in CUDA 14.0. func (l *library) DeviceGetApplicationsClock(device Device, clockType ClockType) (uint32, Return) { return device.GetApplicationsClock(clockType) } +// Deprecated: Applications clocks are deprecated and will be removed in CUDA 14.0. func (device nvmlDevice) GetApplicationsClock(clockType ClockType) (uint32, Return) { var clockMHz uint32 ret := nvmlDeviceGetApplicationsClock(device, clockType, &clockMHz) @@ -501,10 +506,13 @@ func (device nvmlDevice) GetApplicationsClock(clockType ClockType) (uint32, Retu } // nvml.DeviceGetDefaultApplicationsClock() +// +// Deprecated: Applications clocks are deprecated and will be removed in CUDA 14.0. func (l *library) DeviceGetDefaultApplicationsClock(device Device, clockType ClockType) (uint32, Return) { return device.GetDefaultApplicationsClock(clockType) } +// Deprecated: Applications clocks are deprecated and will be removed in CUDA 14.0. func (device nvmlDevice) GetDefaultApplicationsClock(clockType ClockType) (uint32, Return) { var clockMHz uint32 ret := nvmlDeviceGetDefaultApplicationsClock(device, clockType, &clockMHz) @@ -512,10 +520,13 @@ func (device nvmlDevice) GetDefaultApplicationsClock(clockType ClockType) (uint3 } // nvml.DeviceResetApplicationsClocks() +// +// Deprecated: Use DeviceResetMemoryLockedClocks for Memory Clocks and DeviceResetGpuLockedClocks for Graphics Clocks instead func (l *library) DeviceResetApplicationsClocks(device Device) Return { return device.ResetApplicationsClocks() } +// Deprecated: Use DeviceResetMemoryLockedClocks for Memory Clocks and DeviceResetGpuLockedClocks for Graphics Clocks instead func (device nvmlDevice) ResetApplicationsClocks() Return { return nvmlDeviceResetApplicationsClocks(device) } @@ -627,10 +638,13 @@ func (device nvmlDevice) GetNumFans() (int, Return) { } // nvml.DeviceGetTemperature() +// +// Deprecated: Use DeviceGetTemperatureV instead. func (l *library) DeviceGetTemperature(device Device, sensorType TemperatureSensors) (uint32, Return) { return device.GetTemperature(sensorType) } +// Deprecated: Use DeviceGetTemperatureV instead. func (device nvmlDevice) GetTemperature(sensorType TemperatureSensors) (uint32, Return) { var temp uint32 ret := nvmlDeviceGetTemperature(device, sensorType, &temp) @@ -671,10 +685,13 @@ func (device nvmlDevice) GetPerformanceState() (Pstates, Return) { } // nvml.DeviceGetCurrentClocksThrottleReasons() +// +// Deprecated: Use DeviceGetCurrentClocksEventReasons instead func (l *library) DeviceGetCurrentClocksThrottleReasons(device Device) (uint64, Return) { return device.GetCurrentClocksThrottleReasons() } +// Deprecated: Use DeviceGetCurrentClocksEventReasons instead func (device nvmlDevice) GetCurrentClocksThrottleReasons() (uint64, Return) { var clocksThrottleReasons uint64 ret := nvmlDeviceGetCurrentClocksThrottleReasons(device, &clocksThrottleReasons) @@ -682,10 +699,13 @@ func (device nvmlDevice) GetCurrentClocksThrottleReasons() (uint64, Return) { } // nvml.DeviceGetSupportedClocksThrottleReasons() +// +// Deprecated: Use DeviceGetSupportedClocksEventReasons instead func (l *library) DeviceGetSupportedClocksThrottleReasons(device Device) (uint64, Return) { return device.GetSupportedClocksThrottleReasons() } +// Deprecated: Use DeviceGetSupportedClocksEventReasons instead func (device nvmlDevice) GetSupportedClocksThrottleReasons() (uint64, Return) { var supportedClocksThrottleReasons uint64 ret := nvmlDeviceGetSupportedClocksThrottleReasons(device, &supportedClocksThrottleReasons) @@ -693,10 +713,13 @@ func (device nvmlDevice) GetSupportedClocksThrottleReasons() (uint64, Return) { } // nvml.DeviceGetPowerState() +// +// Deprecated: Use DeviceGetPerformanceState instead func (l *library) DeviceGetPowerState(device Device) (Pstates, Return) { return device.GetPowerState() } +// Deprecated: Use DeviceGetPerformanceState instead func (device nvmlDevice) GetPowerState() (Pstates, Return) { var pState Pstates ret := nvmlDeviceGetPowerState(device, &pState) @@ -704,10 +727,13 @@ func (device nvmlDevice) GetPowerState() (Pstates, Return) { } // nvml.DeviceGetPowerManagementMode() +// +// Deprecated: This will be removed in a future version func (l *library) DeviceGetPowerManagementMode(device Device) (EnableState, Return) { return device.GetPowerManagementMode() } +// Deprecated: This will be removed in a future version func (device nvmlDevice) GetPowerManagementMode() (EnableState, Return) { var mode EnableState ret := nvmlDeviceGetPowerManagementMode(device, &mode) @@ -758,6 +784,16 @@ func (device nvmlDevice) GetPowerUsage() (uint32, Return) { return power, ret } +func (l *library) DeviceGetPowerMizerMode_v1(device Device) (DevicePowerMizerModes_v1, Return) { + return device.GetPowerMizerMode_v1() +} + +func (device nvmlDevice) GetPowerMizerMode_v1() (DevicePowerMizerModes_v1, Return) { + var devicePowerMizerModes DevicePowerMizerModes_v1 + ret := nvmlDeviceGetPowerMizerMode_v1(device, &devicePowerMizerModes) + return devicePowerMizerModes, ret +} + // nvml.DeviceGetTotalEnergyConsumption() func (l *library) DeviceGetTotalEnergyConsumption(device Device) (uint64, Return) { return device.GetTotalEnergyConsumption() @@ -881,10 +917,13 @@ func (device nvmlDevice) GetTotalEccErrors(errorType MemoryErrorType, counterTyp } // nvml.DeviceGetDetailedEccErrors() +// +// Deprecated: See DeviceGetMemoryErrorCounter func (l *library) DeviceGetDetailedEccErrors(device Device, errorType MemoryErrorType, counterType EccCounterType) (EccErrorCounts, Return) { return device.GetDetailedEccErrors(errorType, counterType) } +// Deprecated: See DeviceGetMemoryErrorCounter func (device nvmlDevice) GetDetailedEccErrors(errorType MemoryErrorType, counterType EccCounterType) (EccErrorCounts, Return) { var eccCounts EccErrorCounts ret := nvmlDeviceGetDetailedEccErrors(device, errorType, counterType, &eccCounts) @@ -1257,10 +1296,13 @@ func (device nvmlDevice) GetBAR1MemoryInfo() (BAR1Memory, Return) { } // nvml.DeviceGetViolationStatus() +// +// Deprecated: Use DeviceGetFieldValues instead. func (l *library) DeviceGetViolationStatus(device Device, perfPolicyType PerfPolicyType) (ViolationTime, Return) { return device.GetViolationStatus(perfPolicyType) } +// Deprecated: Use DeviceGetFieldValues instead. func (device nvmlDevice) GetViolationStatus(perfPolicyType PerfPolicyType) (ViolationTime, Return) { var violTime ViolationTime ret := nvmlDeviceGetViolationStatus(device, perfPolicyType, &violTime) @@ -1344,6 +1386,17 @@ func (device nvmlDevice) GetAccountingMode() (EnableState, Return) { return mode, ret } +func (l *library) DeviceGetPdi(device Device) (Pdi, Return) { + return device.GetPdi() +} + +func (device nvmlDevice) GetPdi() (Pdi, Return) { + var pdi Pdi + pdi.Version = STRUCT_VERSION(pdi, 1) + ret := nvmlDeviceGetPdi(device, &pdi) + return pdi, ret +} + // nvml.DeviceGetAccountingStats() func (l *library) DeviceGetAccountingStats(device Device, pid uint32) (AccountingStats, Return) { return device.GetAccountingStats(pid) @@ -1531,10 +1584,13 @@ func (device nvmlDevice) GetClkMonStatus() (ClkMonStatus, Return) { } // nvml.DeviceSetApplicationsClocks() +// +// Deprecated: Use DeviceSetMemoryLockedClocks for Memory Clocks and DeviceSetGpuLockedClocks for Graphics Clocks instead func (l *library) DeviceSetApplicationsClocks(device Device, memClockMHz uint32, graphicsClockMHz uint32) Return { return device.SetApplicationsClocks(memClockMHz, graphicsClockMHz) } +// Deprecated: Use DeviceSetMemoryLockedClocks for Memory Clocks and DeviceSetGpuLockedClocks for Graphics Clocks instead func (device nvmlDevice) SetApplicationsClocks(memClockMHz uint32, graphicsClockMHz uint32) Return { return nvmlDeviceSetApplicationsClocks(device, memClockMHz, graphicsClockMHz) } @@ -1548,6 +1604,15 @@ func (device nvmlDevice) SetPowerManagementLimit(limit uint32) Return { return nvmlDeviceSetPowerManagementLimit(device, limit) } +// nvml.DeviceSetPowerManagementLimit_v2() +func (l *library) DeviceSetPowerManagementLimit_v2(device Device, powerValue *PowerValue_v2) Return { + return device.SetPowerManagementLimit_v2(powerValue) +} + +func (device nvmlDevice) SetPowerManagementLimit_v2(powerValue *PowerValue_v2) Return { + return nvmlDeviceSetPowerManagementLimit_v2(device, powerValue) +} + // nvml.DeviceSetGpuOperationMode() func (l *library) DeviceSetGpuOperationMode(device Device, mode GpuOperationMode) Return { return device.SetGpuOperationMode(mode) @@ -1649,10 +1714,13 @@ func (device nvmlDevice) ResetNvLinkErrorCounters(link int) Return { } // nvml.DeviceSetNvLinkUtilizationControl() +// +// Deprecated: Setting utilization counter control is no longer supported. func (l *library) DeviceSetNvLinkUtilizationControl(device Device, link int, counter int, control *NvLinkUtilizationControl, reset bool) Return { return device.SetNvLinkUtilizationControl(link, counter, control, reset) } +// Deprecated: Setting utilization counter control is no longer supported. func (device nvmlDevice) SetNvLinkUtilizationControl(link int, counter int, control *NvLinkUtilizationControl, reset bool) Return { resetValue := uint32(0) if reset { @@ -1662,10 +1730,13 @@ func (device nvmlDevice) SetNvLinkUtilizationControl(link int, counter int, cont } // nvml.DeviceGetNvLinkUtilizationControl() +// +// Deprecated: Getting utilization counter control is no longer supported. func (l *library) DeviceGetNvLinkUtilizationControl(device Device, link int, counter int) (NvLinkUtilizationControl, Return) { return device.GetNvLinkUtilizationControl(link, counter) } +// Deprecated: Getting utilization counter control is no longer supported. func (device nvmlDevice) GetNvLinkUtilizationControl(link int, counter int) (NvLinkUtilizationControl, Return) { var control NvLinkUtilizationControl ret := nvmlDeviceGetNvLinkUtilizationControl(device, uint32(link), uint32(counter), &control) @@ -1673,10 +1744,13 @@ func (device nvmlDevice) GetNvLinkUtilizationControl(link int, counter int) (NvL } // nvml.DeviceGetNvLinkUtilizationCounter() +// +// Deprecated: Use DeviceGetFieldValues with NVML_FI_DEV_NVLINK_THROUGHPUT_* as field values instead. func (l *library) DeviceGetNvLinkUtilizationCounter(device Device, link int, counter int) (uint64, uint64, Return) { return device.GetNvLinkUtilizationCounter(link, counter) } +// Deprecated: Use DeviceGetFieldValues with NVML_FI_DEV_NVLINK_THROUGHPUT_* as field values instead. func (device nvmlDevice) GetNvLinkUtilizationCounter(link int, counter int) (uint64, uint64, Return) { var rxCounter, txCounter uint64 ret := nvmlDeviceGetNvLinkUtilizationCounter(device, uint32(link), uint32(counter), &rxCounter, &txCounter) @@ -1684,19 +1758,25 @@ func (device nvmlDevice) GetNvLinkUtilizationCounter(link int, counter int) (uin } // nvml.DeviceFreezeNvLinkUtilizationCounter() +// +// Deprecated: Freezing NVLINK utilization counters is no longer supported. func (l *library) DeviceFreezeNvLinkUtilizationCounter(device Device, link int, counter int, freeze EnableState) Return { return device.FreezeNvLinkUtilizationCounter(link, counter, freeze) } +// Deprecated: Freezing NVLINK utilization counters is no longer supported. func (device nvmlDevice) FreezeNvLinkUtilizationCounter(link int, counter int, freeze EnableState) Return { return nvmlDeviceFreezeNvLinkUtilizationCounter(device, uint32(link), uint32(counter), freeze) } // nvml.DeviceResetNvLinkUtilizationCounter() +// +// Deprecated: Resetting NVLINK utilization counters is no longer supported. func (l *library) DeviceResetNvLinkUtilizationCounter(device Device, link int, counter int) Return { return device.ResetNvLinkUtilizationCounter(link, counter) } +// Deprecated: Resetting NVLINK utilization counters is no longer supported. func (device nvmlDevice) ResetNvLinkUtilizationCounter(link int, counter int) Return { return nvmlDeviceResetNvLinkUtilizationCounter(device, uint32(link), uint32(counter)) } @@ -2037,6 +2117,14 @@ func (l *library) GetExcludedDeviceInfoByIndex(index int) (ExcludedDeviceInfo, R return info, ret } +func (l *library) DeviceReadWritePRM_v1(device Device, buffer *PRMTLV_v1) Return { + return device.ReadWritePRM_v1(buffer) +} + +func (device nvmlDevice) ReadWritePRM_v1(buffer *PRMTLV_v1) Return { + return nvmlDeviceReadWritePRM_v1(device, buffer) +} + // nvml.DeviceSetMigMode() func (l *library) DeviceSetMigMode(device Device, mode int) (Return, Return) { return device.SetMigMode(mode) @@ -2102,6 +2190,33 @@ func (device nvmlDevice) GetGpuInstanceProfileInfoV(profile int) GpuInstanceProf return GpuInstanceProfileInfoHandler{device, profile} } +type GpuInstanceProfileInfoByIdHandler struct { + device nvmlDevice + profileId int +} + +func (handler GpuInstanceProfileInfoByIdHandler) V2() (GpuInstanceProfileInfo_v2, Return) { + var info GpuInstanceProfileInfo_v2 + info.Version = STRUCT_VERSION(info, 2) + ret := nvmlDeviceGetGpuInstanceProfileInfoByIdV(handler.device, uint32(handler.profileId), &info) + return info, ret +} + +func (handler GpuInstanceProfileInfoByIdHandler) V3() (GpuInstanceProfileInfo_v3, Return) { + var info GpuInstanceProfileInfo_v3 + info.Version = STRUCT_VERSION(info, 3) + ret := nvmlDeviceGetGpuInstanceProfileInfoV(handler.device, uint32(handler.profileId), (*GpuInstanceProfileInfo_v2)(unsafe.Pointer(&info))) + return info, ret +} + +func (l *library) DeviceGetGpuInstanceProfileInfoByIdV(device Device, profileId int) GpuInstanceProfileInfoByIdHandler { + return device.GetGpuInstanceProfileInfoByIdV(profileId) +} + +func (device nvmlDevice) GetGpuInstanceProfileInfoByIdV(profileId int) GpuInstanceProfileInfoByIdHandler { + return GpuInstanceProfileInfoByIdHandler{device, profileId} +} + // nvml.DeviceGetGpuInstancePossiblePlacements() func (l *library) DeviceGetGpuInstancePossiblePlacements(device Device, info *GpuInstanceProfileInfo) ([]GpuInstancePlacement, Return) { return device.GetGpuInstancePossiblePlacements(info) @@ -2514,10 +2629,13 @@ func (device nvmlDevice) GetGpcClkVfOffset() (int, Return) { } // nvml.DeviceSetGpcClkVfOffset() +// +// Deprecated: Use DeviceSetClockOffsets instead. func (l *library) DeviceSetGpcClkVfOffset(device Device, offset int) Return { return device.SetGpcClkVfOffset(offset) } +// Deprecated: Use DeviceSetClockOffsets instead. func (device nvmlDevice) SetGpcClkVfOffset(offset int) Return { return nvmlDeviceSetGpcClkVfOffset(device, int32(offset)) } @@ -2572,10 +2690,13 @@ func (device nvmlDevice) GetMemClkVfOffset() (int, Return) { } // nvml.DeviceSetMemClkVfOffset() +// +// Deprecated: Use DeviceSetMemClkVfOffset instead func (l *library) DeviceSetMemClkVfOffset(device Device, offset int) Return { return device.SetMemClkVfOffset(offset) } +// Deprecated: Use DeviceSetMemClkVfOffset instead func (device nvmlDevice) SetMemClkVfOffset(offset int) Return { return nvmlDeviceSetMemClkVfOffset(device, int32(offset)) } @@ -2727,10 +2848,13 @@ func (gpuInstance nvmlGpuInstance) CreateComputeInstanceWithPlacement(info *Comp } // nvml.DeviceGetGpuFabricInfo() +// +// Deprecated: Use DeviceGetGpuFabricInfoV instead func (l *library) DeviceGetGpuFabricInfo(device Device) (GpuFabricInfo, Return) { return device.GetGpuFabricInfo() } +// Deprecated: Use DeviceGetGpuFabricInfoV instead func (device nvmlDevice) GetGpuFabricInfo() (GpuFabricInfo, Return) { var gpuFabricInfo GpuFabricInfo ret := nvmlDeviceGetGpuFabricInfo(device, &gpuFabricInfo) @@ -2847,14 +2971,12 @@ func (device nvmlDevice) GetConfComputeGpuCertificate() (ConfComputeGpuCertifica } // nvml.DeviceGetConfComputeGpuAttestationReport() -func (l *library) DeviceGetConfComputeGpuAttestationReport(device Device) (ConfComputeGpuAttestationReport, Return) { - return device.GetConfComputeGpuAttestationReport() +func (l *library) DeviceGetConfComputeGpuAttestationReport(device Device, gpuAtstReport *ConfComputeGpuAttestationReport) Return { + return device.GetConfComputeGpuAttestationReport(gpuAtstReport) } -func (device nvmlDevice) GetConfComputeGpuAttestationReport() (ConfComputeGpuAttestationReport, Return) { - var gpuAtstReport ConfComputeGpuAttestationReport - ret := nvmlDeviceGetConfComputeGpuAttestationReport(device, &gpuAtstReport) - return gpuAtstReport, ret +func (device nvmlDevice) GetConfComputeGpuAttestationReport(gpuAtstReport *ConfComputeGpuAttestationReport) Return { + return nvmlDeviceGetConfComputeGpuAttestationReport(device, gpuAtstReport) } // nvml.DeviceSetConfComputeUnprotectedMemSize() @@ -2866,15 +2988,6 @@ func (device nvmlDevice) SetConfComputeUnprotectedMemSize(sizeKiB uint64) Return return nvmlDeviceSetConfComputeUnprotectedMemSize(device, sizeKiB) } -// nvml.DeviceSetPowerManagementLimit_v2() -func (l *library) DeviceSetPowerManagementLimit_v2(device Device, powerValue *PowerValue_v2) Return { - return device.SetPowerManagementLimit_v2(powerValue) -} - -func (device nvmlDevice) SetPowerManagementLimit_v2(powerValue *PowerValue_v2) Return { - return nvmlDeviceSetPowerManagementLimit_v2(device, powerValue) -} - // nvml.DeviceGetC2cModeInfoV() type C2cModeInfoHandler struct { device nvmlDevice @@ -2917,6 +3030,28 @@ func (device nvmlDevice) GetNumaNodeId() (int, Return) { return int(node), ret } +func (l *library) DeviceGetAddressingMode(device Device) (DeviceAddressingMode, Return) { + return device.GetAddressingMode() +} + +func (device nvmlDevice) GetAddressingMode() (DeviceAddressingMode, Return) { + var deviceAddressingMode DeviceAddressingMode + deviceAddressingMode.Version = STRUCT_VERSION(deviceAddressingMode, 1) + ret := nvmlDeviceGetAddressingMode(device, &deviceAddressingMode) + return deviceAddressingMode, ret +} + +func (l *library) DeviceGetRepairStatus(device Device) (RepairStatus, Return) { + return device.GetRepairStatus() +} + +func (device nvmlDevice) GetRepairStatus() (RepairStatus, Return) { + var repairStatus RepairStatus + repairStatus.Version = STRUCT_VERSION(repairStatus, 1) + ret := nvmlDeviceGetRepairStatus(device, &repairStatus) + return repairStatus, ret +} + // nvml.DeviceGetPciInfoExt() func (l *library) DeviceGetPciInfoExt(device Device) (PciInfoExt, Return) { return device.GetPciInfoExt() @@ -2939,10 +3074,17 @@ func (handler GpuFabricInfoHandler) V1() (GpuFabricInfo, Return) { } func (handler GpuFabricInfoHandler) V2() (GpuFabricInfo_v2, Return) { - var info GpuFabricInfoV + var info GpuFabricInfo_v2 info.Version = STRUCT_VERSION(info, 2) - ret := nvmlDeviceGetGpuFabricInfoV(handler.device, &info) - return GpuFabricInfo_v2(info), ret + ret := nvmlDeviceGetGpuFabricInfoV(handler.device, (*GpuFabricInfoV)(unsafe.Pointer(&info))) + return info, ret +} + +func (handler GpuFabricInfoHandler) V3() (GpuFabricInfo_v3, Return) { + var info GpuFabricInfo_v3 + info.Version = STRUCT_VERSION(info, 3) + ret := nvmlDeviceGetGpuFabricInfoV(handler.device, (*GpuFabricInfoV)(unsafe.Pointer(&info))) + return info, ret } func (l *library) DeviceGetGpuFabricInfoV(device Device) GpuFabricInfoHandler { @@ -3254,6 +3396,34 @@ func (device nvmlDevice) SetNvlinkBwMode(setBwMode *NvlinkSetBwMode) Return { return nvmlDeviceSetNvlinkBwMode(device, setBwMode) } +func (l *library) DeviceGetNvLinkInfo(device Device) NvLinkInfoHandler { + return device.GetNvLinkInfo() +} + +func (device nvmlDevice) GetNvLinkInfo() NvLinkInfoHandler { + return NvLinkInfoHandler{device} +} + +type NvLinkInfoHandler struct { + device nvmlDevice +} + +func (handler NvLinkInfoHandler) V1() (NvLinkInfo_v1, Return) { + var info NvLinkInfo_v1 + info.Version = STRUCT_VERSION(info, 1) + ret := nvmlDeviceGetNvLinkInfo(handler.device, (*NvLinkInfo)(unsafe.Pointer(&info))) + + return info, ret +} + +func (handler NvLinkInfoHandler) V2() (NvLinkInfo_v2, Return) { + var info NvLinkInfo_v2 + info.Version = STRUCT_VERSION(info, 2) + ret := nvmlDeviceGetNvLinkInfo(handler.device, (*NvLinkInfo)(unsafe.Pointer(&info))) + + return info, ret +} + // nvml.DeviceWorkloadPowerProfileGetProfilesInfo() func (l *library) DeviceWorkloadPowerProfileGetProfilesInfo(device Device) (WorkloadPowerProfileProfilesInfo, Return) { return device.WorkloadPowerProfileGetProfilesInfo() @@ -3323,6 +3493,14 @@ func (device nvmlDevice) PowerSmoothingSetState(state *PowerSmoothingState) Retu return nvmlDevicePowerSmoothingSetState(device, state) } +func (l *library) DeviceGetSramUniqueUncorrectedEccErrorCounts(device Device, errorCounts *EccSramUniqueUncorrectedErrorCounts) Return { + return device.GetSramUniqueUncorrectedEccErrorCounts(errorCounts) +} + +func (device nvmlDevice) GetSramUniqueUncorrectedEccErrorCounts(errorCounts *EccSramUniqueUncorrectedErrorCounts) Return { + return nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(device, errorCounts) +} + // nvml.GpuInstanceGetCreatableVgpus() func (l *library) GpuInstanceGetCreatableVgpus(gpuInstance GpuInstance) (VgpuTypeIdInfo, Return) { return gpuInstance.GetCreatableVgpus() diff --git a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/device.go b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/device.go index 27f22fb..2639728 100644 --- a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/device.go +++ b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/device.go @@ -60,6 +60,9 @@ var _ nvml.Device = &Device{} // GetAdaptiveClockInfoStatusFunc: func() (uint32, nvml.Return) { // panic("mock out the GetAdaptiveClockInfoStatus method") // }, +// GetAddressingModeFunc: func() (nvml.DeviceAddressingMode, nvml.Return) { +// panic("mock out the GetAddressingMode method") +// }, // GetApplicationsClockFunc: func(clockType nvml.ClockType) (uint32, nvml.Return) { // panic("mock out the GetApplicationsClock method") // }, @@ -117,7 +120,7 @@ var _ nvml.Device = &Device{} // GetComputeRunningProcessesFunc: func() ([]nvml.ProcessInfo, nvml.Return) { // panic("mock out the GetComputeRunningProcesses method") // }, -// GetConfComputeGpuAttestationReportFunc: func() (nvml.ConfComputeGpuAttestationReport, nvml.Return) { +// GetConfComputeGpuAttestationReportFunc: func(confComputeGpuAttestationReport *nvml.ConfComputeGpuAttestationReport) nvml.Return { // panic("mock out the GetConfComputeGpuAttestationReport method") // }, // GetConfComputeGpuCertificateFunc: func() (nvml.ConfComputeGpuCertificate, nvml.Return) { @@ -255,6 +258,9 @@ var _ nvml.Device = &Device{} // GetGpuInstanceProfileInfoFunc: func(n int) (nvml.GpuInstanceProfileInfo, nvml.Return) { // panic("mock out the GetGpuInstanceProfileInfo method") // }, +// GetGpuInstanceProfileInfoByIdVFunc: func(n int) nvml.GpuInstanceProfileInfoByIdHandler { +// panic("mock out the GetGpuInstanceProfileInfoByIdV method") +// }, // GetGpuInstanceProfileInfoVFunc: func(n int) nvml.GpuInstanceProfileInfoHandler { // panic("mock out the GetGpuInstanceProfileInfoV method") // }, @@ -387,6 +393,9 @@ var _ nvml.Device = &Device{} // GetNvLinkErrorCounterFunc: func(n int, nvLinkErrorCounter nvml.NvLinkErrorCounter) (uint64, nvml.Return) { // panic("mock out the GetNvLinkErrorCounter method") // }, +// GetNvLinkInfoFunc: func() nvml.NvLinkInfoHandler { +// panic("mock out the GetNvLinkInfo method") +// }, // GetNvLinkRemoteDeviceTypeFunc: func(n int) (nvml.IntNvLinkDeviceType, nvml.Return) { // panic("mock out the GetNvLinkRemoteDeviceType method") // }, @@ -435,6 +444,9 @@ var _ nvml.Device = &Device{} // GetPcieThroughputFunc: func(pcieUtilCounter nvml.PcieUtilCounter) (uint32, nvml.Return) { // panic("mock out the GetPcieThroughput method") // }, +// GetPdiFunc: func() (nvml.Pdi, nvml.Return) { +// panic("mock out the GetPdi method") +// }, // GetPerformanceModesFunc: func() (nvml.DevicePerfModes, nvml.Return) { // panic("mock out the GetPerformanceModes method") // }, @@ -462,6 +474,9 @@ var _ nvml.Device = &Device{} // GetPowerManagementModeFunc: func() (nvml.EnableState, nvml.Return) { // panic("mock out the GetPowerManagementMode method") // }, +// GetPowerMizerMode_v1Func: func() (nvml.DevicePowerMizerModes_v1, nvml.Return) { +// panic("mock out the GetPowerMizerMode_v1 method") +// }, // GetPowerSourceFunc: func() (nvml.PowerSource, nvml.Return) { // panic("mock out the GetPowerSource method") // }, @@ -480,6 +495,9 @@ var _ nvml.Device = &Device{} // GetRemappedRowsFunc: func() (int, int, bool, bool, nvml.Return) { // panic("mock out the GetRemappedRows method") // }, +// GetRepairStatusFunc: func() (nvml.RepairStatus, nvml.Return) { +// panic("mock out the GetRepairStatus method") +// }, // GetRetiredPagesFunc: func(pageRetirementCause nvml.PageRetirementCause) ([]uint64, nvml.Return) { // panic("mock out the GetRetiredPages method") // }, @@ -504,6 +522,9 @@ var _ nvml.Device = &Device{} // GetSramEccErrorStatusFunc: func() (nvml.EccSramErrorStatus, nvml.Return) { // panic("mock out the GetSramEccErrorStatus method") // }, +// GetSramUniqueUncorrectedEccErrorCountsFunc: func(eccSramUniqueUncorrectedErrorCounts *nvml.EccSramUniqueUncorrectedErrorCounts) nvml.Return { +// panic("mock out the GetSramUniqueUncorrectedEccErrorCounts method") +// }, // GetSupportedClocksEventReasonsFunc: func() (uint64, nvml.Return) { // panic("mock out the GetSupportedClocksEventReasons method") // }, @@ -636,6 +657,9 @@ var _ nvml.Device = &Device{} // PowerSmoothingUpdatePresetProfileParamFunc: func(powerSmoothingProfile *nvml.PowerSmoothingProfile) nvml.Return { // panic("mock out the PowerSmoothingUpdatePresetProfileParam method") // }, +// ReadWritePRM_v1Func: func(pRMTLV_v1 *nvml.PRMTLV_v1) nvml.Return { +// panic("mock out the ReadWritePRM_v1 method") +// }, // RegisterEventsFunc: func(v uint64, eventSet nvml.EventSet) nvml.Return { // panic("mock out the RegisterEvents method") // }, @@ -817,6 +841,9 @@ type Device struct { // GetAdaptiveClockInfoStatusFunc mocks the GetAdaptiveClockInfoStatus method. GetAdaptiveClockInfoStatusFunc func() (uint32, nvml.Return) + // GetAddressingModeFunc mocks the GetAddressingMode method. + GetAddressingModeFunc func() (nvml.DeviceAddressingMode, nvml.Return) + // GetApplicationsClockFunc mocks the GetApplicationsClock method. GetApplicationsClockFunc func(clockType nvml.ClockType) (uint32, nvml.Return) @@ -875,7 +902,7 @@ type Device struct { GetComputeRunningProcessesFunc func() ([]nvml.ProcessInfo, nvml.Return) // GetConfComputeGpuAttestationReportFunc mocks the GetConfComputeGpuAttestationReport method. - GetConfComputeGpuAttestationReportFunc func() (nvml.ConfComputeGpuAttestationReport, nvml.Return) + GetConfComputeGpuAttestationReportFunc func(confComputeGpuAttestationReport *nvml.ConfComputeGpuAttestationReport) nvml.Return // GetConfComputeGpuCertificateFunc mocks the GetConfComputeGpuCertificate method. GetConfComputeGpuCertificateFunc func() (nvml.ConfComputeGpuCertificate, nvml.Return) @@ -1012,6 +1039,9 @@ type Device struct { // GetGpuInstanceProfileInfoFunc mocks the GetGpuInstanceProfileInfo method. GetGpuInstanceProfileInfoFunc func(n int) (nvml.GpuInstanceProfileInfo, nvml.Return) + // GetGpuInstanceProfileInfoByIdVFunc mocks the GetGpuInstanceProfileInfoByIdV method. + GetGpuInstanceProfileInfoByIdVFunc func(n int) nvml.GpuInstanceProfileInfoByIdHandler + // GetGpuInstanceProfileInfoVFunc mocks the GetGpuInstanceProfileInfoV method. GetGpuInstanceProfileInfoVFunc func(n int) nvml.GpuInstanceProfileInfoHandler @@ -1144,6 +1174,9 @@ type Device struct { // GetNvLinkErrorCounterFunc mocks the GetNvLinkErrorCounter method. GetNvLinkErrorCounterFunc func(n int, nvLinkErrorCounter nvml.NvLinkErrorCounter) (uint64, nvml.Return) + // GetNvLinkInfoFunc mocks the GetNvLinkInfo method. + GetNvLinkInfoFunc func() nvml.NvLinkInfoHandler + // GetNvLinkRemoteDeviceTypeFunc mocks the GetNvLinkRemoteDeviceType method. GetNvLinkRemoteDeviceTypeFunc func(n int) (nvml.IntNvLinkDeviceType, nvml.Return) @@ -1192,6 +1225,9 @@ type Device struct { // GetPcieThroughputFunc mocks the GetPcieThroughput method. GetPcieThroughputFunc func(pcieUtilCounter nvml.PcieUtilCounter) (uint32, nvml.Return) + // GetPdiFunc mocks the GetPdi method. + GetPdiFunc func() (nvml.Pdi, nvml.Return) + // GetPerformanceModesFunc mocks the GetPerformanceModes method. GetPerformanceModesFunc func() (nvml.DevicePerfModes, nvml.Return) @@ -1219,6 +1255,9 @@ type Device struct { // GetPowerManagementModeFunc mocks the GetPowerManagementMode method. GetPowerManagementModeFunc func() (nvml.EnableState, nvml.Return) + // GetPowerMizerMode_v1Func mocks the GetPowerMizerMode_v1 method. + GetPowerMizerMode_v1Func func() (nvml.DevicePowerMizerModes_v1, nvml.Return) + // GetPowerSourceFunc mocks the GetPowerSource method. GetPowerSourceFunc func() (nvml.PowerSource, nvml.Return) @@ -1237,6 +1276,9 @@ type Device struct { // GetRemappedRowsFunc mocks the GetRemappedRows method. GetRemappedRowsFunc func() (int, int, bool, bool, nvml.Return) + // GetRepairStatusFunc mocks the GetRepairStatus method. + GetRepairStatusFunc func() (nvml.RepairStatus, nvml.Return) + // GetRetiredPagesFunc mocks the GetRetiredPages method. GetRetiredPagesFunc func(pageRetirementCause nvml.PageRetirementCause) ([]uint64, nvml.Return) @@ -1261,6 +1303,9 @@ type Device struct { // GetSramEccErrorStatusFunc mocks the GetSramEccErrorStatus method. GetSramEccErrorStatusFunc func() (nvml.EccSramErrorStatus, nvml.Return) + // GetSramUniqueUncorrectedEccErrorCountsFunc mocks the GetSramUniqueUncorrectedEccErrorCounts method. + GetSramUniqueUncorrectedEccErrorCountsFunc func(eccSramUniqueUncorrectedErrorCounts *nvml.EccSramUniqueUncorrectedErrorCounts) nvml.Return + // GetSupportedClocksEventReasonsFunc mocks the GetSupportedClocksEventReasons method. GetSupportedClocksEventReasonsFunc func() (uint64, nvml.Return) @@ -1393,6 +1438,9 @@ type Device struct { // PowerSmoothingUpdatePresetProfileParamFunc mocks the PowerSmoothingUpdatePresetProfileParam method. PowerSmoothingUpdatePresetProfileParamFunc func(powerSmoothingProfile *nvml.PowerSmoothingProfile) nvml.Return + // ReadWritePRM_v1Func mocks the ReadWritePRM_v1 method. + ReadWritePRM_v1Func func(pRMTLV_v1 *nvml.PRMTLV_v1) nvml.Return + // RegisterEventsFunc mocks the RegisterEvents method. RegisterEventsFunc func(v uint64, eventSet nvml.EventSet) nvml.Return @@ -1589,6 +1637,9 @@ type Device struct { // GetAdaptiveClockInfoStatus holds details about calls to the GetAdaptiveClockInfoStatus method. GetAdaptiveClockInfoStatus []struct { } + // GetAddressingMode holds details about calls to the GetAddressingMode method. + GetAddressingMode []struct { + } // GetApplicationsClock holds details about calls to the GetApplicationsClock method. GetApplicationsClock []struct { // ClockType is the clockType argument value. @@ -1656,6 +1707,8 @@ type Device struct { } // GetConfComputeGpuAttestationReport holds details about calls to the GetConfComputeGpuAttestationReport method. GetConfComputeGpuAttestationReport []struct { + // ConfComputeGpuAttestationReport is the confComputeGpuAttestationReport argument value. + ConfComputeGpuAttestationReport *nvml.ConfComputeGpuAttestationReport } // GetConfComputeGpuCertificate holds details about calls to the GetConfComputeGpuCertificate method. GetConfComputeGpuCertificate []struct { @@ -1818,6 +1871,11 @@ type Device struct { // N is the n argument value. N int } + // GetGpuInstanceProfileInfoByIdV holds details about calls to the GetGpuInstanceProfileInfoByIdV method. + GetGpuInstanceProfileInfoByIdV []struct { + // N is the n argument value. + N int + } // GetGpuInstanceProfileInfoV holds details about calls to the GetGpuInstanceProfileInfoV method. GetGpuInstanceProfileInfoV []struct { // N is the n argument value. @@ -1986,6 +2044,9 @@ type Device struct { // NvLinkErrorCounter is the nvLinkErrorCounter argument value. NvLinkErrorCounter nvml.NvLinkErrorCounter } + // GetNvLinkInfo holds details about calls to the GetNvLinkInfo method. + GetNvLinkInfo []struct { + } // GetNvLinkRemoteDeviceType holds details about calls to the GetNvLinkRemoteDeviceType method. GetNvLinkRemoteDeviceType []struct { // N is the n argument value. @@ -2056,6 +2117,9 @@ type Device struct { // PcieUtilCounter is the pcieUtilCounter argument value. PcieUtilCounter nvml.PcieUtilCounter } + // GetPdi holds details about calls to the GetPdi method. + GetPdi []struct { + } // GetPerformanceModes holds details about calls to the GetPerformanceModes method. GetPerformanceModes []struct { } @@ -2083,6 +2147,9 @@ type Device struct { // GetPowerManagementMode holds details about calls to the GetPowerManagementMode method. GetPowerManagementMode []struct { } + // GetPowerMizerMode_v1 holds details about calls to the GetPowerMizerMode_v1 method. + GetPowerMizerMode_v1 []struct { + } // GetPowerSource holds details about calls to the GetPowerSource method. GetPowerSource []struct { } @@ -2103,6 +2170,9 @@ type Device struct { // GetRemappedRows holds details about calls to the GetRemappedRows method. GetRemappedRows []struct { } + // GetRepairStatus holds details about calls to the GetRepairStatus method. + GetRepairStatus []struct { + } // GetRetiredPages holds details about calls to the GetRetiredPages method. GetRetiredPages []struct { // PageRetirementCause is the pageRetirementCause argument value. @@ -2135,6 +2205,11 @@ type Device struct { // GetSramEccErrorStatus holds details about calls to the GetSramEccErrorStatus method. GetSramEccErrorStatus []struct { } + // GetSramUniqueUncorrectedEccErrorCounts holds details about calls to the GetSramUniqueUncorrectedEccErrorCounts method. + GetSramUniqueUncorrectedEccErrorCounts []struct { + // EccSramUniqueUncorrectedErrorCounts is the eccSramUniqueUncorrectedErrorCounts argument value. + EccSramUniqueUncorrectedErrorCounts *nvml.EccSramUniqueUncorrectedErrorCounts + } // GetSupportedClocksEventReasons holds details about calls to the GetSupportedClocksEventReasons method. GetSupportedClocksEventReasons []struct { } @@ -2313,6 +2388,11 @@ type Device struct { // PowerSmoothingProfile is the powerSmoothingProfile argument value. PowerSmoothingProfile *nvml.PowerSmoothingProfile } + // ReadWritePRM_v1 holds details about calls to the ReadWritePRM_v1 method. + ReadWritePRM_v1 []struct { + // PRMTLV_v1 is the pRMTLV_v1 argument value. + PRMTLV_v1 *nvml.PRMTLV_v1 + } // RegisterEvents holds details about calls to the RegisterEvents method. RegisterEvents []struct { // V is the v argument value. @@ -2564,6 +2644,7 @@ type Device struct { lockGetAccountingStats sync.RWMutex lockGetActiveVgpus sync.RWMutex lockGetAdaptiveClockInfoStatus sync.RWMutex + lockGetAddressingMode sync.RWMutex lockGetApplicationsClock sync.RWMutex lockGetArchitecture sync.RWMutex lockGetAttributes sync.RWMutex @@ -2629,6 +2710,7 @@ type Device struct { lockGetGpuInstanceId sync.RWMutex lockGetGpuInstancePossiblePlacements sync.RWMutex lockGetGpuInstanceProfileInfo sync.RWMutex + lockGetGpuInstanceProfileInfoByIdV sync.RWMutex lockGetGpuInstanceProfileInfoV sync.RWMutex lockGetGpuInstanceRemainingCapacity sync.RWMutex lockGetGpuInstances sync.RWMutex @@ -2673,6 +2755,7 @@ type Device struct { lockGetNumaNodeId sync.RWMutex lockGetNvLinkCapability sync.RWMutex lockGetNvLinkErrorCounter sync.RWMutex + lockGetNvLinkInfo sync.RWMutex lockGetNvLinkRemoteDeviceType sync.RWMutex lockGetNvLinkRemotePciInfo sync.RWMutex lockGetNvLinkState sync.RWMutex @@ -2689,6 +2772,7 @@ type Device struct { lockGetPcieReplayCounter sync.RWMutex lockGetPcieSpeed sync.RWMutex lockGetPcieThroughput sync.RWMutex + lockGetPdi sync.RWMutex lockGetPerformanceModes sync.RWMutex lockGetPerformanceState sync.RWMutex lockGetPersistenceMode sync.RWMutex @@ -2698,12 +2782,14 @@ type Device struct { lockGetPowerManagementLimit sync.RWMutex lockGetPowerManagementLimitConstraints sync.RWMutex lockGetPowerManagementMode sync.RWMutex + lockGetPowerMizerMode_v1 sync.RWMutex lockGetPowerSource sync.RWMutex lockGetPowerState sync.RWMutex lockGetPowerUsage sync.RWMutex lockGetProcessUtilization sync.RWMutex lockGetProcessesUtilizationInfo sync.RWMutex lockGetRemappedRows sync.RWMutex + lockGetRepairStatus sync.RWMutex lockGetRetiredPages sync.RWMutex lockGetRetiredPagesPendingStatus sync.RWMutex lockGetRetiredPages_v2 sync.RWMutex @@ -2712,6 +2798,7 @@ type Device struct { lockGetSamples sync.RWMutex lockGetSerial sync.RWMutex lockGetSramEccErrorStatus sync.RWMutex + lockGetSramUniqueUncorrectedEccErrorCounts sync.RWMutex lockGetSupportedClocksEventReasons sync.RWMutex lockGetSupportedClocksThrottleReasons sync.RWMutex lockGetSupportedEventTypes sync.RWMutex @@ -2756,6 +2843,7 @@ type Device struct { lockPowerSmoothingActivatePresetProfile sync.RWMutex lockPowerSmoothingSetState sync.RWMutex lockPowerSmoothingUpdatePresetProfileParam sync.RWMutex + lockReadWritePRM_v1 sync.RWMutex lockRegisterEvents sync.RWMutex lockResetApplicationsClocks sync.RWMutex lockResetGpuLockedClocks sync.RWMutex @@ -3227,6 +3315,33 @@ func (mock *Device) GetAdaptiveClockInfoStatusCalls() []struct { return calls } +// GetAddressingMode calls GetAddressingModeFunc. +func (mock *Device) GetAddressingMode() (nvml.DeviceAddressingMode, nvml.Return) { + if mock.GetAddressingModeFunc == nil { + panic("Device.GetAddressingModeFunc: method is nil but Device.GetAddressingMode was just called") + } + callInfo := struct { + }{} + mock.lockGetAddressingMode.Lock() + mock.calls.GetAddressingMode = append(mock.calls.GetAddressingMode, callInfo) + mock.lockGetAddressingMode.Unlock() + return mock.GetAddressingModeFunc() +} + +// GetAddressingModeCalls gets all the calls that were made to GetAddressingMode. +// Check the length with: +// +// len(mockedDevice.GetAddressingModeCalls()) +func (mock *Device) GetAddressingModeCalls() []struct { +} { + var calls []struct { + } + mock.lockGetAddressingMode.RLock() + calls = mock.calls.GetAddressingMode + mock.lockGetAddressingMode.RUnlock() + return calls +} + // GetApplicationsClock calls GetApplicationsClockFunc. func (mock *Device) GetApplicationsClock(clockType nvml.ClockType) (uint32, nvml.Return) { if mock.GetApplicationsClockFunc == nil { @@ -3760,16 +3875,19 @@ func (mock *Device) GetComputeRunningProcessesCalls() []struct { } // GetConfComputeGpuAttestationReport calls GetConfComputeGpuAttestationReportFunc. -func (mock *Device) GetConfComputeGpuAttestationReport() (nvml.ConfComputeGpuAttestationReport, nvml.Return) { +func (mock *Device) GetConfComputeGpuAttestationReport(confComputeGpuAttestationReport *nvml.ConfComputeGpuAttestationReport) nvml.Return { if mock.GetConfComputeGpuAttestationReportFunc == nil { panic("Device.GetConfComputeGpuAttestationReportFunc: method is nil but Device.GetConfComputeGpuAttestationReport was just called") } callInfo := struct { - }{} + ConfComputeGpuAttestationReport *nvml.ConfComputeGpuAttestationReport + }{ + ConfComputeGpuAttestationReport: confComputeGpuAttestationReport, + } mock.lockGetConfComputeGpuAttestationReport.Lock() mock.calls.GetConfComputeGpuAttestationReport = append(mock.calls.GetConfComputeGpuAttestationReport, callInfo) mock.lockGetConfComputeGpuAttestationReport.Unlock() - return mock.GetConfComputeGpuAttestationReportFunc() + return mock.GetConfComputeGpuAttestationReportFunc(confComputeGpuAttestationReport) } // GetConfComputeGpuAttestationReportCalls gets all the calls that were made to GetConfComputeGpuAttestationReport. @@ -3777,8 +3895,10 @@ func (mock *Device) GetConfComputeGpuAttestationReport() (nvml.ConfComputeGpuAtt // // len(mockedDevice.GetConfComputeGpuAttestationReportCalls()) func (mock *Device) GetConfComputeGpuAttestationReportCalls() []struct { + ConfComputeGpuAttestationReport *nvml.ConfComputeGpuAttestationReport } { var calls []struct { + ConfComputeGpuAttestationReport *nvml.ConfComputeGpuAttestationReport } mock.lockGetConfComputeGpuAttestationReport.RLock() calls = mock.calls.GetConfComputeGpuAttestationReport @@ -5064,6 +5184,38 @@ func (mock *Device) GetGpuInstanceProfileInfoCalls() []struct { return calls } +// GetGpuInstanceProfileInfoByIdV calls GetGpuInstanceProfileInfoByIdVFunc. +func (mock *Device) GetGpuInstanceProfileInfoByIdV(n int) nvml.GpuInstanceProfileInfoByIdHandler { + if mock.GetGpuInstanceProfileInfoByIdVFunc == nil { + panic("Device.GetGpuInstanceProfileInfoByIdVFunc: method is nil but Device.GetGpuInstanceProfileInfoByIdV was just called") + } + callInfo := struct { + N int + }{ + N: n, + } + mock.lockGetGpuInstanceProfileInfoByIdV.Lock() + mock.calls.GetGpuInstanceProfileInfoByIdV = append(mock.calls.GetGpuInstanceProfileInfoByIdV, callInfo) + mock.lockGetGpuInstanceProfileInfoByIdV.Unlock() + return mock.GetGpuInstanceProfileInfoByIdVFunc(n) +} + +// GetGpuInstanceProfileInfoByIdVCalls gets all the calls that were made to GetGpuInstanceProfileInfoByIdV. +// Check the length with: +// +// len(mockedDevice.GetGpuInstanceProfileInfoByIdVCalls()) +func (mock *Device) GetGpuInstanceProfileInfoByIdVCalls() []struct { + N int +} { + var calls []struct { + N int + } + mock.lockGetGpuInstanceProfileInfoByIdV.RLock() + calls = mock.calls.GetGpuInstanceProfileInfoByIdV + mock.lockGetGpuInstanceProfileInfoByIdV.RUnlock() + return calls +} + // GetGpuInstanceProfileInfoV calls GetGpuInstanceProfileInfoVFunc. func (mock *Device) GetGpuInstanceProfileInfoV(n int) nvml.GpuInstanceProfileInfoHandler { if mock.GetGpuInstanceProfileInfoVFunc == nil { @@ -6336,6 +6488,33 @@ func (mock *Device) GetNvLinkErrorCounterCalls() []struct { return calls } +// GetNvLinkInfo calls GetNvLinkInfoFunc. +func (mock *Device) GetNvLinkInfo() nvml.NvLinkInfoHandler { + if mock.GetNvLinkInfoFunc == nil { + panic("Device.GetNvLinkInfoFunc: method is nil but Device.GetNvLinkInfo was just called") + } + callInfo := struct { + }{} + mock.lockGetNvLinkInfo.Lock() + mock.calls.GetNvLinkInfo = append(mock.calls.GetNvLinkInfo, callInfo) + mock.lockGetNvLinkInfo.Unlock() + return mock.GetNvLinkInfoFunc() +} + +// GetNvLinkInfoCalls gets all the calls that were made to GetNvLinkInfo. +// Check the length with: +// +// len(mockedDevice.GetNvLinkInfoCalls()) +func (mock *Device) GetNvLinkInfoCalls() []struct { +} { + var calls []struct { + } + mock.lockGetNvLinkInfo.RLock() + calls = mock.calls.GetNvLinkInfo + mock.lockGetNvLinkInfo.RUnlock() + return calls +} + // GetNvLinkRemoteDeviceType calls GetNvLinkRemoteDeviceTypeFunc. func (mock *Device) GetNvLinkRemoteDeviceType(n int) (nvml.IntNvLinkDeviceType, nvml.Return) { if mock.GetNvLinkRemoteDeviceTypeFunc == nil { @@ -6820,6 +6999,33 @@ func (mock *Device) GetPcieThroughputCalls() []struct { return calls } +// GetPdi calls GetPdiFunc. +func (mock *Device) GetPdi() (nvml.Pdi, nvml.Return) { + if mock.GetPdiFunc == nil { + panic("Device.GetPdiFunc: method is nil but Device.GetPdi was just called") + } + callInfo := struct { + }{} + mock.lockGetPdi.Lock() + mock.calls.GetPdi = append(mock.calls.GetPdi, callInfo) + mock.lockGetPdi.Unlock() + return mock.GetPdiFunc() +} + +// GetPdiCalls gets all the calls that were made to GetPdi. +// Check the length with: +// +// len(mockedDevice.GetPdiCalls()) +func (mock *Device) GetPdiCalls() []struct { +} { + var calls []struct { + } + mock.lockGetPdi.RLock() + calls = mock.calls.GetPdi + mock.lockGetPdi.RUnlock() + return calls +} + // GetPerformanceModes calls GetPerformanceModesFunc. func (mock *Device) GetPerformanceModes() (nvml.DevicePerfModes, nvml.Return) { if mock.GetPerformanceModesFunc == nil { @@ -7063,6 +7269,33 @@ func (mock *Device) GetPowerManagementModeCalls() []struct { return calls } +// GetPowerMizerMode_v1 calls GetPowerMizerMode_v1Func. +func (mock *Device) GetPowerMizerMode_v1() (nvml.DevicePowerMizerModes_v1, nvml.Return) { + if mock.GetPowerMizerMode_v1Func == nil { + panic("Device.GetPowerMizerMode_v1Func: method is nil but Device.GetPowerMizerMode_v1 was just called") + } + callInfo := struct { + }{} + mock.lockGetPowerMizerMode_v1.Lock() + mock.calls.GetPowerMizerMode_v1 = append(mock.calls.GetPowerMizerMode_v1, callInfo) + mock.lockGetPowerMizerMode_v1.Unlock() + return mock.GetPowerMizerMode_v1Func() +} + +// GetPowerMizerMode_v1Calls gets all the calls that were made to GetPowerMizerMode_v1. +// Check the length with: +// +// len(mockedDevice.GetPowerMizerMode_v1Calls()) +func (mock *Device) GetPowerMizerMode_v1Calls() []struct { +} { + var calls []struct { + } + mock.lockGetPowerMizerMode_v1.RLock() + calls = mock.calls.GetPowerMizerMode_v1 + mock.lockGetPowerMizerMode_v1.RUnlock() + return calls +} + // GetPowerSource calls GetPowerSourceFunc. func (mock *Device) GetPowerSource() (nvml.PowerSource, nvml.Return) { if mock.GetPowerSourceFunc == nil { @@ -7230,6 +7463,33 @@ func (mock *Device) GetRemappedRowsCalls() []struct { return calls } +// GetRepairStatus calls GetRepairStatusFunc. +func (mock *Device) GetRepairStatus() (nvml.RepairStatus, nvml.Return) { + if mock.GetRepairStatusFunc == nil { + panic("Device.GetRepairStatusFunc: method is nil but Device.GetRepairStatus was just called") + } + callInfo := struct { + }{} + mock.lockGetRepairStatus.Lock() + mock.calls.GetRepairStatus = append(mock.calls.GetRepairStatus, callInfo) + mock.lockGetRepairStatus.Unlock() + return mock.GetRepairStatusFunc() +} + +// GetRepairStatusCalls gets all the calls that were made to GetRepairStatus. +// Check the length with: +// +// len(mockedDevice.GetRepairStatusCalls()) +func (mock *Device) GetRepairStatusCalls() []struct { +} { + var calls []struct { + } + mock.lockGetRepairStatus.RLock() + calls = mock.calls.GetRepairStatus + mock.lockGetRepairStatus.RUnlock() + return calls +} + // GetRetiredPages calls GetRetiredPagesFunc. func (mock *Device) GetRetiredPages(pageRetirementCause nvml.PageRetirementCause) ([]uint64, nvml.Return) { if mock.GetRetiredPagesFunc == nil { @@ -7465,6 +7725,38 @@ func (mock *Device) GetSramEccErrorStatusCalls() []struct { return calls } +// GetSramUniqueUncorrectedEccErrorCounts calls GetSramUniqueUncorrectedEccErrorCountsFunc. +func (mock *Device) GetSramUniqueUncorrectedEccErrorCounts(eccSramUniqueUncorrectedErrorCounts *nvml.EccSramUniqueUncorrectedErrorCounts) nvml.Return { + if mock.GetSramUniqueUncorrectedEccErrorCountsFunc == nil { + panic("Device.GetSramUniqueUncorrectedEccErrorCountsFunc: method is nil but Device.GetSramUniqueUncorrectedEccErrorCounts was just called") + } + callInfo := struct { + EccSramUniqueUncorrectedErrorCounts *nvml.EccSramUniqueUncorrectedErrorCounts + }{ + EccSramUniqueUncorrectedErrorCounts: eccSramUniqueUncorrectedErrorCounts, + } + mock.lockGetSramUniqueUncorrectedEccErrorCounts.Lock() + mock.calls.GetSramUniqueUncorrectedEccErrorCounts = append(mock.calls.GetSramUniqueUncorrectedEccErrorCounts, callInfo) + mock.lockGetSramUniqueUncorrectedEccErrorCounts.Unlock() + return mock.GetSramUniqueUncorrectedEccErrorCountsFunc(eccSramUniqueUncorrectedErrorCounts) +} + +// GetSramUniqueUncorrectedEccErrorCountsCalls gets all the calls that were made to GetSramUniqueUncorrectedEccErrorCounts. +// Check the length with: +// +// len(mockedDevice.GetSramUniqueUncorrectedEccErrorCountsCalls()) +func (mock *Device) GetSramUniqueUncorrectedEccErrorCountsCalls() []struct { + EccSramUniqueUncorrectedErrorCounts *nvml.EccSramUniqueUncorrectedErrorCounts +} { + var calls []struct { + EccSramUniqueUncorrectedErrorCounts *nvml.EccSramUniqueUncorrectedErrorCounts + } + mock.lockGetSramUniqueUncorrectedEccErrorCounts.RLock() + calls = mock.calls.GetSramUniqueUncorrectedEccErrorCounts + mock.lockGetSramUniqueUncorrectedEccErrorCounts.RUnlock() + return calls +} + // GetSupportedClocksEventReasons calls GetSupportedClocksEventReasonsFunc. func (mock *Device) GetSupportedClocksEventReasons() (uint64, nvml.Return) { if mock.GetSupportedClocksEventReasonsFunc == nil { @@ -8766,6 +9058,38 @@ func (mock *Device) PowerSmoothingUpdatePresetProfileParamCalls() []struct { return calls } +// ReadWritePRM_v1 calls ReadWritePRM_v1Func. +func (mock *Device) ReadWritePRM_v1(pRMTLV_v1 *nvml.PRMTLV_v1) nvml.Return { + if mock.ReadWritePRM_v1Func == nil { + panic("Device.ReadWritePRM_v1Func: method is nil but Device.ReadWritePRM_v1 was just called") + } + callInfo := struct { + PRMTLV_v1 *nvml.PRMTLV_v1 + }{ + PRMTLV_v1: pRMTLV_v1, + } + mock.lockReadWritePRM_v1.Lock() + mock.calls.ReadWritePRM_v1 = append(mock.calls.ReadWritePRM_v1, callInfo) + mock.lockReadWritePRM_v1.Unlock() + return mock.ReadWritePRM_v1Func(pRMTLV_v1) +} + +// ReadWritePRM_v1Calls gets all the calls that were made to ReadWritePRM_v1. +// Check the length with: +// +// len(mockedDevice.ReadWritePRM_v1Calls()) +func (mock *Device) ReadWritePRM_v1Calls() []struct { + PRMTLV_v1 *nvml.PRMTLV_v1 +} { + var calls []struct { + PRMTLV_v1 *nvml.PRMTLV_v1 + } + mock.lockReadWritePRM_v1.RLock() + calls = mock.calls.ReadWritePRM_v1 + mock.lockReadWritePRM_v1.RUnlock() + return calls +} + // RegisterEvents calls RegisterEventsFunc. func (mock *Device) RegisterEvents(v uint64, eventSet nvml.EventSet) nvml.Return { if mock.RegisterEventsFunc == nil { diff --git a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/interface.go b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/interface.go index ecaaf6c..dc25ce2 100644 --- a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/interface.go +++ b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/mock/interface.go @@ -69,6 +69,9 @@ var _ nvml.Interface = &Interface{} // DeviceGetAdaptiveClockInfoStatusFunc: func(device nvml.Device) (uint32, nvml.Return) { // panic("mock out the DeviceGetAdaptiveClockInfoStatus method") // }, +// DeviceGetAddressingModeFunc: func(device nvml.Device) (nvml.DeviceAddressingMode, nvml.Return) { +// panic("mock out the DeviceGetAddressingMode method") +// }, // DeviceGetApplicationsClockFunc: func(device nvml.Device, clockType nvml.ClockType) (uint32, nvml.Return) { // panic("mock out the DeviceGetApplicationsClock method") // }, @@ -126,7 +129,7 @@ var _ nvml.Interface = &Interface{} // DeviceGetComputeRunningProcessesFunc: func(device nvml.Device) ([]nvml.ProcessInfo, nvml.Return) { // panic("mock out the DeviceGetComputeRunningProcesses method") // }, -// DeviceGetConfComputeGpuAttestationReportFunc: func(device nvml.Device) (nvml.ConfComputeGpuAttestationReport, nvml.Return) { +// DeviceGetConfComputeGpuAttestationReportFunc: func(device nvml.Device, confComputeGpuAttestationReport *nvml.ConfComputeGpuAttestationReport) nvml.Return { // panic("mock out the DeviceGetConfComputeGpuAttestationReport method") // }, // DeviceGetConfComputeGpuCertificateFunc: func(device nvml.Device) (nvml.ConfComputeGpuCertificate, nvml.Return) { @@ -267,6 +270,9 @@ var _ nvml.Interface = &Interface{} // DeviceGetGpuInstanceProfileInfoFunc: func(device nvml.Device, n int) (nvml.GpuInstanceProfileInfo, nvml.Return) { // panic("mock out the DeviceGetGpuInstanceProfileInfo method") // }, +// DeviceGetGpuInstanceProfileInfoByIdVFunc: func(device nvml.Device, n int) nvml.GpuInstanceProfileInfoByIdHandler { +// panic("mock out the DeviceGetGpuInstanceProfileInfoByIdV method") +// }, // DeviceGetGpuInstanceProfileInfoVFunc: func(device nvml.Device, n int) nvml.GpuInstanceProfileInfoHandler { // panic("mock out the DeviceGetGpuInstanceProfileInfoV method") // }, @@ -414,6 +420,9 @@ var _ nvml.Interface = &Interface{} // DeviceGetNvLinkErrorCounterFunc: func(device nvml.Device, n int, nvLinkErrorCounter nvml.NvLinkErrorCounter) (uint64, nvml.Return) { // panic("mock out the DeviceGetNvLinkErrorCounter method") // }, +// DeviceGetNvLinkInfoFunc: func(device nvml.Device) nvml.NvLinkInfoHandler { +// panic("mock out the DeviceGetNvLinkInfo method") +// }, // DeviceGetNvLinkRemoteDeviceTypeFunc: func(device nvml.Device, n int) (nvml.IntNvLinkDeviceType, nvml.Return) { // panic("mock out the DeviceGetNvLinkRemoteDeviceType method") // }, @@ -462,6 +471,9 @@ var _ nvml.Interface = &Interface{} // DeviceGetPcieThroughputFunc: func(device nvml.Device, pcieUtilCounter nvml.PcieUtilCounter) (uint32, nvml.Return) { // panic("mock out the DeviceGetPcieThroughput method") // }, +// DeviceGetPdiFunc: func(device nvml.Device) (nvml.Pdi, nvml.Return) { +// panic("mock out the DeviceGetPdi method") +// }, // DeviceGetPerformanceModesFunc: func(device nvml.Device) (nvml.DevicePerfModes, nvml.Return) { // panic("mock out the DeviceGetPerformanceModes method") // }, @@ -489,6 +501,9 @@ var _ nvml.Interface = &Interface{} // DeviceGetPowerManagementModeFunc: func(device nvml.Device) (nvml.EnableState, nvml.Return) { // panic("mock out the DeviceGetPowerManagementMode method") // }, +// DeviceGetPowerMizerMode_v1Func: func(device nvml.Device) (nvml.DevicePowerMizerModes_v1, nvml.Return) { +// panic("mock out the DeviceGetPowerMizerMode_v1 method") +// }, // DeviceGetPowerSourceFunc: func(device nvml.Device) (nvml.PowerSource, nvml.Return) { // panic("mock out the DeviceGetPowerSource method") // }, @@ -507,6 +522,9 @@ var _ nvml.Interface = &Interface{} // DeviceGetRemappedRowsFunc: func(device nvml.Device) (int, int, bool, bool, nvml.Return) { // panic("mock out the DeviceGetRemappedRows method") // }, +// DeviceGetRepairStatusFunc: func(device nvml.Device) (nvml.RepairStatus, nvml.Return) { +// panic("mock out the DeviceGetRepairStatus method") +// }, // DeviceGetRetiredPagesFunc: func(device nvml.Device, pageRetirementCause nvml.PageRetirementCause) ([]uint64, nvml.Return) { // panic("mock out the DeviceGetRetiredPages method") // }, @@ -531,6 +549,9 @@ var _ nvml.Interface = &Interface{} // DeviceGetSramEccErrorStatusFunc: func(device nvml.Device) (nvml.EccSramErrorStatus, nvml.Return) { // panic("mock out the DeviceGetSramEccErrorStatus method") // }, +// DeviceGetSramUniqueUncorrectedEccErrorCountsFunc: func(device nvml.Device, eccSramUniqueUncorrectedErrorCounts *nvml.EccSramUniqueUncorrectedErrorCounts) nvml.Return { +// panic("mock out the DeviceGetSramUniqueUncorrectedEccErrorCounts method") +// }, // DeviceGetSupportedClocksEventReasonsFunc: func(device nvml.Device) (uint64, nvml.Return) { // panic("mock out the DeviceGetSupportedClocksEventReasons method") // }, @@ -651,6 +672,9 @@ var _ nvml.Interface = &Interface{} // DeviceQueryDrainStateFunc: func(pciInfo *nvml.PciInfo) (nvml.EnableState, nvml.Return) { // panic("mock out the DeviceQueryDrainState method") // }, +// DeviceReadWritePRM_v1Func: func(device nvml.Device, pRMTLV_v1 *nvml.PRMTLV_v1) nvml.Return { +// panic("mock out the DeviceReadWritePRM_v1 method") +// }, // DeviceRegisterEventsFunc: func(device nvml.Device, v uint64, eventSet nvml.EventSet) nvml.Return { // panic("mock out the DeviceRegisterEvents method") // }, @@ -1174,6 +1198,9 @@ type Interface struct { // DeviceGetAdaptiveClockInfoStatusFunc mocks the DeviceGetAdaptiveClockInfoStatus method. DeviceGetAdaptiveClockInfoStatusFunc func(device nvml.Device) (uint32, nvml.Return) + // DeviceGetAddressingModeFunc mocks the DeviceGetAddressingMode method. + DeviceGetAddressingModeFunc func(device nvml.Device) (nvml.DeviceAddressingMode, nvml.Return) + // DeviceGetApplicationsClockFunc mocks the DeviceGetApplicationsClock method. DeviceGetApplicationsClockFunc func(device nvml.Device, clockType nvml.ClockType) (uint32, nvml.Return) @@ -1232,7 +1259,7 @@ type Interface struct { DeviceGetComputeRunningProcessesFunc func(device nvml.Device) ([]nvml.ProcessInfo, nvml.Return) // DeviceGetConfComputeGpuAttestationReportFunc mocks the DeviceGetConfComputeGpuAttestationReport method. - DeviceGetConfComputeGpuAttestationReportFunc func(device nvml.Device) (nvml.ConfComputeGpuAttestationReport, nvml.Return) + DeviceGetConfComputeGpuAttestationReportFunc func(device nvml.Device, confComputeGpuAttestationReport *nvml.ConfComputeGpuAttestationReport) nvml.Return // DeviceGetConfComputeGpuCertificateFunc mocks the DeviceGetConfComputeGpuCertificate method. DeviceGetConfComputeGpuCertificateFunc func(device nvml.Device) (nvml.ConfComputeGpuCertificate, nvml.Return) @@ -1372,6 +1399,9 @@ type Interface struct { // DeviceGetGpuInstanceProfileInfoFunc mocks the DeviceGetGpuInstanceProfileInfo method. DeviceGetGpuInstanceProfileInfoFunc func(device nvml.Device, n int) (nvml.GpuInstanceProfileInfo, nvml.Return) + // DeviceGetGpuInstanceProfileInfoByIdVFunc mocks the DeviceGetGpuInstanceProfileInfoByIdV method. + DeviceGetGpuInstanceProfileInfoByIdVFunc func(device nvml.Device, n int) nvml.GpuInstanceProfileInfoByIdHandler + // DeviceGetGpuInstanceProfileInfoVFunc mocks the DeviceGetGpuInstanceProfileInfoV method. DeviceGetGpuInstanceProfileInfoVFunc func(device nvml.Device, n int) nvml.GpuInstanceProfileInfoHandler @@ -1519,6 +1549,9 @@ type Interface struct { // DeviceGetNvLinkErrorCounterFunc mocks the DeviceGetNvLinkErrorCounter method. DeviceGetNvLinkErrorCounterFunc func(device nvml.Device, n int, nvLinkErrorCounter nvml.NvLinkErrorCounter) (uint64, nvml.Return) + // DeviceGetNvLinkInfoFunc mocks the DeviceGetNvLinkInfo method. + DeviceGetNvLinkInfoFunc func(device nvml.Device) nvml.NvLinkInfoHandler + // DeviceGetNvLinkRemoteDeviceTypeFunc mocks the DeviceGetNvLinkRemoteDeviceType method. DeviceGetNvLinkRemoteDeviceTypeFunc func(device nvml.Device, n int) (nvml.IntNvLinkDeviceType, nvml.Return) @@ -1567,6 +1600,9 @@ type Interface struct { // DeviceGetPcieThroughputFunc mocks the DeviceGetPcieThroughput method. DeviceGetPcieThroughputFunc func(device nvml.Device, pcieUtilCounter nvml.PcieUtilCounter) (uint32, nvml.Return) + // DeviceGetPdiFunc mocks the DeviceGetPdi method. + DeviceGetPdiFunc func(device nvml.Device) (nvml.Pdi, nvml.Return) + // DeviceGetPerformanceModesFunc mocks the DeviceGetPerformanceModes method. DeviceGetPerformanceModesFunc func(device nvml.Device) (nvml.DevicePerfModes, nvml.Return) @@ -1594,6 +1630,9 @@ type Interface struct { // DeviceGetPowerManagementModeFunc mocks the DeviceGetPowerManagementMode method. DeviceGetPowerManagementModeFunc func(device nvml.Device) (nvml.EnableState, nvml.Return) + // DeviceGetPowerMizerMode_v1Func mocks the DeviceGetPowerMizerMode_v1 method. + DeviceGetPowerMizerMode_v1Func func(device nvml.Device) (nvml.DevicePowerMizerModes_v1, nvml.Return) + // DeviceGetPowerSourceFunc mocks the DeviceGetPowerSource method. DeviceGetPowerSourceFunc func(device nvml.Device) (nvml.PowerSource, nvml.Return) @@ -1612,6 +1651,9 @@ type Interface struct { // DeviceGetRemappedRowsFunc mocks the DeviceGetRemappedRows method. DeviceGetRemappedRowsFunc func(device nvml.Device) (int, int, bool, bool, nvml.Return) + // DeviceGetRepairStatusFunc mocks the DeviceGetRepairStatus method. + DeviceGetRepairStatusFunc func(device nvml.Device) (nvml.RepairStatus, nvml.Return) + // DeviceGetRetiredPagesFunc mocks the DeviceGetRetiredPages method. DeviceGetRetiredPagesFunc func(device nvml.Device, pageRetirementCause nvml.PageRetirementCause) ([]uint64, nvml.Return) @@ -1636,6 +1678,9 @@ type Interface struct { // DeviceGetSramEccErrorStatusFunc mocks the DeviceGetSramEccErrorStatus method. DeviceGetSramEccErrorStatusFunc func(device nvml.Device) (nvml.EccSramErrorStatus, nvml.Return) + // DeviceGetSramUniqueUncorrectedEccErrorCountsFunc mocks the DeviceGetSramUniqueUncorrectedEccErrorCounts method. + DeviceGetSramUniqueUncorrectedEccErrorCountsFunc func(device nvml.Device, eccSramUniqueUncorrectedErrorCounts *nvml.EccSramUniqueUncorrectedErrorCounts) nvml.Return + // DeviceGetSupportedClocksEventReasonsFunc mocks the DeviceGetSupportedClocksEventReasons method. DeviceGetSupportedClocksEventReasonsFunc func(device nvml.Device) (uint64, nvml.Return) @@ -1756,6 +1801,9 @@ type Interface struct { // DeviceQueryDrainStateFunc mocks the DeviceQueryDrainState method. DeviceQueryDrainStateFunc func(pciInfo *nvml.PciInfo) (nvml.EnableState, nvml.Return) + // DeviceReadWritePRM_v1Func mocks the DeviceReadWritePRM_v1 method. + DeviceReadWritePRM_v1Func func(device nvml.Device, pRMTLV_v1 *nvml.PRMTLV_v1) nvml.Return + // DeviceRegisterEventsFunc mocks the DeviceRegisterEvents method. DeviceRegisterEventsFunc func(device nvml.Device, v uint64, eventSet nvml.EventSet) nvml.Return @@ -2326,6 +2374,11 @@ type Interface struct { // Device is the device argument value. Device nvml.Device } + // DeviceGetAddressingMode holds details about calls to the DeviceGetAddressingMode method. + DeviceGetAddressingMode []struct { + // Device is the device argument value. + Device nvml.Device + } // DeviceGetApplicationsClock holds details about calls to the DeviceGetApplicationsClock method. DeviceGetApplicationsClock []struct { // Device is the device argument value. @@ -2433,6 +2486,8 @@ type Interface struct { DeviceGetConfComputeGpuAttestationReport []struct { // Device is the device argument value. Device nvml.Device + // ConfComputeGpuAttestationReport is the confComputeGpuAttestationReport argument value. + ConfComputeGpuAttestationReport *nvml.ConfComputeGpuAttestationReport } // DeviceGetConfComputeGpuCertificate holds details about calls to the DeviceGetConfComputeGpuCertificate method. DeviceGetConfComputeGpuCertificate []struct { @@ -2688,6 +2743,13 @@ type Interface struct { // N is the n argument value. N int } + // DeviceGetGpuInstanceProfileInfoByIdV holds details about calls to the DeviceGetGpuInstanceProfileInfoByIdV method. + DeviceGetGpuInstanceProfileInfoByIdV []struct { + // Device is the device argument value. + Device nvml.Device + // N is the n argument value. + N int + } // DeviceGetGpuInstanceProfileInfoV holds details about calls to the DeviceGetGpuInstanceProfileInfoV method. DeviceGetGpuInstanceProfileInfoV []struct { // Device is the device argument value. @@ -2969,6 +3031,11 @@ type Interface struct { // NvLinkErrorCounter is the nvLinkErrorCounter argument value. NvLinkErrorCounter nvml.NvLinkErrorCounter } + // DeviceGetNvLinkInfo holds details about calls to the DeviceGetNvLinkInfo method. + DeviceGetNvLinkInfo []struct { + // Device is the device argument value. + Device nvml.Device + } // DeviceGetNvLinkRemoteDeviceType holds details about calls to the DeviceGetNvLinkRemoteDeviceType method. DeviceGetNvLinkRemoteDeviceType []struct { // Device is the device argument value. @@ -3071,6 +3138,11 @@ type Interface struct { // PcieUtilCounter is the pcieUtilCounter argument value. PcieUtilCounter nvml.PcieUtilCounter } + // DeviceGetPdi holds details about calls to the DeviceGetPdi method. + DeviceGetPdi []struct { + // Device is the device argument value. + Device nvml.Device + } // DeviceGetPerformanceModes holds details about calls to the DeviceGetPerformanceModes method. DeviceGetPerformanceModes []struct { // Device is the device argument value. @@ -3116,6 +3188,11 @@ type Interface struct { // Device is the device argument value. Device nvml.Device } + // DeviceGetPowerMizerMode_v1 holds details about calls to the DeviceGetPowerMizerMode_v1 method. + DeviceGetPowerMizerMode_v1 []struct { + // Device is the device argument value. + Device nvml.Device + } // DeviceGetPowerSource holds details about calls to the DeviceGetPowerSource method. DeviceGetPowerSource []struct { // Device is the device argument value. @@ -3148,6 +3225,11 @@ type Interface struct { // Device is the device argument value. Device nvml.Device } + // DeviceGetRepairStatus holds details about calls to the DeviceGetRepairStatus method. + DeviceGetRepairStatus []struct { + // Device is the device argument value. + Device nvml.Device + } // DeviceGetRetiredPages holds details about calls to the DeviceGetRetiredPages method. DeviceGetRetiredPages []struct { // Device is the device argument value. @@ -3196,6 +3278,13 @@ type Interface struct { // Device is the device argument value. Device nvml.Device } + // DeviceGetSramUniqueUncorrectedEccErrorCounts holds details about calls to the DeviceGetSramUniqueUncorrectedEccErrorCounts method. + DeviceGetSramUniqueUncorrectedEccErrorCounts []struct { + // Device is the device argument value. + Device nvml.Device + // EccSramUniqueUncorrectedErrorCounts is the eccSramUniqueUncorrectedErrorCounts argument value. + EccSramUniqueUncorrectedErrorCounts *nvml.EccSramUniqueUncorrectedErrorCounts + } // DeviceGetSupportedClocksEventReasons holds details about calls to the DeviceGetSupportedClocksEventReasons method. DeviceGetSupportedClocksEventReasons []struct { // Device is the device argument value. @@ -3436,6 +3525,13 @@ type Interface struct { // PciInfo is the pciInfo argument value. PciInfo *nvml.PciInfo } + // DeviceReadWritePRM_v1 holds details about calls to the DeviceReadWritePRM_v1 method. + DeviceReadWritePRM_v1 []struct { + // Device is the device argument value. + Device nvml.Device + // PRMTLV_v1 is the pRMTLV_v1 argument value. + PRMTLV_v1 *nvml.PRMTLV_v1 + } // DeviceRegisterEvents holds details about calls to the DeviceRegisterEvents method. DeviceRegisterEvents []struct { // Device is the device argument value. @@ -4347,6 +4443,7 @@ type Interface struct { lockDeviceGetAccountingStats sync.RWMutex lockDeviceGetActiveVgpus sync.RWMutex lockDeviceGetAdaptiveClockInfoStatus sync.RWMutex + lockDeviceGetAddressingMode sync.RWMutex lockDeviceGetApplicationsClock sync.RWMutex lockDeviceGetArchitecture sync.RWMutex lockDeviceGetAttributes sync.RWMutex @@ -4413,6 +4510,7 @@ type Interface struct { lockDeviceGetGpuInstanceId sync.RWMutex lockDeviceGetGpuInstancePossiblePlacements sync.RWMutex lockDeviceGetGpuInstanceProfileInfo sync.RWMutex + lockDeviceGetGpuInstanceProfileInfoByIdV sync.RWMutex lockDeviceGetGpuInstanceProfileInfoV sync.RWMutex lockDeviceGetGpuInstanceRemainingCapacity sync.RWMutex lockDeviceGetGpuInstances sync.RWMutex @@ -4462,6 +4560,7 @@ type Interface struct { lockDeviceGetNumaNodeId sync.RWMutex lockDeviceGetNvLinkCapability sync.RWMutex lockDeviceGetNvLinkErrorCounter sync.RWMutex + lockDeviceGetNvLinkInfo sync.RWMutex lockDeviceGetNvLinkRemoteDeviceType sync.RWMutex lockDeviceGetNvLinkRemotePciInfo sync.RWMutex lockDeviceGetNvLinkState sync.RWMutex @@ -4478,6 +4577,7 @@ type Interface struct { lockDeviceGetPcieReplayCounter sync.RWMutex lockDeviceGetPcieSpeed sync.RWMutex lockDeviceGetPcieThroughput sync.RWMutex + lockDeviceGetPdi sync.RWMutex lockDeviceGetPerformanceModes sync.RWMutex lockDeviceGetPerformanceState sync.RWMutex lockDeviceGetPersistenceMode sync.RWMutex @@ -4487,12 +4587,14 @@ type Interface struct { lockDeviceGetPowerManagementLimit sync.RWMutex lockDeviceGetPowerManagementLimitConstraints sync.RWMutex lockDeviceGetPowerManagementMode sync.RWMutex + lockDeviceGetPowerMizerMode_v1 sync.RWMutex lockDeviceGetPowerSource sync.RWMutex lockDeviceGetPowerState sync.RWMutex lockDeviceGetPowerUsage sync.RWMutex lockDeviceGetProcessUtilization sync.RWMutex lockDeviceGetProcessesUtilizationInfo sync.RWMutex lockDeviceGetRemappedRows sync.RWMutex + lockDeviceGetRepairStatus sync.RWMutex lockDeviceGetRetiredPages sync.RWMutex lockDeviceGetRetiredPagesPendingStatus sync.RWMutex lockDeviceGetRetiredPages_v2 sync.RWMutex @@ -4501,6 +4603,7 @@ type Interface struct { lockDeviceGetSamples sync.RWMutex lockDeviceGetSerial sync.RWMutex lockDeviceGetSramEccErrorStatus sync.RWMutex + lockDeviceGetSramUniqueUncorrectedEccErrorCounts sync.RWMutex lockDeviceGetSupportedClocksEventReasons sync.RWMutex lockDeviceGetSupportedClocksThrottleReasons sync.RWMutex lockDeviceGetSupportedEventTypes sync.RWMutex @@ -4541,6 +4644,7 @@ type Interface struct { lockDevicePowerSmoothingSetState sync.RWMutex lockDevicePowerSmoothingUpdatePresetProfileParam sync.RWMutex lockDeviceQueryDrainState sync.RWMutex + lockDeviceReadWritePRM_v1 sync.RWMutex lockDeviceRegisterEvents sync.RWMutex lockDeviceRemoveGpu sync.RWMutex lockDeviceRemoveGpu_v2 sync.RWMutex @@ -5277,6 +5381,38 @@ func (mock *Interface) DeviceGetAdaptiveClockInfoStatusCalls() []struct { return calls } +// DeviceGetAddressingMode calls DeviceGetAddressingModeFunc. +func (mock *Interface) DeviceGetAddressingMode(device nvml.Device) (nvml.DeviceAddressingMode, nvml.Return) { + if mock.DeviceGetAddressingModeFunc == nil { + panic("Interface.DeviceGetAddressingModeFunc: method is nil but Interface.DeviceGetAddressingMode was just called") + } + callInfo := struct { + Device nvml.Device + }{ + Device: device, + } + mock.lockDeviceGetAddressingMode.Lock() + mock.calls.DeviceGetAddressingMode = append(mock.calls.DeviceGetAddressingMode, callInfo) + mock.lockDeviceGetAddressingMode.Unlock() + return mock.DeviceGetAddressingModeFunc(device) +} + +// DeviceGetAddressingModeCalls gets all the calls that were made to DeviceGetAddressingMode. +// Check the length with: +// +// len(mockedInterface.DeviceGetAddressingModeCalls()) +func (mock *Interface) DeviceGetAddressingModeCalls() []struct { + Device nvml.Device +} { + var calls []struct { + Device nvml.Device + } + mock.lockDeviceGetAddressingMode.RLock() + calls = mock.calls.DeviceGetAddressingMode + mock.lockDeviceGetAddressingMode.RUnlock() + return calls +} + // DeviceGetApplicationsClock calls DeviceGetApplicationsClockFunc. func (mock *Interface) DeviceGetApplicationsClock(device nvml.Device, clockType nvml.ClockType) (uint32, nvml.Return) { if mock.DeviceGetApplicationsClockFunc == nil { @@ -5902,19 +6038,21 @@ func (mock *Interface) DeviceGetComputeRunningProcessesCalls() []struct { } // DeviceGetConfComputeGpuAttestationReport calls DeviceGetConfComputeGpuAttestationReportFunc. -func (mock *Interface) DeviceGetConfComputeGpuAttestationReport(device nvml.Device) (nvml.ConfComputeGpuAttestationReport, nvml.Return) { +func (mock *Interface) DeviceGetConfComputeGpuAttestationReport(device nvml.Device, confComputeGpuAttestationReport *nvml.ConfComputeGpuAttestationReport) nvml.Return { if mock.DeviceGetConfComputeGpuAttestationReportFunc == nil { panic("Interface.DeviceGetConfComputeGpuAttestationReportFunc: method is nil but Interface.DeviceGetConfComputeGpuAttestationReport was just called") } callInfo := struct { - Device nvml.Device + Device nvml.Device + ConfComputeGpuAttestationReport *nvml.ConfComputeGpuAttestationReport }{ - Device: device, + Device: device, + ConfComputeGpuAttestationReport: confComputeGpuAttestationReport, } mock.lockDeviceGetConfComputeGpuAttestationReport.Lock() mock.calls.DeviceGetConfComputeGpuAttestationReport = append(mock.calls.DeviceGetConfComputeGpuAttestationReport, callInfo) mock.lockDeviceGetConfComputeGpuAttestationReport.Unlock() - return mock.DeviceGetConfComputeGpuAttestationReportFunc(device) + return mock.DeviceGetConfComputeGpuAttestationReportFunc(device, confComputeGpuAttestationReport) } // DeviceGetConfComputeGpuAttestationReportCalls gets all the calls that were made to DeviceGetConfComputeGpuAttestationReport. @@ -5922,10 +6060,12 @@ func (mock *Interface) DeviceGetConfComputeGpuAttestationReport(device nvml.Devi // // len(mockedInterface.DeviceGetConfComputeGpuAttestationReportCalls()) func (mock *Interface) DeviceGetConfComputeGpuAttestationReportCalls() []struct { - Device nvml.Device + Device nvml.Device + ConfComputeGpuAttestationReport *nvml.ConfComputeGpuAttestationReport } { var calls []struct { - Device nvml.Device + Device nvml.Device + ConfComputeGpuAttestationReport *nvml.ConfComputeGpuAttestationReport } mock.lockDeviceGetConfComputeGpuAttestationReport.RLock() calls = mock.calls.DeviceGetConfComputeGpuAttestationReport @@ -7452,6 +7592,42 @@ func (mock *Interface) DeviceGetGpuInstanceProfileInfoCalls() []struct { return calls } +// DeviceGetGpuInstanceProfileInfoByIdV calls DeviceGetGpuInstanceProfileInfoByIdVFunc. +func (mock *Interface) DeviceGetGpuInstanceProfileInfoByIdV(device nvml.Device, n int) nvml.GpuInstanceProfileInfoByIdHandler { + if mock.DeviceGetGpuInstanceProfileInfoByIdVFunc == nil { + panic("Interface.DeviceGetGpuInstanceProfileInfoByIdVFunc: method is nil but Interface.DeviceGetGpuInstanceProfileInfoByIdV was just called") + } + callInfo := struct { + Device nvml.Device + N int + }{ + Device: device, + N: n, + } + mock.lockDeviceGetGpuInstanceProfileInfoByIdV.Lock() + mock.calls.DeviceGetGpuInstanceProfileInfoByIdV = append(mock.calls.DeviceGetGpuInstanceProfileInfoByIdV, callInfo) + mock.lockDeviceGetGpuInstanceProfileInfoByIdV.Unlock() + return mock.DeviceGetGpuInstanceProfileInfoByIdVFunc(device, n) +} + +// DeviceGetGpuInstanceProfileInfoByIdVCalls gets all the calls that were made to DeviceGetGpuInstanceProfileInfoByIdV. +// Check the length with: +// +// len(mockedInterface.DeviceGetGpuInstanceProfileInfoByIdVCalls()) +func (mock *Interface) DeviceGetGpuInstanceProfileInfoByIdVCalls() []struct { + Device nvml.Device + N int +} { + var calls []struct { + Device nvml.Device + N int + } + mock.lockDeviceGetGpuInstanceProfileInfoByIdV.RLock() + calls = mock.calls.DeviceGetGpuInstanceProfileInfoByIdV + mock.lockDeviceGetGpuInstanceProfileInfoByIdV.RUnlock() + return calls +} + // DeviceGetGpuInstanceProfileInfoV calls DeviceGetGpuInstanceProfileInfoVFunc. func (mock *Interface) DeviceGetGpuInstanceProfileInfoV(device nvml.Device, n int) nvml.GpuInstanceProfileInfoHandler { if mock.DeviceGetGpuInstanceProfileInfoVFunc == nil { @@ -9092,6 +9268,38 @@ func (mock *Interface) DeviceGetNvLinkErrorCounterCalls() []struct { return calls } +// DeviceGetNvLinkInfo calls DeviceGetNvLinkInfoFunc. +func (mock *Interface) DeviceGetNvLinkInfo(device nvml.Device) nvml.NvLinkInfoHandler { + if mock.DeviceGetNvLinkInfoFunc == nil { + panic("Interface.DeviceGetNvLinkInfoFunc: method is nil but Interface.DeviceGetNvLinkInfo was just called") + } + callInfo := struct { + Device nvml.Device + }{ + Device: device, + } + mock.lockDeviceGetNvLinkInfo.Lock() + mock.calls.DeviceGetNvLinkInfo = append(mock.calls.DeviceGetNvLinkInfo, callInfo) + mock.lockDeviceGetNvLinkInfo.Unlock() + return mock.DeviceGetNvLinkInfoFunc(device) +} + +// DeviceGetNvLinkInfoCalls gets all the calls that were made to DeviceGetNvLinkInfo. +// Check the length with: +// +// len(mockedInterface.DeviceGetNvLinkInfoCalls()) +func (mock *Interface) DeviceGetNvLinkInfoCalls() []struct { + Device nvml.Device +} { + var calls []struct { + Device nvml.Device + } + mock.lockDeviceGetNvLinkInfo.RLock() + calls = mock.calls.DeviceGetNvLinkInfo + mock.lockDeviceGetNvLinkInfo.RUnlock() + return calls +} + // DeviceGetNvLinkRemoteDeviceType calls DeviceGetNvLinkRemoteDeviceTypeFunc. func (mock *Interface) DeviceGetNvLinkRemoteDeviceType(device nvml.Device, n int) (nvml.IntNvLinkDeviceType, nvml.Return) { if mock.DeviceGetNvLinkRemoteDeviceTypeFunc == nil { @@ -9648,6 +9856,38 @@ func (mock *Interface) DeviceGetPcieThroughputCalls() []struct { return calls } +// DeviceGetPdi calls DeviceGetPdiFunc. +func (mock *Interface) DeviceGetPdi(device nvml.Device) (nvml.Pdi, nvml.Return) { + if mock.DeviceGetPdiFunc == nil { + panic("Interface.DeviceGetPdiFunc: method is nil but Interface.DeviceGetPdi was just called") + } + callInfo := struct { + Device nvml.Device + }{ + Device: device, + } + mock.lockDeviceGetPdi.Lock() + mock.calls.DeviceGetPdi = append(mock.calls.DeviceGetPdi, callInfo) + mock.lockDeviceGetPdi.Unlock() + return mock.DeviceGetPdiFunc(device) +} + +// DeviceGetPdiCalls gets all the calls that were made to DeviceGetPdi. +// Check the length with: +// +// len(mockedInterface.DeviceGetPdiCalls()) +func (mock *Interface) DeviceGetPdiCalls() []struct { + Device nvml.Device +} { + var calls []struct { + Device nvml.Device + } + mock.lockDeviceGetPdi.RLock() + calls = mock.calls.DeviceGetPdi + mock.lockDeviceGetPdi.RUnlock() + return calls +} + // DeviceGetPerformanceModes calls DeviceGetPerformanceModesFunc. func (mock *Interface) DeviceGetPerformanceModes(device nvml.Device) (nvml.DevicePerfModes, nvml.Return) { if mock.DeviceGetPerformanceModesFunc == nil { @@ -9936,6 +10176,38 @@ func (mock *Interface) DeviceGetPowerManagementModeCalls() []struct { return calls } +// DeviceGetPowerMizerMode_v1 calls DeviceGetPowerMizerMode_v1Func. +func (mock *Interface) DeviceGetPowerMizerMode_v1(device nvml.Device) (nvml.DevicePowerMizerModes_v1, nvml.Return) { + if mock.DeviceGetPowerMizerMode_v1Func == nil { + panic("Interface.DeviceGetPowerMizerMode_v1Func: method is nil but Interface.DeviceGetPowerMizerMode_v1 was just called") + } + callInfo := struct { + Device nvml.Device + }{ + Device: device, + } + mock.lockDeviceGetPowerMizerMode_v1.Lock() + mock.calls.DeviceGetPowerMizerMode_v1 = append(mock.calls.DeviceGetPowerMizerMode_v1, callInfo) + mock.lockDeviceGetPowerMizerMode_v1.Unlock() + return mock.DeviceGetPowerMizerMode_v1Func(device) +} + +// DeviceGetPowerMizerMode_v1Calls gets all the calls that were made to DeviceGetPowerMizerMode_v1. +// Check the length with: +// +// len(mockedInterface.DeviceGetPowerMizerMode_v1Calls()) +func (mock *Interface) DeviceGetPowerMizerMode_v1Calls() []struct { + Device nvml.Device +} { + var calls []struct { + Device nvml.Device + } + mock.lockDeviceGetPowerMizerMode_v1.RLock() + calls = mock.calls.DeviceGetPowerMizerMode_v1 + mock.lockDeviceGetPowerMizerMode_v1.RUnlock() + return calls +} + // DeviceGetPowerSource calls DeviceGetPowerSourceFunc. func (mock *Interface) DeviceGetPowerSource(device nvml.Device) (nvml.PowerSource, nvml.Return) { if mock.DeviceGetPowerSourceFunc == nil { @@ -10132,6 +10404,38 @@ func (mock *Interface) DeviceGetRemappedRowsCalls() []struct { return calls } +// DeviceGetRepairStatus calls DeviceGetRepairStatusFunc. +func (mock *Interface) DeviceGetRepairStatus(device nvml.Device) (nvml.RepairStatus, nvml.Return) { + if mock.DeviceGetRepairStatusFunc == nil { + panic("Interface.DeviceGetRepairStatusFunc: method is nil but Interface.DeviceGetRepairStatus was just called") + } + callInfo := struct { + Device nvml.Device + }{ + Device: device, + } + mock.lockDeviceGetRepairStatus.Lock() + mock.calls.DeviceGetRepairStatus = append(mock.calls.DeviceGetRepairStatus, callInfo) + mock.lockDeviceGetRepairStatus.Unlock() + return mock.DeviceGetRepairStatusFunc(device) +} + +// DeviceGetRepairStatusCalls gets all the calls that were made to DeviceGetRepairStatus. +// Check the length with: +// +// len(mockedInterface.DeviceGetRepairStatusCalls()) +func (mock *Interface) DeviceGetRepairStatusCalls() []struct { + Device nvml.Device +} { + var calls []struct { + Device nvml.Device + } + mock.lockDeviceGetRepairStatus.RLock() + calls = mock.calls.DeviceGetRepairStatus + mock.lockDeviceGetRepairStatus.RUnlock() + return calls +} + // DeviceGetRetiredPages calls DeviceGetRetiredPagesFunc. func (mock *Interface) DeviceGetRetiredPages(device nvml.Device, pageRetirementCause nvml.PageRetirementCause) ([]uint64, nvml.Return) { if mock.DeviceGetRetiredPagesFunc == nil { @@ -10404,6 +10708,42 @@ func (mock *Interface) DeviceGetSramEccErrorStatusCalls() []struct { return calls } +// DeviceGetSramUniqueUncorrectedEccErrorCounts calls DeviceGetSramUniqueUncorrectedEccErrorCountsFunc. +func (mock *Interface) DeviceGetSramUniqueUncorrectedEccErrorCounts(device nvml.Device, eccSramUniqueUncorrectedErrorCounts *nvml.EccSramUniqueUncorrectedErrorCounts) nvml.Return { + if mock.DeviceGetSramUniqueUncorrectedEccErrorCountsFunc == nil { + panic("Interface.DeviceGetSramUniqueUncorrectedEccErrorCountsFunc: method is nil but Interface.DeviceGetSramUniqueUncorrectedEccErrorCounts was just called") + } + callInfo := struct { + Device nvml.Device + EccSramUniqueUncorrectedErrorCounts *nvml.EccSramUniqueUncorrectedErrorCounts + }{ + Device: device, + EccSramUniqueUncorrectedErrorCounts: eccSramUniqueUncorrectedErrorCounts, + } + mock.lockDeviceGetSramUniqueUncorrectedEccErrorCounts.Lock() + mock.calls.DeviceGetSramUniqueUncorrectedEccErrorCounts = append(mock.calls.DeviceGetSramUniqueUncorrectedEccErrorCounts, callInfo) + mock.lockDeviceGetSramUniqueUncorrectedEccErrorCounts.Unlock() + return mock.DeviceGetSramUniqueUncorrectedEccErrorCountsFunc(device, eccSramUniqueUncorrectedErrorCounts) +} + +// DeviceGetSramUniqueUncorrectedEccErrorCountsCalls gets all the calls that were made to DeviceGetSramUniqueUncorrectedEccErrorCounts. +// Check the length with: +// +// len(mockedInterface.DeviceGetSramUniqueUncorrectedEccErrorCountsCalls()) +func (mock *Interface) DeviceGetSramUniqueUncorrectedEccErrorCountsCalls() []struct { + Device nvml.Device + EccSramUniqueUncorrectedErrorCounts *nvml.EccSramUniqueUncorrectedErrorCounts +} { + var calls []struct { + Device nvml.Device + EccSramUniqueUncorrectedErrorCounts *nvml.EccSramUniqueUncorrectedErrorCounts + } + mock.lockDeviceGetSramUniqueUncorrectedEccErrorCounts.RLock() + calls = mock.calls.DeviceGetSramUniqueUncorrectedEccErrorCounts + mock.lockDeviceGetSramUniqueUncorrectedEccErrorCounts.RUnlock() + return calls +} + // DeviceGetSupportedClocksEventReasons calls DeviceGetSupportedClocksEventReasonsFunc. func (mock *Interface) DeviceGetSupportedClocksEventReasons(device nvml.Device) (uint64, nvml.Return) { if mock.DeviceGetSupportedClocksEventReasonsFunc == nil { @@ -11764,6 +12104,42 @@ func (mock *Interface) DeviceQueryDrainStateCalls() []struct { return calls } +// DeviceReadWritePRM_v1 calls DeviceReadWritePRM_v1Func. +func (mock *Interface) DeviceReadWritePRM_v1(device nvml.Device, pRMTLV_v1 *nvml.PRMTLV_v1) nvml.Return { + if mock.DeviceReadWritePRM_v1Func == nil { + panic("Interface.DeviceReadWritePRM_v1Func: method is nil but Interface.DeviceReadWritePRM_v1 was just called") + } + callInfo := struct { + Device nvml.Device + PRMTLV_v1 *nvml.PRMTLV_v1 + }{ + Device: device, + PRMTLV_v1: pRMTLV_v1, + } + mock.lockDeviceReadWritePRM_v1.Lock() + mock.calls.DeviceReadWritePRM_v1 = append(mock.calls.DeviceReadWritePRM_v1, callInfo) + mock.lockDeviceReadWritePRM_v1.Unlock() + return mock.DeviceReadWritePRM_v1Func(device, pRMTLV_v1) +} + +// DeviceReadWritePRM_v1Calls gets all the calls that were made to DeviceReadWritePRM_v1. +// Check the length with: +// +// len(mockedInterface.DeviceReadWritePRM_v1Calls()) +func (mock *Interface) DeviceReadWritePRM_v1Calls() []struct { + Device nvml.Device + PRMTLV_v1 *nvml.PRMTLV_v1 +} { + var calls []struct { + Device nvml.Device + PRMTLV_v1 *nvml.PRMTLV_v1 + } + mock.lockDeviceReadWritePRM_v1.RLock() + calls = mock.calls.DeviceReadWritePRM_v1 + mock.lockDeviceReadWritePRM_v1.RUnlock() + return calls +} + // DeviceRegisterEvents calls DeviceRegisterEventsFunc. func (mock *Interface) DeviceRegisterEvents(device nvml.Device, v uint64, eventSet nvml.EventSet) nvml.Return { if mock.DeviceRegisterEventsFunc == nil { diff --git a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/nvml.go b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/nvml.go index 95d67d6..38123a9 100644 --- a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/nvml.go +++ b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/nvml.go @@ -378,6 +378,24 @@ func nvmlDeviceGetNumaNodeId(nvmlDevice nvmlDevice, Node *uint32) Return { return __v } +// nvmlDeviceGetAddressingMode function as declared in nvml/nvml.h +func nvmlDeviceGetAddressingMode(nvmlDevice nvmlDevice, Mode *DeviceAddressingMode) Return { + cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown + cMode, _ := (*C.nvmlDeviceAddressingMode_t)(unsafe.Pointer(Mode)), cgoAllocsUnknown + __ret := C.nvmlDeviceGetAddressingMode(cnvmlDevice, cMode) + __v := (Return)(__ret) + return __v +} + +// nvmlDeviceGetRepairStatus function as declared in nvml/nvml.h +func nvmlDeviceGetRepairStatus(nvmlDevice nvmlDevice, RepairStatus *RepairStatus) Return { + cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown + cRepairStatus, _ := (*C.nvmlRepairStatus_t)(unsafe.Pointer(RepairStatus)), cgoAllocsUnknown + __ret := C.nvmlDeviceGetRepairStatus(cnvmlDevice, cRepairStatus) + __v := (Return)(__ret) + return __v +} + // nvmlDeviceGetTopologyCommonAncestor function as declared in nvml/nvml.h func nvmlDeviceGetTopologyCommonAncestor(Device1 nvmlDevice, Device2 nvmlDevice, PathInfo *GpuTopologyLevel) Return { cDevice1, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&Device1)), cgoAllocsUnknown @@ -1017,6 +1035,24 @@ func nvmlDeviceGetPowerUsage(nvmlDevice nvmlDevice, Power *uint32) Return { return __v } +// nvmlDeviceGetPowerMizerMode_v1 function as declared in nvml/nvml.h +func nvmlDeviceGetPowerMizerMode_v1(nvmlDevice nvmlDevice, PowerMizerMode *DevicePowerMizerModes_v1) Return { + cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown + cPowerMizerMode, _ := (*C.nvmlDevicePowerMizerModes_v1_t)(unsafe.Pointer(PowerMizerMode)), cgoAllocsUnknown + __ret := C.nvmlDeviceGetPowerMizerMode_v1(cnvmlDevice, cPowerMizerMode) + __v := (Return)(__ret) + return __v +} + +// nvmlDeviceSetPowerMizerMode_v1 function as declared in nvml/nvml.h +func nvmlDeviceSetPowerMizerMode_v1(nvmlDevice nvmlDevice, PowerMizerMode *DevicePowerMizerModes_v1) Return { + cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown + cPowerMizerMode, _ := (*C.nvmlDevicePowerMizerModes_v1_t)(unsafe.Pointer(PowerMizerMode)), cgoAllocsUnknown + __ret := C.nvmlDeviceSetPowerMizerMode_v1(cnvmlDevice, cPowerMizerMode) + __v := (Return)(__ret) + return __v +} + // nvmlDeviceGetTotalEnergyConsumption function as declared in nvml/nvml.h func nvmlDeviceGetTotalEnergyConsumption(nvmlDevice nvmlDevice, Energy *uint64) Return { cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown @@ -1610,6 +1646,15 @@ func nvmlDeviceGetSramEccErrorStatus(nvmlDevice nvmlDevice, Status *EccSramError return __v } +// nvmlDeviceSetPowerManagementLimit_v2 function as declared in nvml/nvml.h +func nvmlDeviceSetPowerManagementLimit_v2(nvmlDevice nvmlDevice, PowerValue *PowerValue_v2) Return { + cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown + cPowerValue, _ := (*C.nvmlPowerValue_v2_t)(unsafe.Pointer(PowerValue)), cgoAllocsUnknown + __ret := C.nvmlDeviceSetPowerManagementLimit_v2(cnvmlDevice, cPowerValue) + __v := (Return)(__ret) + return __v +} + // nvmlDeviceGetAccountingMode function as declared in nvml/nvml.h func nvmlDeviceGetAccountingMode(nvmlDevice nvmlDevice, Mode *EnableState) Return { cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown @@ -1748,6 +1793,15 @@ func nvmlDeviceGetPlatformInfo(nvmlDevice nvmlDevice, PlatformInfo *PlatformInfo return __v } +// nvmlDeviceGetPdi function as declared in nvml/nvml.h +func nvmlDeviceGetPdi(nvmlDevice nvmlDevice, Pdi *Pdi) Return { + cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown + cPdi, _ := (*C.nvmlPdi_t)(unsafe.Pointer(Pdi)), cgoAllocsUnknown + __ret := C.nvmlDeviceGetPdi(cnvmlDevice, cPdi) + __v := (Return)(__ret) + return __v +} + // nvmlUnitSetLedState function as declared in nvml/nvml.h func nvmlUnitSetLedState(nvmlUnit nvmlUnit, Color LedColor) Return { cnvmlUnit, _ := *(*C.nvmlUnit_t)(unsafe.Pointer(&nvmlUnit)), cgoAllocsUnknown @@ -1978,15 +2032,6 @@ func nvmlDeviceClearAccountingPids(nvmlDevice nvmlDevice) Return { return __v } -// nvmlDeviceSetPowerManagementLimit_v2 function as declared in nvml/nvml.h -func nvmlDeviceSetPowerManagementLimit_v2(nvmlDevice nvmlDevice, PowerValue *PowerValue_v2) Return { - cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown - cPowerValue, _ := (*C.nvmlPowerValue_v2_t)(unsafe.Pointer(PowerValue)), cgoAllocsUnknown - __ret := C.nvmlDeviceSetPowerManagementLimit_v2(cnvmlDevice, cPowerValue) - __v := (Return)(__ret) - return __v -} - // nvmlDeviceGetNvLinkState function as declared in nvml/nvml.h func nvmlDeviceGetNvLinkState(nvmlDevice nvmlDevice, Link uint32, IsActive *EnableState) Return { cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown @@ -2166,6 +2211,15 @@ func nvmlDeviceSetNvlinkBwMode(nvmlDevice nvmlDevice, SetBwMode *NvlinkSetBwMode return __v } +// nvmlDeviceGetNvLinkInfo function as declared in nvml/nvml.h +func nvmlDeviceGetNvLinkInfo(nvmlDevice nvmlDevice, Info *NvLinkInfo) Return { + cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown + cInfo, _ := (*C.nvmlNvLinkInfo_t)(unsafe.Pointer(Info)), cgoAllocsUnknown + __ret := C.nvmlDeviceGetNvLinkInfo(cnvmlDevice, cInfo) + __v := (Return)(__ret) + return __v +} + // nvmlEventSetCreate function as declared in nvml/nvml.h func nvmlEventSetCreate(Set *nvmlEventSet) Return { cSet, _ := (*C.nvmlEventSet_t)(unsafe.Pointer(Set)), cgoAllocsUnknown @@ -3033,6 +3087,15 @@ func nvmlGetExcludedDeviceInfoByIndex(Index uint32, Info *ExcludedDeviceInfo) Re return __v } +// nvmlDeviceReadWritePRM_v1 function as declared in nvml/nvml.h +func nvmlDeviceReadWritePRM_v1(nvmlDevice nvmlDevice, Buffer *PRMTLV_v1) Return { + cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown + cBuffer, _ := (*C.nvmlPRMTLV_v1_t)(unsafe.Pointer(Buffer)), cgoAllocsUnknown + __ret := C.nvmlDeviceReadWritePRM_v1(cnvmlDevice, cBuffer) + __v := (Return)(__ret) + return __v +} + // nvmlDeviceSetMigMode function as declared in nvml/nvml.h func nvmlDeviceSetMigMode(nvmlDevice nvmlDevice, Mode uint32, ActivationStatus *Return) Return { cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown @@ -3073,6 +3136,16 @@ func nvmlDeviceGetGpuInstanceProfileInfoV(nvmlDevice nvmlDevice, Profile uint32, return __v } +// nvmlDeviceGetGpuInstanceProfileInfoByIdV function as declared in nvml/nvml.h +func nvmlDeviceGetGpuInstanceProfileInfoByIdV(nvmlDevice nvmlDevice, ProfileId uint32, Info *GpuInstanceProfileInfo_v2) Return { + cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown + cProfileId, _ := (C.uint)(ProfileId), cgoAllocsUnknown + cInfo, _ := (*C.nvmlGpuInstanceProfileInfo_v2_t)(unsafe.Pointer(Info)), cgoAllocsUnknown + __ret := C.nvmlDeviceGetGpuInstanceProfileInfoByIdV(cnvmlDevice, cProfileId, cInfo) + __v := (Return)(__ret) + return __v +} + // nvmlDeviceGetGpuInstancePossiblePlacements_v2 function as declared in nvml/nvml.h func nvmlDeviceGetGpuInstancePossiblePlacements_v2(nvmlDevice nvmlDevice, ProfileId uint32, Placements *GpuInstancePlacement, Count *uint32) Return { cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown @@ -3452,6 +3525,15 @@ func nvmlDevicePowerSmoothingSetState(nvmlDevice nvmlDevice, State *PowerSmoothi return __v } +// nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts function as declared in nvml/nvml.h +func nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(nvmlDevice nvmlDevice, ErrorCounts *EccSramUniqueUncorrectedErrorCounts) Return { + cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown + cErrorCounts, _ := (*C.nvmlEccSramUniqueUncorrectedErrorCounts_t)(unsafe.Pointer(ErrorCounts)), cgoAllocsUnknown + __ret := C.nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(cnvmlDevice, cErrorCounts) + __v := (Return)(__ret) + return __v +} + // nvmlInit_v1 function as declared in nvml/nvml.h func nvmlInit_v1() Return { __ret := C.nvmlInit() diff --git a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/nvml.h b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/nvml.h index 28a6547..917a8c9 100644 --- a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/nvml.h +++ b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/nvml.h @@ -1,5 +1,5 @@ -/*** NVML VERSION: 12.9.40 ***/ -/*** From https://gitlab.com/nvidia/headers/cuda-individual/nvml_dev/-/raw/v12.9.40/nvml.h ***/ +/*** NVML VERSION: 13.0.39 ***/ +/*** From https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvml_dev/linux-x86_64/cuda_nvml_dev-linux-x86_64-13.0.39-archive.tar.xz ***/ /* * Copyright 1993-2025 NVIDIA Corporation. All rights reserved. * @@ -94,13 +94,23 @@ extern "C" { #define DECLDIR #endif +/* + * Deprecation definition. Starting CUDA 13.1 this will change to: + * #if defined _WINDOWS + * #define DEPRECATED(ver) __declspec(deprecated) + * #else + * #define DEPRECATED(ver) __attribute__((deprecated)) + * #endif + */ +#define DEPRECATED(ver) /* nop in CUDA 13.0, enabled in CUDA 13.1 */ + #define NVML_MCDM_SUPPORT /** * NVML API versioning support */ -#define NVML_API_VERSION 12 -#define NVML_API_VERSION_STR "12" +#define NVML_API_VERSION 13 +#define NVML_API_VERSION_STR "13" /** * Defining NVML_NO_UNVERSIONED_FUNC_DEFS will disable "auto upgrading" of APIs. * e.g. the user will have to call nvmlInit_v2 instead of nvmlInit. Enable this @@ -162,7 +172,7 @@ typedef struct #define NVML_DEVICE_PCI_BUS_ID_BUFFER_SIZE 32 /** - * Buffer size guaranteed to be large enough for pci bus id for ::busIdLegacy + * Buffer size guaranteed to be large enough for pci bus id for \p busIdLegacy */ #define NVML_DEVICE_PCI_BUS_ID_BUFFER_V2_SIZE 16 @@ -205,12 +215,12 @@ typedef struct nvmlPciInfo_st } nvmlPciInfo_t; /** - * PCI format string for ::busIdLegacy + * PCI format string for \p busIdLegacy */ #define NVML_DEVICE_PCI_BUS_ID_LEGACY_FMT "%04X:%02X:%02X.0" /** - * PCI format string for ::busId + * PCI format string for \p busId */ #define NVML_DEVICE_PCI_BUS_ID_FMT "%08X:%02X:%02X.0" @@ -367,6 +377,41 @@ typedef struct #define nvmlC2cModeInfo_v1 NVML_STRUCT_VERSION(C2cModeInfo, 1) +/** + * Enum to represent device addressing mode values + */ +typedef enum +{ + NVML_DEVICE_ADDRESSING_MODE_NONE = 0, //!< No active mode + NVML_DEVICE_ADDRESSING_MODE_HMM = 1, //!< Heterogeneous Memory Management mode + NVML_DEVICE_ADDRESSING_MODE_ATS = 2, //!< Address Translation Services mode +} nvmlDeviceAddressingModeType_t; + +/** + * Struct to represent device addressing mode information + */ +typedef struct +{ + unsigned int version; //!< API version + unsigned int value; //!< One of \ref nvmlDeviceAddressingModeType_t +} nvmlDeviceAddressingMode_v1_t; +typedef nvmlDeviceAddressingMode_v1_t nvmlDeviceAddressingMode_t; + +#define nvmlDeviceAddressingMode_v1 NVML_STRUCT_VERSION(DeviceAddressingMode, 1) + +/** + * Struct to represent the NVML repair status + */ +typedef struct +{ + unsigned int version; //!< API version number + unsigned int bChannelRepairPending; //!< Reference to \a unsigned int + unsigned int bTpcRepairPending; //!< Reference to \a unsigned int +} nvmlRepairStatus_v1_t; +typedef nvmlRepairStatus_v1_t nvmlRepairStatus_t; + +#define nvmlRepairStatus_v1 NVML_STRUCT_VERSION(RepairStatus, 1) + /** * Possible values that classify the remap availability for each bank. The max * field will contain the number of banks that have maximum remap availability @@ -698,21 +743,20 @@ typedef enum NVML_THERMAL_CONTROLLER_UNKNOWN = -1, } nvmlThermalController_t; -typedef struct { - nvmlThermalController_t controller; - int defaultMinTemp; - int defaultMaxTemp; - int currentTemp; - nvmlThermalTarget_t target; -} nvmlGpuThermalSettingsSensor_t; - /** * Struct to hold the thermal sensor settings */ typedef struct { unsigned int count; - nvmlGpuThermalSettingsSensor_t sensor[NVML_MAX_THERMAL_SENSORS_PER_GPU]; + struct + { + nvmlThermalController_t controller; + int defaultMinTemp; + int defaultMaxTemp; + int currentTemp; + nvmlThermalTarget_t target; + } sensor[NVML_MAX_THERMAL_SENSORS_PER_GPU]; } nvmlGpuThermalSettings_t; @@ -794,6 +838,18 @@ typedef nvmlUUID_v1_t nvmlUUID_t; #define nvmlUUID_v1 NVML_STRUCT_VERSION(UUID, 1) +/** + * Struct to represent the NVML PDI information + */ +typedef struct +{ + unsigned int version; //!< API version number + unsigned long long value; //!< 64-bit PDI value +} nvmlPdi_v1_t; +typedef nvmlPdi_v1_t nvmlPdi_t; + +#define nvmlPdi_v1 NVML_STRUCT_VERSION(Pdi, 1) + /** @} */ /***************************************************************************************************/ @@ -851,9 +907,8 @@ typedef enum nvmlBrandType_enum NVML_BRAND_NVIDIA = 14, NVML_BRAND_GEFORCE_RTX = 15, // Unused NVML_BRAND_TITAN_RTX = 16, // Unused - // Keep this last - NVML_BRAND_COUNT + NVML_BRAND_COUNT = 18, } nvmlBrandType_t; /** @@ -1064,8 +1119,10 @@ typedef enum nvmlClockType_enum typedef enum nvmlClockId_enum { NVML_CLOCK_ID_CURRENT = 0, //!< Current actual clock value - NVML_CLOCK_ID_APP_CLOCK_TARGET = 1, //!< Target application clock + NVML_CLOCK_ID_APP_CLOCK_TARGET = 1, //!< Target application clock. + //!< Deprecated, do not use. NVML_CLOCK_ID_APP_CLOCK_DEFAULT = 2, //!< Default application clock target + //!< Deprecated, do not use. NVML_CLOCK_ID_CUSTOMER_BOOST_MAX = 3, //!< OEM-defined maximum clock rate //Keep this last @@ -1167,6 +1224,22 @@ typedef nvmlDeviceCurrentClockFreqs_v1_t nvmlDeviceCurrentClockFreqs_t; #define nvmlDeviceCurrentClockFreqs_v1 NVML_STRUCT_VERSION(DeviceCurrentClockFreqs, 1) +/** + * Device powerMizer modes + */ +#define NVML_POWER_MIZER_MODE_ADAPTIVE 0 //!< adjust GPU clocks based on GPU utilization +#define NVML_POWER_MIZER_MODE_PREFER_MAXIMUM_PERFORMANCE 1 //!< raise GPU clocks to favor maximum performance, + //!< to the extent that thermal and other constraints allow +#define NVML_POWER_MIZER_MODE_AUTO 2 //!< PowerMizer mode is driver controlled. +#define NVML_POWER_MIZER_MODE_PREFER_CONSISTENT_PERFORMANCE 3 //!< lock to GPU base clocks + +typedef struct +{ + unsigned int currentMode; //!< OUT: the current powermizer mode + unsigned int mode; //!< IN: the powermizer mode to set + unsigned int supportedPowerMizerModes; //!< OUT: Bitmask of supported powermizer modes +} nvmlDevicePowerMizerModes_v1_t; + /** * GPU Operation Mode * @@ -1234,6 +1307,7 @@ typedef enum nvmlReturn_enum NVML_ERROR_NOT_READY = 27, //!< The system is not ready for the request NVML_ERROR_GPU_NOT_FOUND = 28, //!< No GPUs were found NVML_ERROR_INVALID_STATE = 29, //!< Resource not in correct state to perform requested operation + NVML_ERROR_RESET_TYPE_NOT_SUPPORTED = 30, //!< Reset not supported for given device/parameters NVML_ERROR_UNKNOWN = 999 //!< An internal driver error occurred } nvmlReturn_t; @@ -1273,7 +1347,8 @@ typedef enum nvmlPageRetirementCause_enum typedef enum nvmlRestrictedAPI_enum { NVML_RESTRICTED_API_SET_APPLICATION_CLOCKS = 0, //!< APIs that change application clocks, see nvmlDeviceSetApplicationsClocks - //!< and see nvmlDeviceResetApplicationsClocks + //!< and see nvmlDeviceResetApplicationsClocks. + //!< Deprecated, keeping definition for backward compatibility. NVML_RESTRICTED_API_SET_AUTO_BOOSTED_CLOCKS = 1, //!< APIs that enable/disable Auto Boosted clocks //!< see nvmlDeviceSetAutoBoostedClocksEnabled // Keep this last @@ -1381,6 +1456,27 @@ typedef struct typedef nvmlPlatformInfo_v2_t nvmlPlatformInfo_t; #define nvmlPlatformInfo_v2 NVML_STRUCT_VERSION(PlatformInfo, 2) +typedef struct +{ + unsigned int unit; //!< the SRAM unit index + unsigned int location; //!< the error location within the SRAM unit + unsigned int sublocation; //!< the error sublocation within the SRAM unit + unsigned int extlocation; //!< the error extlocation within the SRAM unit + unsigned int address; //!< the error address within the SRAM unit + unsigned int isParity; //!< if the SRAM error is parity or not + unsigned int count; //!< the error count at the same SRAM address +} nvmlEccSramUniqueUncorrectedErrorEntry_v1_t; + +typedef struct +{ + unsigned int version; //!< the API version number + unsigned int entryCount; //!< the number of error count entries + nvmlEccSramUniqueUncorrectedErrorEntry_v1_t *entries; //!< pointer to caller-supplied buffer to return the SRAM unique uncorrected ECC error count entries +} nvmlEccSramUniqueUncorrectedErrorCounts_v1_t; + +typedef nvmlEccSramUniqueUncorrectedErrorCounts_v1_t nvmlEccSramUniqueUncorrectedErrorCounts_t; +#define nvmlEccSramUniqueUncorrectedErrorCounts_v1 NVML_STRUCT_VERSION(EccSramUniqueUncorrectedErrorCounts, 1) + /** * GSP firmware */ @@ -1400,8 +1496,6 @@ typedef nvmlPlatformInfo_v2_t nvmlPlatformInfo_t; #define NVML_DEVICE_ARCH_BLACKWELL 10 // Devices based on the NVIDIA Blackwell architecture -#define NVML_DEVICE_ARCH_T23X 11 // Devices based on NVIDIA Orin architecture - #define NVML_DEVICE_ARCH_UNKNOWN 0xffffffff // Anything else, presumably something newer typedef unsigned int nvmlDeviceArchitecture_t; @@ -1468,17 +1562,16 @@ typedef enum nvmlGpuUtilizationDomainId_t NVML_GPU_UTILIZATION_DOMAIN_BUS = 3, //!< Bus interface domain } nvmlGpuUtilizationDomainId_t; -typedef struct { - unsigned int bIsPresent; - unsigned int percentage; - unsigned int incThreshold; - unsigned int decThreshold; -} nvmlGpuDynamicPstatesInfoUtilization_t; - typedef struct nvmlGpuDynamicPstatesInfo_st { unsigned int flags; //!< Reserved for future use - nvmlGpuDynamicPstatesInfoUtilization_t utilization[NVML_MAX_GPU_UTILIZATIONS]; + struct + { + unsigned int bIsPresent; //!< Set if this utilization domain is present on this GPU + unsigned int percentage; //!< Percentage of time where the domain is considered busy in the last 1-second interval + unsigned int incThreshold; //!< Utilization threshold that can trigger a perf-increasing P-State change when crossed + unsigned int decThreshold; //!< Utilization threshold that can trigger a perf-decreasing P-State change when crossed + } utilization[NVML_MAX_GPU_UTILIZATIONS]; } nvmlGpuDynamicPstatesInfo_t; /* @@ -1864,23 +1957,21 @@ typedef nvmlVgpuRuntimeState_v1_t nvmlVgpuRuntimeState_t; */ #define NVML_VGPU_SCHEDULER_ENGINE_TYPE_GRAPHICS 1 -typedef struct { - unsigned int avgFactor; - unsigned int timeslice; -} nvmlVgpuSchedulerParamsVgpuSchedDataWithARR_t; - -typedef struct { - unsigned int timeslice; -} nvmlVgpuSchedulerParamsVgpuSchedData_t; - /** * Union to represent the vGPU Scheduler Parameters */ typedef union { - nvmlVgpuSchedulerParamsVgpuSchedDataWithARR_t vgpuSchedDataWithARR; + struct + { + unsigned int avgFactor; //!< Average factor in compensating the timeslice for Adaptive Round Robin mode + unsigned int timeslice; //!< The timeslice in ns for each software run list as configured, or the default value otherwise + } vgpuSchedDataWithARR; - nvmlVgpuSchedulerParamsVgpuSchedData_t vgpuSchedData; + struct + { + unsigned int timeslice; //!< The timeslice in ns for each software run list as configured, or the default value otherwise + } vgpuSchedData; } nvmlVgpuSchedulerParams_t; @@ -1920,23 +2011,21 @@ typedef struct nvmlVgpuSchedulerGetState_st nvmlVgpuSchedulerParams_t schedulerParams; } nvmlVgpuSchedulerGetState_t; -typedef struct { - unsigned int avgFactor; - unsigned int frequency; -} nvmlVgpuSchedulerSetParamsVgpuSchedDataWithARR_t; - -typedef struct { - unsigned int timeslice; -} nvmlVgpuSchedulerSetParamsVgpuSchedData_t; - /** * Union to represent the vGPU Scheduler set Parameters */ typedef union { - nvmlVgpuSchedulerSetParamsVgpuSchedDataWithARR_t vgpuSchedDataWithARR; + struct + { + unsigned int avgFactor; //!< Average factor in compensating the timeslice for Adaptive Round Robin mode + unsigned int frequency; //!< Frequency for Adaptive Round Robin mode + } vgpuSchedDataWithARR; - nvmlVgpuSchedulerSetParamsVgpuSchedData_t vgpuSchedData; + struct + { + unsigned int timeslice; //!< The timeslice in ns(Nanoseconds) for each software run list as configured, or the default value otherwise + } vgpuSchedData; } nvmlVgpuSchedulerSetParams_t; @@ -2923,8 +3012,9 @@ typedef struct nvmlEventData_st // 0xFFFFFFFF otherwise. } nvmlEventData_t; -/** @} */ - +/** + * System Event Set + */ typedef struct { struct nvmlSystemEventSet_st* handle; @@ -3010,10 +3100,8 @@ typedef nvmlSystemEventSetWaitRequest_v1_t nvmlSystemEventSetWaitRequest_t; */ #define nvmlClocksEventReasonGpuIdle 0x0000000000000001LL -/** GPU clocks are limited by current setting of applications clocks - * - * @see nvmlDeviceSetApplicationsClocks - * @see nvmlDeviceGetApplicationsClock +/* + * @deprecated No longer used */ #define nvmlClocksEventReasonApplicationsClocksSetting 0x0000000000000002LL @@ -3120,7 +3208,7 @@ typedef nvmlSystemEventSetWaitRequest_v1_t nvmlSystemEventSetWaitRequest_t; */ #define nvmlClocksThrottleReasonGpuIdle nvmlClocksEventReasonGpuIdle /** - * @deprecated Use \ref nvmlClocksEventReasonApplicationsClocksSetting instead + * @deprecated */ #define nvmlClocksThrottleReasonApplicationsClocksSetting nvmlClocksEventReasonApplicationsClocksSetting /** @@ -3359,8 +3447,9 @@ typedef struct nvmlConfComputeSystemState_st { /** * Confidential Compute Multigpu mode values */ -#define NVML_CC_SYSTEM_MULTIGPU_NONE 0 +#define NVML_CC_SYSTEM_MULTIGPU_NONE 0 #define NVML_CC_SYSTEM_MULTIGPU_PROTECTED_PCIE 1 +#define NVML_CC_SYSTEM_MULTIGPU_NVLE 2 /** * Confidential Compute System settings @@ -3451,64 +3540,92 @@ typedef nvmlConfComputeGetKeyRotationThresholdInfo_v1_t nvmlConfComputeGetKeyRot */ /***************************************************************************************************/ -#define NVML_GPU_FABRIC_UUID_LEN 16 +#define NVML_GPU_FABRIC_UUID_LEN 16 //!< Length of Fabric UUID -#define NVML_GPU_FABRIC_STATE_NOT_SUPPORTED 0 -#define NVML_GPU_FABRIC_STATE_NOT_STARTED 1 -#define NVML_GPU_FABRIC_STATE_IN_PROGRESS 2 -#define NVML_GPU_FABRIC_STATE_COMPLETED 3 +/** + * Fabric Probe States + */ +#define NVML_GPU_FABRIC_STATE_NOT_SUPPORTED 0 //!< Fabric Probe State not supported +#define NVML_GPU_FABRIC_STATE_NOT_STARTED 1 //!< Fabric Probe has not started +#define NVML_GPU_FABRIC_STATE_IN_PROGRESS 2 //!< Fabric Probe in progress +#define NVML_GPU_FABRIC_STATE_COMPLETED 3 //!< Fabric Probe State completed +/** + * Probe State of GPU registration process + */ typedef unsigned char nvmlGpuFabricState_t; /** * Contains the device fabric information */ -typedef struct { +typedef struct +{ unsigned char clusterUuid[NVML_GPU_FABRIC_UUID_LEN]; //!< Uuid of the cluster to which this GPU belongs nvmlReturn_t status; //!< Error status, if any. Must be checked only if state returns "complete". unsigned int cliqueId; //!< ID of the fabric clique to which this GPU belongs - nvmlGpuFabricState_t state; //!< Current state of GPU registration process + nvmlGpuFabricState_t state; //!< Current state of GPU registration process. See NVML_GPU_FABRIC_STATE_* } nvmlGpuFabricInfo_t; -/* +/** * Fabric Degraded BW */ -#define NVML_GPU_FABRIC_HEALTH_MASK_DEGRADED_BW_NOT_SUPPORTED 0 -#define NVML_GPU_FABRIC_HEALTH_MASK_DEGRADED_BW_TRUE 1 -#define NVML_GPU_FABRIC_HEALTH_MASK_DEGRADED_BW_FALSE 2 +#define NVML_GPU_FABRIC_HEALTH_MASK_DEGRADED_BW_NOT_SUPPORTED 0 //!< Fabric Health Mask: Degraded Bandwidth not supported +#define NVML_GPU_FABRIC_HEALTH_MASK_DEGRADED_BW_TRUE 1 //!< Fabric Health Mask: Bandwidth degraded +#define NVML_GPU_FABRIC_HEALTH_MASK_DEGRADED_BW_FALSE 2 //!< Fabric Health Mask: Bandwidth not degraded -#define NVML_GPU_FABRIC_HEALTH_MASK_SHIFT_DEGRADED_BW 0 -#define NVML_GPU_FABRIC_HEALTH_MASK_WIDTH_DEGRADED_BW 0x3 +#define NVML_GPU_FABRIC_HEALTH_MASK_SHIFT_DEGRADED_BW 0 //!< Fabric Health Mask Bit Shift for Degraded Bandwidth +#define NVML_GPU_FABRIC_HEALTH_MASK_WIDTH_DEGRADED_BW 0x3 //!< Fabric Health Mask Width for Degraded Bandwidth -/* +/** * Fabric Route Recovery */ -#define NVML_GPU_FABRIC_HEALTH_MASK_ROUTE_RECOVERY_NOT_SUPPORTED 0 -#define NVML_GPU_FABRIC_HEALTH_MASK_ROUTE_RECOVERY_TRUE 1 -#define NVML_GPU_FABRIC_HEALTH_MASK_ROUTE_RECOVERY_FALSE 2 +#define NVML_GPU_FABRIC_HEALTH_MASK_ROUTE_RECOVERY_NOT_SUPPORTED 0 //!< Fabric Health Mask: Route Recovery not supported +#define NVML_GPU_FABRIC_HEALTH_MASK_ROUTE_RECOVERY_TRUE 1 //!< Fabric Health Mask: Route Recovery in progress +#define NVML_GPU_FABRIC_HEALTH_MASK_ROUTE_RECOVERY_FALSE 2 //!< Fabric Health Mask: Route Recovery not in progress -#define NVML_GPU_FABRIC_HEALTH_MASK_SHIFT_ROUTE_RECOVERY 2 -#define NVML_GPU_FABRIC_HEALTH_MASK_WIDTH_ROUTE_RECOVERY 0x3 +#define NVML_GPU_FABRIC_HEALTH_MASK_SHIFT_ROUTE_RECOVERY 2 //!< Fabric Health Mask Bit Shift for Route Recovery +#define NVML_GPU_FABRIC_HEALTH_MASK_WIDTH_ROUTE_RECOVERY 0x3 //!< Fabric Health Mask Width for Route Recovery -/* +/** * Nvlink Fabric Route Unhealthy */ -#define NVML_GPU_FABRIC_HEALTH_MASK_ROUTE_UNHEALTHY_NOT_SUPPORTED 0 -#define NVML_GPU_FABRIC_HEALTH_MASK_ROUTE_UNHEALTHY_TRUE 1 -#define NVML_GPU_FABRIC_HEALTH_MASK_ROUTE_UNHEALTHY_FALSE 2 +#define NVML_GPU_FABRIC_HEALTH_MASK_ROUTE_UNHEALTHY_NOT_SUPPORTED 0 //!< Fabric Health Mask: Route Unhealthy not supported +#define NVML_GPU_FABRIC_HEALTH_MASK_ROUTE_UNHEALTHY_TRUE 1 //!< Fabric Health Mask: Route is unhealthy +#define NVML_GPU_FABRIC_HEALTH_MASK_ROUTE_UNHEALTHY_FALSE 2 //!< Fabric Health Mask: Route is healthy -#define NVML_GPU_FABRIC_HEALTH_MASK_SHIFT_ROUTE_UNHEALTHY 4 -#define NVML_GPU_FABRIC_HEALTH_MASK_WIDTH_ROUTE_UNHEALTHY 0x3 +#define NVML_GPU_FABRIC_HEALTH_MASK_SHIFT_ROUTE_UNHEALTHY 4 //!< Fabric Health Mask Bit Shift for Route Unhealthy +#define NVML_GPU_FABRIC_HEALTH_MASK_WIDTH_ROUTE_UNHEALTHY 0x3 //!< Fabric Health Mask Width for Route Unhealthy -/* +/** * Fabric Access Timeout Recovery */ -#define NVML_GPU_FABRIC_HEALTH_MASK_ACCESS_TIMEOUT_RECOVERY_NOT_SUPPORTED 0 -#define NVML_GPU_FABRIC_HEALTH_MASK_ACCESS_TIMEOUT_RECOVERY_TRUE 1 -#define NVML_GPU_FABRIC_HEALTH_MASK_ACCESS_TIMEOUT_RECOVERY_FALSE 2 +#define NVML_GPU_FABRIC_HEALTH_MASK_ACCESS_TIMEOUT_RECOVERY_NOT_SUPPORTED 0 //!< Fabric Health Mask: Access Timeout Recovery not supported +#define NVML_GPU_FABRIC_HEALTH_MASK_ACCESS_TIMEOUT_RECOVERY_TRUE 1 //!< Fabric Health Mask: Access Timeout Recovery in progress +#define NVML_GPU_FABRIC_HEALTH_MASK_ACCESS_TIMEOUT_RECOVERY_FALSE 2 //!< Fabric Health Mask: Access Timeout Recovery not in progress + +#define NVML_GPU_FABRIC_HEALTH_MASK_SHIFT_ACCESS_TIMEOUT_RECOVERY 6 //!< Fabric Health Mask Bit Shift for Access Timeout Recovery +#define NVML_GPU_FABRIC_HEALTH_MASK_WIDTH_ACCESS_TIMEOUT_RECOVERY 0x3 //!< Fabric Health Mask Width for Access Timeout Recovery + +/** + * Fabric Incorrect Configuration + */ +#define NVML_GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_NOT_SUPPORTED 0 //!< Fabric Health Mask: Incorrect Configuration not supported +#define NVML_GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_NONE 1 //!< Fabric Health Mask: Correct Configuration +#define NVML_GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_INCORRECT_SYSGUID 2 //!< Fabric Health Mask: Incorrect Configuration - SysGUID +#define NVML_GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_INCORRECT_CHASSIS_SN 3 //!< Fabric Health Mask: Incorrect Configuration - Chassis Serial Number +#define NVML_GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_NO_PARTITION 4 //!< Fabric Health Mask: Incorrect Configuration - No Partition +#define NVML_GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_INSUFFICIENT_NVLINKS 5 //!< Fabric Health Mask: Incorrect Configuration - Insufficient Nvlinks + +#define NVML_GPU_FABRIC_HEALTH_MASK_SHIFT_INCORRECT_CONFIGURATION 8 //!< Fabric Health Mask Bit Shift for Incorrect Configuration +#define NVML_GPU_FABRIC_HEALTH_MASK_WIDTH_INCORRECT_CONFIGURATION 0xf //!< Fabric Health Mask Width for Incorrect Configuration -#define NVML_GPU_FABRIC_HEALTH_MASK_SHIFT_ACCESS_TIMEOUT_RECOVERY 6 -#define NVML_GPU_FABRIC_HEALTH_MASK_WIDTH_ACCESS_TIMEOUT_RECOVERY 0x3 +/** + * Fabric Health + */ +#define NVML_GPU_FABRIC_HEALTH_SUMMARY_NOT_SUPPORTED 0 //!< Fabric Health Summary: Not supported +#define NVML_GPU_FABRIC_HEALTH_SUMMARY_HEALTHY 1 //!< Fabric Health Summary: Healthy +#define NVML_GPU_FABRIC_HEALTH_SUMMARY_UNHEALTHY 2 //!< Fabric Health Summary: Unhealthy +#define NVML_GPU_FABRIC_HEALTH_SUMMARY_LIMITED_CAPACITY 3 //!< Fabric Health Summary: Limited Capacity /** * GPU Fabric Health Status Mask for various fields can be obtained @@ -3531,27 +3648,50 @@ typedef struct { /** * GPU Fabric information (v2). * +* @deprecated nvmlGpuFabricInfo_v2_t is deprecated and will be removed in a future release. +* Use nvmlGpuFabricInfo_v3_t instead +* * Version 2 adds the \ref nvmlGpuFabricInfo_v2_t.version field * to the start of the structure, and the \ref nvmlGpuFabricInfo_v2_t.healthMask * field to the end. This structure is not backwards-compatible with * \ref nvmlGpuFabricInfo_t. */ -typedef struct { +typedef struct +{ unsigned int version; //!< Structure version identifier (set to nvmlGpuFabricInfo_v2) unsigned char clusterUuid[NVML_GPU_FABRIC_UUID_LEN]; //!< Uuid of the cluster to which this GPU belongs - nvmlReturn_t status; //!< Error status, if any. Must be checked only if state returns "complete". + nvmlReturn_t status; //!< Probe Error status, if any. Must be checked only if Probe state returns "complete". unsigned int cliqueId; //!< ID of the fabric clique to which this GPU belongs - nvmlGpuFabricState_t state; //!< Current state of GPU registration process - unsigned int healthMask; //!< GPU Fabric health Status Mask + nvmlGpuFabricState_t state; //!< Current Probe State of GPU registration process. See NVML_GPU_FABRIC_STATE_* + unsigned int healthMask; //!< GPU Fabric health Status Mask. See NVML_GPU_FABRIC_HEALTH_MASK_* } nvmlGpuFabricInfo_v2_t; -typedef nvmlGpuFabricInfo_v2_t nvmlGpuFabricInfoV_t; - /** * Version identifier value for \ref nvmlGpuFabricInfo_v2_t.version. */ #define nvmlGpuFabricInfo_v2 NVML_STRUCT_VERSION(GpuFabricInfo, 2) +/** +* GPU Fabric information (v3). +*/ +typedef struct +{ + unsigned int version; //!< Structure version identifier (set to nvmlGpuFabricInfo_v2) + unsigned char clusterUuid[NVML_GPU_FABRIC_UUID_LEN]; //!< Uuid of the cluster to which this GPU belongs + nvmlReturn_t status; //!< Probe Error status, if any. Must be checked only if Probe state returns "complete". + unsigned int cliqueId; //!< ID of the fabric clique to which this GPU belongs + nvmlGpuFabricState_t state; //!< Current Probe State of GPU registration process. See NVML_GPU_FABRIC_STATE_* + unsigned int healthMask; //!< GPU Fabric health Status Mask. See NVML_GPU_FABRIC_HEALTH_MASK_* + unsigned char healthSummary; //!< GPU Fabric health summary. See NVML_GPU_FABRIC_HEALTH_SUMMARY_* +} nvmlGpuFabricInfo_v3_t; + +typedef nvmlGpuFabricInfo_v3_t nvmlGpuFabricInfoV_t; + +/** +* Version identifier value for \ref nvmlGpuFabricInfo_v3_t.version. +*/ +#define nvmlGpuFabricInfo_v3 NVML_STRUCT_VERSION(GpuFabricInfo, 3) + /** @} */ /***************************************************************************************************/ @@ -4185,7 +4325,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetHandleByIndex_v2(unsigned int index, nvmlDevic * @see nvmlDeviceGetSerial * @see nvmlDeviceGetHandleByUUID */ -nvmlReturn_t DECLDIR nvmlDeviceGetHandleBySerial(const char *serial, nvmlDevice_t *device); +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceGetHandleBySerial(const char *serial, nvmlDevice_t *device); /** * Acquire the handle for a particular device, based on its globally unique immutable UUID (in ASCII format) associated with each device. @@ -4556,6 +4696,48 @@ nvmlReturn_t DECLDIR nvmlDeviceClearCpuAffinity(nvmlDevice_t device); * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device \a node is invalid */ nvmlReturn_t DECLDIR nvmlDeviceGetNumaNodeId(nvmlDevice_t device, unsigned int *node); + +/** + * Get the addressing mode for a given GPU. Addressing modes can be one of: + * 1. HMM: System allocated memory (malloc, mmap) is addressable from the device (GPU), + * via software-based mirroring of the CPU's page tables, on the GPU. + * 2. ATS: System allocated memory (malloc, mmap) is addressable from the device (GPU), + * via Address Translation Services. This means that there is (effectively) + * a single set of page tables, and the CPU and GPU both use them. + * 3. None: Neither HMM nor ATS is active. + * + * %TURING_OR_NEWER% + * Supported on Linux only. + * + * @param[in] device The device handle + * @param[out] mode Pointer to addressing mode of the device + * + * @returns + * - \ref NVML_SUCCESS if \a mode is retrieved successfully + * - \ref NVML_ERROR_ARGUMENT_VERSION_MISMATCH if the provided version is invalid/unsupported + * - \ref NVML_ERROR_NOT_SUPPORTED if request is not supported on the current platform + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device \a node is invalid + */ +nvmlReturn_t DECLDIR nvmlDeviceGetAddressingMode(nvmlDevice_t device, nvmlDeviceAddressingMode_t *mode); + +/** + * Get the repair status for TPC/Channel repair + * + * For Ampere &tm; or newer fully supported devices. + * + * @param[in] device The identifier of the target device + * @param[out] repairStatus Reference to \a nvmlRepairStatus_t + * + * @return + * - \ref NVML_SUCCESS if the query was successful + * - \ref NVML_ERROR_ARGUMENT_VERSION_MISMATCH if the provided version is invalid/unsupported + * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid + * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + */ +nvmlReturn_t DECLDIR nvmlDeviceGetRepairStatus(nvmlDevice_t device, nvmlRepairStatus_t *repairStatus); + /** * Retrieve the common ancestor for two devices * For all products. @@ -5103,46 +5285,14 @@ nvmlReturn_t DECLDIR nvmlDeviceGetMaxClockInfo(nvmlDevice_t device, nvmlClockTyp nvmlReturn_t DECLDIR nvmlDeviceGetGpcClkVfOffset(nvmlDevice_t device, int *offset); /** - * Retrieves the current setting of a clock that applications will use unless an overspec situation occurs. - * Can be changed using \ref nvmlDeviceSetApplicationsClocks. - * - * For Kepler &tm; or newer fully supported devices. - * - * @param device The identifier of the target device - * @param clockType Identify which clock domain to query - * @param clockMHz Reference in which to return the clock in MHz - * - * @return - * - \ref NVML_SUCCESS if \a clockMHz has been set - * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a clockMHz is NULL or \a clockType is invalid - * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature - * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible - * - \ref NVML_ERROR_UNKNOWN on any unexpected error + * @deprecated Applications clocks are deprecated and will be removed in CUDA 14.0. */ -nvmlReturn_t DECLDIR nvmlDeviceGetApplicationsClock(nvmlDevice_t device, nvmlClockType_t clockType, unsigned int *clockMHz); +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceGetApplicationsClock(nvmlDevice_t device, nvmlClockType_t clockType, unsigned int *clockMHz); /** - * Retrieves the default applications clock that GPU boots with or - * defaults to after \ref nvmlDeviceResetApplicationsClocks call. - * - * For Kepler &tm; or newer fully supported devices. - * - * @param device The identifier of the target device - * @param clockType Identify which clock domain to query - * @param clockMHz Reference in which to return the default clock in MHz - * - * @return - * - \ref NVML_SUCCESS if \a clockMHz has been set - * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a clockMHz is NULL or \a clockType is invalid - * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature - * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible - * - \ref NVML_ERROR_UNKNOWN on any unexpected error - * - * \see nvmlDeviceGetApplicationsClock + * @deprecated Applications clocks are deprecated and will be removed in CUDA 14.0. */ -nvmlReturn_t DECLDIR nvmlDeviceGetDefaultApplicationsClock(nvmlDevice_t device, nvmlClockType_t clockType, unsigned int *clockMHz); +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceGetDefaultApplicationsClock(nvmlDevice_t device, nvmlClockType_t clockType, unsigned int *clockMHz); /** * Retrieves the clock speed for the clock specified by the clock type and clock ID. @@ -5184,7 +5334,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetClock(nvmlDevice_t device, nvmlClockType_t clo nvmlReturn_t DECLDIR nvmlDeviceGetMaxCustomerBoostClock(nvmlDevice_t device, nvmlClockType_t clockType, unsigned int *clockMHz); /** - * Retrieves the list of possible memory clocks that can be used as an argument for \ref nvmlDeviceSetApplicationsClocks. + * Retrieves the list of possible memory clocks that can be used as an argument for \ref nvmlDeviceSetMemoryLockedClocks. * * For Kepler &tm; or newer fully supported devices. * @@ -5203,13 +5353,12 @@ nvmlReturn_t DECLDIR nvmlDeviceGetMaxCustomerBoostClock(nvmlDevice_t device, nvm * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible * - \ref NVML_ERROR_UNKNOWN on any unexpected error * - * @see nvmlDeviceSetApplicationsClocks - * @see nvmlDeviceGetSupportedGraphicsClocks + * @see nvmlDeviceSetMemoryLockedClocks */ nvmlReturn_t DECLDIR nvmlDeviceGetSupportedMemoryClocks(nvmlDevice_t device, unsigned int *count, unsigned int *clocksMHz); /** - * Retrieves the list of possible graphics clocks that can be used as an argument for \ref nvmlDeviceSetApplicationsClocks. + * Retrieves the list of possible graphics clocks that can be used as an argument for \ref nvmlDeviceSetGpuLockedClocks. * * For Kepler &tm; or newer fully supported devices. * @@ -5229,8 +5378,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetSupportedMemoryClocks(nvmlDevice_t device, uns * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible * - \ref NVML_ERROR_UNKNOWN on any unexpected error * - * @see nvmlDeviceSetApplicationsClocks - * @see nvmlDeviceGetSupportedMemoryClocks + * @see nvmlDeviceSetGpuLockedClocks */ nvmlReturn_t DECLDIR nvmlDeviceGetSupportedGraphicsClocks(nvmlDevice_t device, unsigned int memoryClockMHz, unsigned int *count, unsigned int *clocksMHz); @@ -5286,7 +5434,6 @@ nvmlReturn_t DECLDIR nvmlDeviceGetAutoBoostedClocksEnabled(nvmlDevice_t device, */ nvmlReturn_t DECLDIR nvmlDeviceGetFanSpeed(nvmlDevice_t device, unsigned int *speed); - /** * Retrieves the intended operating speed of the device's specified fan. * @@ -5426,7 +5573,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetNumFans(nvmlDevice_t device, unsigned int *num /** * @deprecated Use \ref nvmlDeviceGetTemperatureV instead */ -nvmlReturn_t DECLDIR nvmlDeviceGetTemperature(nvmlDevice_t device, nvmlTemperatureSensors_t sensorType, unsigned int *temp); +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceGetTemperature(nvmlDevice_t device, nvmlTemperatureSensors_t sensorType, unsigned int *temp); /** * Retrieves the cooler's information. @@ -5594,7 +5741,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetCurrentClocksEventReasons(nvmlDevice_t device, /** * @deprecated Use \ref nvmlDeviceGetCurrentClocksEventReasons instead */ -nvmlReturn_t DECLDIR nvmlDeviceGetCurrentClocksThrottleReasons(nvmlDevice_t device, unsigned long long *clocksThrottleReasons); +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceGetCurrentClocksThrottleReasons(nvmlDevice_t device, unsigned long long *clocksThrottleReasons); /** * Retrieves bitmask of supported clocks event reasons that can be returned by @@ -5623,10 +5770,10 @@ nvmlReturn_t DECLDIR nvmlDeviceGetSupportedClocksEventReasons(nvmlDevice_t devic /** * @deprecated Use \ref nvmlDeviceGetSupportedClocksEventReasons instead */ -nvmlReturn_t DECLDIR nvmlDeviceGetSupportedClocksThrottleReasons(nvmlDevice_t device, unsigned long long *supportedClocksThrottleReasons); +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceGetSupportedClocksThrottleReasons(nvmlDevice_t device, unsigned long long *supportedClocksThrottleReasons); /** - * Deprecated: Use \ref nvmlDeviceGetPerformanceState. This function exposes an incorrect generalization. + * @deprecated Use \ref nvmlDeviceGetPerformanceState. This function exposes an incorrect generalization. * * Retrieve the current performance state for the device. * @@ -5645,7 +5792,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetSupportedClocksThrottleReasons(nvmlDevice_t de * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ -nvmlReturn_t DECLDIR nvmlDeviceGetPowerState(nvmlDevice_t device, nvmlPstates_t *pState); +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceGetPowerState(nvmlDevice_t device, nvmlPstates_t *pState); /** * Retrieve performance monitor samples from the associated subdevice. @@ -5908,7 +6055,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetPerformanceModes(nvmlDevice_t device, nvmlDevi nvmlReturn_t DECLDIR nvmlDeviceGetCurrentClockFreqs(nvmlDevice_t device, nvmlDeviceCurrentClockFreqs_t *currentClockFreqs); /** - * This API has been deprecated. + * @deprecated This API has been deprecated. * * Retrieves the power management mode associated with this device. * @@ -5935,7 +6082,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetCurrentClockFreqs(nvmlDevice_t device, nvmlDev * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ -nvmlReturn_t DECLDIR nvmlDeviceGetPowerManagementMode(nvmlDevice_t device, nvmlEnableState_t *mode); +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceGetPowerManagementMode(nvmlDevice_t device, nvmlEnableState_t *mode); /** * Retrieves the power management limit associated with this device. @@ -6028,6 +6175,56 @@ nvmlReturn_t DECLDIR nvmlDeviceGetPowerManagementDefaultLimit(nvmlDevice_t devic */ nvmlReturn_t DECLDIR nvmlDeviceGetPowerUsage(nvmlDevice_t device, unsigned int *power); +/** + * Retrieves current power mizer mode on this device. + * + * PowerMizerMode provides a hint to the driver as to how to manage the performance of the GPU. + * + * For Maxwell &tm; or newer fully supported devices. + * + * @param device The identifier of the target device + * @param powerMizerMode Reference in which to return the power mizer mode + * @param supportedPowerMizerModes Reference in which to return the bitmask of supported power mizer modes on this device. + * The supported modes can be combined using the bitwise OR operator '|'. + * For example, if a device supports all PowerMizer modes, the bitmask would be: + * supportedPowerMizerModes = ((1 << NVML_POWER_MIZER_MODE_ADAPTIVE) | + * (1 << NVML_POWER_MIZER_MODE_PREFER_MAXIMUM_PERFORMANCE) | + * (1 << NVML_POWER_MIZER_MODE_AUTO) | + * (1 << NVML_POWER_MIZER_MODE_PREFER_CONSISTENT_PERFORMANCE)); + * This bitmask can be used to check which power mizer modes are available on the device by performing + * a bitwise AND operation with the specific mode you want to check. + * + * @return + * - \ref NVML_SUCCESS if \a powerMizerMode has been populated + * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a powerMizerMode is NULL + * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support powerMizerMode readings + * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + */ + +nvmlReturn_t DECLDIR nvmlDeviceGetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t *powerMizerMode); + +/** + * Sets the new power mizer mode. + * + * For Maxwell &tm; or newer fully supported devices. + * + * @param device The identifier of the target device + * @param powerMizerMode Reference in which to set the power mizer mode. + * + * @return + * - \ref NVML_SUCCESS if \a powerMizerMode has been populated + * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a powerMizerMode is NULL + * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support powerMizerMode readings + * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + */ + +nvmlReturn_t DECLDIR nvmlDeviceSetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t *powerMizerMode); + + /** * Retrieves total energy consumption for this GPU in millijoules (mJ) since the driver was last reloaded * @@ -6407,7 +6604,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetTotalEccErrors(nvmlDevice_t device, nvmlMemory * * @see nvmlDeviceClearEccErrorCounts() */ -nvmlReturn_t DECLDIR nvmlDeviceGetDetailedEccErrors(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, nvmlEccErrorCounts_t *eccCounts); +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceGetDetailedEccErrors(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, nvmlEccErrorCounts_t *eccCounts); /** * Retrieves the requested memory error counter for the device. @@ -7043,30 +7240,22 @@ nvmlReturn_t DECLDIR nvmlDeviceGetSamples(nvmlDevice_t device, nvmlSamplingType_ nvmlReturn_t DECLDIR nvmlDeviceGetBAR1MemoryInfo(nvmlDevice_t device, nvmlBAR1Memory_t *bar1Memory); /** - * Gets the duration of time during which the device was throttled (lower than requested clocks) due to power - * or thermal constraints. + * @deprecated Use \ref nvmlDeviceGetFieldValues to query this data. + * This API will be removed in CUDA 14.0. * - * The method is important to users who are tying to understand if their GPUs throttle at any point during their applications. The - * difference in violation times at two different reference times gives the indication of GPU throttling event. - * - * Violation for thermal capping is not supported at this time. - * - * For Kepler &tm; or newer fully supported devices. - * - * @param device The identifier of the target device - * @param perfPolicyType Represents Performance policy which can trigger GPU throttling - * @param violTime Reference to which violation time related information is returned - * - * - * @return - * - \ref NVML_SUCCESS if violation time is successfully retrieved - * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a perfPolicyType is invalid, or \a violTime is NULL - * - \ref NVML_ERROR_NOT_SUPPORTED if this query is not supported by the device - * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible + * Translations are as follows: + * + * NVML_PERF_POLICY_POWER -> NVML_FI_DEV_CLOCKS_EVENT_REASON_SW_POWER_CAP + * NVML_PERF_POLICY_THERMAL -> NVML_FI_DEV_CLOCKS_EVENT_REASON_SW_THERM_SLOWDOWN + * NVML_PERF_POLICY_SYNC_BOOST -> NVML_FI_DEV_CLOCKS_EVENT_REASON_SYNC_BOOST + * NVML_PERF_POLICY_BOARD_LIMIT -> NVML_FI_DEV_PERF_POLICY_BOARD_LIMIT + * NVML_PERF_POLICY_LOW_UTILIZATION -> NVML_FI_DEV_PERF_POLICY_LOW_UTILIZATION + * NVML_PERF_POLICY_RELIABILITY -> NVML_FI_DEV_PERF_POLICY_RELIABILITY + * NVML_PERF_POLICY_TOTAL_APP_CLOCKS -> DEPRECATED, Do not use + * NVML_PERF_POLICY_TOTAL_BASE_CLOCKS -> NVML_FI_DEV_PERF_POLICY_TOTAL_BASE_CLOCKS */ -nvmlReturn_t DECLDIR nvmlDeviceGetViolationStatus(nvmlDevice_t device, nvmlPerfPolicyType_t perfPolicyType, nvmlViolationTime_t *violTime); +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceGetViolationStatus(nvmlDevice_t device, nvmlPerfPolicyType_t perfPolicyType, nvmlViolationTime_t *violTime); /** * Gets the device's interrupt number @@ -7087,6 +7276,9 @@ nvmlReturn_t DECLDIR nvmlDeviceGetIrqNum(nvmlDevice_t device, unsigned int *irqN /** * Gets the device's core count * + * @note On MIG-enabled GPUs, querying the device's core count is currently not supported using this API. + * Please use \ref nvmlDeviceGetGpuInstanceProfileInfo to fetch the MIG device's core count. + * * @param device The identifier of the target device * @param numCores The number of cores for the specified device * @@ -7094,7 +7286,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetIrqNum(nvmlDevice_t device, unsigned int *irqN * - \ref NVML_SUCCESS if GPU core count is successfully retrieved * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, or \a numCores is NULL - * - \ref NVML_ERROR_NOT_SUPPORTED if this query is not supported by the device + * - \ref NVML_ERROR_NOT_SUPPORTED if this query is not supported by the device or a mig device. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible * */ @@ -7197,7 +7389,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetBusType(nvmlDevice_t device, nvmlBusType_t *ty /** - * Deprecated: Will be deprecated in a future release. Use \ref nvmlDeviceGetGpuFabricInfoV instead + * @deprecated Will be deprecated in a future release. Use \ref nvmlDeviceGetGpuFabricInfoV instead * * Get fabric information associated with the device. * @@ -7217,7 +7409,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetBusType(nvmlDevice_t device, nvmlBusType_t *ty * - \ref NVML_SUCCESS Upon success * - \ref NVML_ERROR_NOT_SUPPORTED If \a device doesn't support gpu fabric */ -nvmlReturn_t DECLDIR nvmlDeviceGetGpuFabricInfo(nvmlDevice_t device, nvmlGpuFabricInfo_t *gpuFabricInfo); +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceGetGpuFabricInfo(nvmlDevice_t device, nvmlGpuFabricInfo_t *gpuFabricInfo); /** * Versioned wrapper around \ref nvmlDeviceGetGpuFabricInfo that accepts a versioned @@ -7519,7 +7711,41 @@ nvmlReturn_t DECLDIR nvmlDeviceGetSramEccErrorStatus(nvmlDevice_t device, nvmlEccSramErrorStatus_t *status); /** - * @} + * Set new power limit of this device. + * + * For Kepler &tm; or newer fully supported devices. + * Requires root/admin permissions. + * + * See \ref nvmlDeviceGetPowerManagementLimitConstraints to check the allowed ranges of values. + * + * See \ref nvmlPowerValue_v2_t for more information on the struct. + * + * \note Limit is not persistent across reboots or driver unloads. + * Enable persistent mode to prevent driver from unloading when no application is using the device. + * + * This API replaces nvmlDeviceSetPowerManagementLimit. It can be used as a drop-in replacement for the older version. + * + * @param device The identifier of the target device + * @param powerValue Power management limit in milliwatts to set + * + * @return + * - \ref NVML_SUCCESS if \a limit has been set + * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a powerValue is NULL or contains invalid values + * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature + * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + * + * @see NVML_FI_DEV_POWER_AVERAGE + * @see NVML_FI_DEV_POWER_INSTANT + * @see NVML_FI_DEV_POWER_MIN_LIMIT + * @see NVML_FI_DEV_POWER_MAX_LIMIT + * @see NVML_FI_DEV_POWER_CURRENT_LIMIT + */ +nvmlReturn_t DECLDIR nvmlDeviceSetPowerManagementLimit_v2(nvmlDevice_t device, nvmlPowerValue_v2_t *powerValue); + +/** + * @} // @defgroup nvmlDeviceQueries Device Queries */ /** @addtogroup nvmlAccountingStats @@ -7681,7 +7907,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetRetiredPages(nvmlDevice_t device, nvmlPageReti * that this does not match the virtual address used in CUDA, but will match the address information in Xid 63 * * \note nvmlDeviceGetRetiredPages_v2 adds an additional timestamps parameter to return the time of each page's - * retirement. + * retirement. This is supported for Pascal and newer architecture. * * For Kepler &tm; or newer fully supported devices. * @@ -7913,6 +8139,27 @@ nvmlReturn_t DECLDIR nvmlDeviceGetProcessesUtilizationInfo(nvmlDevice_t device, */ nvmlReturn_t DECLDIR nvmlDeviceGetPlatformInfo(nvmlDevice_t device, nvmlPlatformInfo_t *platformInfo); +/** + * Retrieves the Per Device Identifier (PDI) associated with this device. + * + * For Pascal &tm; or newer fully supported devices. + * + * See \ref nvmlPdi_v1_t for more information on the struct. + * + * @param[in] device The identifier of the target device + * @param[out] pdi Reference to the caller-provided structure to return the GPU PDI + * + * @return + * - \ref NVML_SUCCESS if \a pdi has been set + * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, or \a pdi is NULL + * - \ref NVML_ERROR_ARGUMENT_VERSION_MISMATCH if the version is invalid/unsupported + * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature + * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + */ +nvmlReturn_t DECLDIR nvmlDeviceGetPdi(nvmlDevice_t device, nvmlPdi_t *pdi); + /** @} */ /***************************************************************************************************/ @@ -8150,8 +8397,6 @@ typedef enum nvmlClockLimitId_enum { * Set clocks that device will lock to. * * Sets the clocks that the device will be running at to the value in the range of minGpuClockMHz to maxGpuClockMHz. - * Setting this will supersede application clock values and take effect regardless if a cuda app is running. - * See /ref nvmlDeviceSetApplicationsClocks * * Can be used as a setting to request constant performance. * @@ -8170,7 +8415,7 @@ typedef enum nvmlClockLimitId_enum { * * Requires root/admin permissions. * - * After system reboot or driver reload applications clocks go back to their default value. + * After system reboot or driver reload GPU clocks go back to their default value. * See \ref nvmlDeviceResetGpuLockedClocks. * * For Volta &tm; or newer fully supported devices. @@ -8195,7 +8440,7 @@ nvmlReturn_t DECLDIR nvmlDeviceSetGpuLockedClocks(nvmlDevice_t device, unsigned * Resets the gpu clock to the default value * * This is the gpu clock that will be used after system reboot or driver reload. - * Default values are idle clocks, but the current values can be changed using \ref nvmlDeviceSetApplicationsClocks. + * Default values are idle clocks. * * @see nvmlDeviceSetGpuLockedClocks * @@ -8217,14 +8462,12 @@ nvmlReturn_t DECLDIR nvmlDeviceResetGpuLockedClocks(nvmlDevice_t device); * Set memory clocks that device will lock to. * * Sets the device's memory clocks to the value in the range of minMemClockMHz to maxMemClockMHz. - * Setting this will supersede application clock values and take effect regardless of whether a cuda app is running. - * See /ref nvmlDeviceSetApplicationsClocks * * Can be used as a setting to request constant performance. * * Requires root/admin permissions. * - * After system reboot or driver reload applications clocks go back to their default value. + * After system reboot or driver reload memory clocks go back to their default value. * See \ref nvmlDeviceResetMemoryLockedClocks. * * For Ampere &tm; or newer fully supported devices. @@ -8249,7 +8492,7 @@ nvmlReturn_t DECLDIR nvmlDeviceSetMemoryLockedClocks(nvmlDevice_t device, unsign * Resets the memory clock to the default value * * This is the memory clock that will be used after system reboot or driver reload. - * Default values are idle clocks, but the current values can be changed using \ref nvmlDeviceSetApplicationsClocks. + * Default values are idle clocks. * * @see nvmlDeviceSetMemoryLockedClocks * @@ -8268,72 +8511,20 @@ nvmlReturn_t DECLDIR nvmlDeviceSetMemoryLockedClocks(nvmlDevice_t device, unsign nvmlReturn_t DECLDIR nvmlDeviceResetMemoryLockedClocks(nvmlDevice_t device); /** - * Set clocks that applications will lock to. - * - * Sets the clocks that compute and graphics applications will be running at. - * e.g. CUDA driver requests these clocks during context creation which means this property - * defines clocks at which CUDA applications will be running unless some overspec event - * occurs (e.g. over power, over thermal or external HW brake). - * - * Can be used as a setting to request constant performance. - * - * On Pascal and newer hardware, this will automatically disable automatic boosting of clocks. - * - * On K80 and newer Kepler and Maxwell GPUs, users desiring fixed performance should also call - * \ref nvmlDeviceSetAutoBoostedClocksEnabled to prevent clocks from automatically boosting - * above the clock value being set. + * @deprecated Applications clocks are deprecated and will be removed in CUDA 14.0. * - * For Kepler &tm; or newer non-GeForce fully supported devices and Maxwell or newer GeForce devices. - * Requires root/admin permissions. - * - * See \ref nvmlDeviceGetSupportedMemoryClocks and \ref nvmlDeviceGetSupportedGraphicsClocks - * for details on how to list available clocks combinations. - * - * After system reboot or driver reload applications clocks go back to their default value. - * See \ref nvmlDeviceResetApplicationsClocks. - * - * @param device The identifier of the target device - * @param memClockMHz Requested memory clock in MHz - * @param graphicsClockMHz Requested graphics clock in MHz - * - * @return - * - \ref NVML_SUCCESS if new settings were successfully set - * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a memClockMHz and \a graphicsClockMHz - * is not a valid clock combination - * - \ref NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation - * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature - * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible - * - \ref NVML_ERROR_UNKNOWN on any unexpected error + * Please use \ref nvmlDeviceSetMemoryLockedClocks for Memory Clocks and + * \ref nvmlDeviceSetGpuLockedClocks for Graphics Clocks. */ -nvmlReturn_t DECLDIR nvmlDeviceSetApplicationsClocks(nvmlDevice_t device, unsigned int memClockMHz, unsigned int graphicsClockMHz); +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceSetApplicationsClocks(nvmlDevice_t device, unsigned int memClockMHz, unsigned int graphicsClockMHz); /** - * Resets the application clock to the default value - * - * This is the applications clock that will be used after system reboot or driver reload. - * Default value is constant, but the current value an be changed using \ref nvmlDeviceSetApplicationsClocks. - * - * On Pascal and newer hardware, if clocks were previously locked with \ref nvmlDeviceSetApplicationsClocks, - * this call will unlock clocks. This returns clocks their default behavior ofautomatically boosting above - * base clocks as thermal limits allow. + * @deprecated Applications clocks are deprecated and will be removed in CUDA 14.0. * - * @see nvmlDeviceGetApplicationsClock - * @see nvmlDeviceSetApplicationsClocks - * - * For Fermi &tm; or newer non-GeForce fully supported devices and Maxwell or newer GeForce devices. - * - * @param device The identifier of the target device - * - * @return - * - \ref NVML_SUCCESS if new settings were successfully set - * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid - * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature - * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible - * - \ref NVML_ERROR_UNKNOWN on any unexpected error + * Please use \ref nvmlDeviceResetMemoryLockedClocks for Memory Clocks and + * \ref nvmlDeviceResetGpuLockedClocks for Graphics Clocks. */ -nvmlReturn_t DECLDIR nvmlDeviceResetApplicationsClocks(nvmlDevice_t device); +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceResetApplicationsClocks(nvmlDevice_t device); /** * Try to set the current state of Auto Boosted clocks on a device. @@ -8569,7 +8760,7 @@ nvmlReturn_t DECLDIR nvmlDeviceSetAPIRestriction(nvmlDevice_t device, nvmlRestri nvmlReturn_t DECLDIR nvmlDeviceSetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int speed); /** - * Deprecated: Will be deprecated in a future release. Use \ref nvmlDeviceSetClockOffsets instead. It works + * @deprecated Will be deprecated in a future release. Use \ref nvmlDeviceSetClockOffsets instead. It works * on Maxwell onwards GPU architectures. * * Set the GPCCLK VF offset value @@ -8584,10 +8775,10 @@ nvmlReturn_t DECLDIR nvmlDeviceSetFanSpeed_v2(nvmlDevice_t device, unsigned int * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ -nvmlReturn_t DECLDIR nvmlDeviceSetGpcClkVfOffset(nvmlDevice_t device, int offset); +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceSetGpcClkVfOffset(nvmlDevice_t device, int offset); /** - * Deprecated: Will be deprecated in a future release. Use \ref nvmlDeviceSetClockOffsets instead. It works + * @deprecated Will be deprecated in a future release. Use \ref nvmlDeviceSetClockOffsets instead. It works * on Maxwell onwards GPU architectures. * * Set the MemClk (Memory Clock) VF offset value. It requires elevated privileges. @@ -8602,7 +8793,7 @@ nvmlReturn_t DECLDIR nvmlDeviceSetGpcClkVfOffset(nvmlDevice_t device, int offset * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ -nvmlReturn_t DECLDIR nvmlDeviceSetMemClkVfOffset(nvmlDevice_t device, int offset); +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceSetMemClkVfOffset(nvmlDevice_t device, int offset); /** * @} @@ -8666,42 +8857,11 @@ nvmlReturn_t DECLDIR nvmlDeviceSetAccountingMode(nvmlDevice_t device, nvmlEnable */ nvmlReturn_t DECLDIR nvmlDeviceClearAccountingPids(nvmlDevice_t device); -/** - * Set new power limit of this device. - * - * For Kepler &tm; or newer fully supported devices. - * Requires root/admin permissions. - * - * See \ref nvmlDeviceGetPowerManagementLimitConstraints to check the allowed ranges of values. - * - * See \ref nvmlPowerValue_v2_t for more information on the struct. - * - * \note Limit is not persistent across reboots or driver unloads. - * Enable persistent mode to prevent driver from unloading when no application is using the device. - * - * This API replaces nvmlDeviceSetPowerManagementLimit. It can be used as a drop-in replacement for the older version. - * - * @param device The identifier of the target device - * @param powerValue Power management limit in milliwatts to set - * - * @return - * - \ref NVML_SUCCESS if \a limit has been set - * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a powerValue is NULL or contains invalid values - * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature - * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible - * - \ref NVML_ERROR_UNKNOWN on any unexpected error - * - * @see NVML_FI_DEV_POWER_AVERAGE - * @see NVML_FI_DEV_POWER_INSTANT - * @see NVML_FI_DEV_POWER_MIN_LIMIT - * @see NVML_FI_DEV_POWER_MAX_LIMIT - * @see NVML_FI_DEV_POWER_CURRENT_LIMIT - */ -nvmlReturn_t DECLDIR nvmlDeviceSetPowerManagementLimit_v2(nvmlDevice_t device, nvmlPowerValue_v2_t *powerValue); +/** @} */ // @addtogroup nvmlAccountingStats /***************************************************************************************************/ -/** @defgroup NVML NVLink +/** @defgroup NvLink NvLink Methods + * This chapter describes methods that NVML can perform on NVLINK enabled devices. * @{ */ /***************************************************************************************************/ @@ -8756,17 +8916,54 @@ typedef struct typedef nvmlNvlinkSetBwMode_v1_t nvmlNvlinkSetBwMode_t; #define nvmlNvlinkSetBwMode_v1 NVML_STRUCT_VERSION(NvlinkSetBwMode, 1) -/** @} */ // @defgroup NVML NVLink +/** + * Struct to represent per device NVLINK information v1 + */ +typedef struct +{ + unsigned int version; //!< IN - the API version number + unsigned int isNvleEnabled; //!< OUT - NVLINK encryption enablement +} nvmlNvLinkInfo_v1_t; +#define nvmlNvLinkInfo_v1 NVML_STRUCT_VERSION(NvLinkInfo, 1) +#define NVML_NVLINK_FIRMWARE_UCODE_TYPE_MSE 0x1 +#define NVML_NVLINK_FIRMWARE_UCODE_TYPE_NETIR 0x2 +#define NVML_NVLINK_FIRMWARE_UCODE_TYPE_NETIR_UPHY 0x3 +#define NVML_NVLINK_FIRMWARE_UCODE_TYPE_NETIR_CLN 0x4 +#define NVML_NVLINK_FIRMWARE_UCODE_TYPE_NETIR_DLN 0x5 +#define NVML_NVLINK_FIRMWARE_VERSION_LENGTH 100 -/** @} */ +/** + * Struct to represent NVLINK firmware Semantic versioning and ucode type + */ +typedef struct +{ + unsigned char ucodeType; + unsigned int major; + unsigned int minor; + unsigned int subMinor; +} nvmlNvlinkFirmwareVersion_t; -/***************************************************************************************************/ -/** @defgroup NvLink NvLink Methods - * This chapter describes methods that NVML can perform on NVLINK enabled devices. - * @{ +/** + * Struct to represent NVLINK firmware information */ -/***************************************************************************************************/ +typedef struct +{ + nvmlNvlinkFirmwareVersion_t firmwareVersion[NVML_NVLINK_FIRMWARE_VERSION_LENGTH]; //!< OUT - NVLINK firmware version + unsigned int numValidEntries; //!< OUT - Number of valid firmware entries +} nvmlNvlinkFirmwareInfo_t; + +/** + * Struct to represent per device NVLINK information v2 + */ +typedef struct +{ + unsigned int version; //!< IN - the API version number + unsigned int isNvleEnabled; //!< OUT - NVLINK encryption enablement + nvmlNvlinkFirmwareInfo_t firmwareInfo; //!< OUT - NVLINK Firmware info +} nvmlNvLinkInfo_v2_t; +typedef nvmlNvLinkInfo_v2_t nvmlNvLinkInfo_t; +#define nvmlNvLinkInfo_v2 NVML_STRUCT_VERSION(NvLinkInfo, 2) /** * Retrieves the state of the device's NvLink for the link specified @@ -8887,7 +9084,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetNvLinkErrorCounter(nvmlDevice_t device, unsign nvmlReturn_t DECLDIR nvmlDeviceResetNvLinkErrorCounters(nvmlDevice_t device, unsigned int link); /** - * Deprecated: Setting utilization counter control is no longer supported. + * @deprecated Setting utilization counter control is no longer supported. * * Set the NVLINK utilization counter control information for the specified counter, 0 or 1. * Please refer to \a nvmlNvLinkUtilizationControl_t for the structure definition. Performs a reset @@ -8908,11 +9105,11 @@ nvmlReturn_t DECLDIR nvmlDeviceResetNvLinkErrorCounters(nvmlDevice_t device, uns * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ -nvmlReturn_t DECLDIR nvmlDeviceSetNvLinkUtilizationControl(nvmlDevice_t device, unsigned int link, unsigned int counter, +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceSetNvLinkUtilizationControl(nvmlDevice_t device, unsigned int link, unsigned int counter, nvmlNvLinkUtilizationControl_t *control, unsigned int reset); /** - * Deprecated: Getting utilization counter control is no longer supported. + * @deprecated Getting utilization counter control is no longer supported. * * Get the NVLINK utilization counter control information for the specified counter, 0 or 1. * Please refer to \a nvmlNvLinkUtilizationControl_t for the structure definition @@ -8931,12 +9128,12 @@ nvmlReturn_t DECLDIR nvmlDeviceSetNvLinkUtilizationControl(nvmlDevice_t device, * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ -nvmlReturn_t DECLDIR nvmlDeviceGetNvLinkUtilizationControl(nvmlDevice_t device, unsigned int link, unsigned int counter, +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceGetNvLinkUtilizationControl(nvmlDevice_t device, unsigned int link, unsigned int counter, nvmlNvLinkUtilizationControl_t *control); /** - * Deprecated: Use \ref nvmlDeviceGetFieldValues with NVML_FI_DEV_NVLINK_THROUGHPUT_* as field values instead. + * @deprecated Use \ref nvmlDeviceGetFieldValues with NVML_FI_DEV_NVLINK_THROUGHPUT_* as field values instead. * * Retrieve the NVLINK utilization counter based on the current control for a specified counter. * In general it is good practice to use \a nvmlDeviceSetNvLinkUtilizationControl @@ -8957,11 +9154,11 @@ nvmlReturn_t DECLDIR nvmlDeviceGetNvLinkUtilizationControl(nvmlDevice_t device, * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ -nvmlReturn_t DECLDIR nvmlDeviceGetNvLinkUtilizationCounter(nvmlDevice_t device, unsigned int link, unsigned int counter, +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceGetNvLinkUtilizationCounter(nvmlDevice_t device, unsigned int link, unsigned int counter, unsigned long long *rxcounter, unsigned long long *txcounter); /** - * Deprecated: Freezing NVLINK utilization counters is no longer supported. + * @deprecated Freezing NVLINK utilization counters is no longer supported. * * Freeze the NVLINK utilization counters * Both the receive and transmit counters are operated on by this function @@ -8981,11 +9178,11 @@ nvmlReturn_t DECLDIR nvmlDeviceGetNvLinkUtilizationCounter(nvmlDevice_t device, * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ -nvmlReturn_t DECLDIR nvmlDeviceFreezeNvLinkUtilizationCounter (nvmlDevice_t device, unsigned int link, +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceFreezeNvLinkUtilizationCounter (nvmlDevice_t device, unsigned int link, unsigned int counter, nvmlEnableState_t freeze); /** - * Deprecated: Resetting NVLINK utilization counters is no longer supported. + * @deprecated Resetting NVLINK utilization counters is no longer supported. * * Reset the NVLINK utilization counters * Both the receive and transmit counters are operated on by this function @@ -9003,7 +9200,7 @@ nvmlReturn_t DECLDIR nvmlDeviceFreezeNvLinkUtilizationCounter (nvmlDevice_t devi * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ -nvmlReturn_t DECLDIR nvmlDeviceResetNvLinkUtilizationCounter (nvmlDevice_t device, unsigned int link, unsigned int counter); +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlDeviceResetNvLinkUtilizationCounter (nvmlDevice_t device, unsigned int link, unsigned int counter); /** * Get the NVLink device type of the remote device connected over the given link. @@ -9120,7 +9317,24 @@ nvmlReturn_t DECLDIR nvmlDeviceGetNvlinkBwMode(nvmlDevice_t device, nvmlReturn_t DECLDIR nvmlDeviceSetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkSetBwMode_t *setBwMode); -/** @} */ +/** + * Query NVLINK information associated with this device. + * + * @param[in] device The identifier of the target device + * @param[out] info Reference to \a nvmlNvLinkInfo_t + * + * @return + * - \ref NVML_SUCCESS if query is success + * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, or \a info is NULL + * - \ref NVML_ERROR_ARGUMENT_VERSION_MISMATCH if the version is invalid/unsupported + * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature + * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + */ +nvmlReturn_t DECLDIR nvmlDeviceGetNvLinkInfo(nvmlDevice_t device, nvmlNvLinkInfo_t *info); + +/** @} */ // @defgroup NvLink NvLink Methods /***************************************************************************************************/ /** @defgroup nvmlEvents Event Handling Methods @@ -9260,7 +9474,7 @@ nvmlReturn_t DECLDIR nvmlEventSetWait_v2(nvmlEventSet_t set, nvmlEventData_t * d */ nvmlReturn_t DECLDIR nvmlEventSetFree(nvmlEventSet_t set); -/* +/** * Create an empty set of system events. * Event set should be freed by \ref nvmlSystemEventSetFree * @@ -9283,7 +9497,7 @@ nvmlReturn_t DECLDIR nvmlSystemEventSetCreate(nvmlSystemEventSetCreateRequest_t * * For Fermi &tm; or newer fully supported devices. * - * @param set Reference to nvmlSystemEventSetFreeRequest_t + * @param request Reference to nvmlSystemEventSetFreeRequest_t * * @return * - \ref NVML_SUCCESS if the event has been set @@ -10249,7 +10463,7 @@ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetFbUsage(nvmlVgpuInstance_t vgpuInstance, * - \ref NVML_ERROR_NOT_FOUND if \a vgpuInstance does not match a valid active vGPU instance on the system * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ -nvmlReturn_t DECLDIR nvmlVgpuInstanceGetLicenseStatus(nvmlVgpuInstance_t vgpuInstance, unsigned int *licensed); +DEPRECATED(13.0) nvmlReturn_t DECLDIR nvmlVgpuInstanceGetLicenseStatus(nvmlVgpuInstance_t vgpuInstance, unsigned int *licensed); /** * Retrieve the vGPU type of a vGPU instance. @@ -10735,8 +10949,6 @@ nvmlReturn_t DECLDIR nvmlGpuInstanceGetVgpuHeterogeneousMode(nvmlGpuInstance_t g * \a pHeterogeneousMode->version is the version number of the structure nvmlVgpuHeterogeneousMode_t, the caller should * set the correct version number to set the vGPU heterogeneous mode. * - * %GB20X_OR_NEWER% - * * @param gpuInstance The GPU instance handle * @param pHeterogeneousMode Pointer to the caller-provided structure of nvmlVgpuHeterogeneousMode_t * @@ -10756,7 +10968,7 @@ nvmlReturn_t DECLDIR nvmlGpuInstanceSetVgpuHeterogeneousMode(nvmlGpuInstance_t g /** @} */ /***************************************************************************************************/ -/** @defgroup nvml vGPU Migration +/** @defgroup nvmlVgpuMigration vGPU Migration * This chapter describes operations that are associated with vGPU Migration. * @{ */ @@ -11075,7 +11287,7 @@ nvmlReturn_t DECLDIR nvmlGetVgpuVersion(nvmlVgpuVersion_t *supported, nvmlVgpuVe */ nvmlReturn_t DECLDIR nvmlSetVgpuVersion(nvmlVgpuVersion_t *vgpuVersion); -/** @} */ +/** @} */ // @defgroup nvmlVgpuMigration vGPU Migration /***************************************************************************************************/ /** @defgroup nvmlUtil vGPU Utilization and Accounting @@ -11447,6 +11659,55 @@ nvmlReturn_t DECLDIR nvmlGetExcludedDeviceInfoByIndex(unsigned int index, nvmlEx /** @} */ +/***************************************************************************************************/ +/** @defgroup nvmlGPUPRMAccess PRM Access + * This chapter describes NVML operations that are associated with PRM register reads + * @{ + */ +/***************************************************************************************************/ + +#define NVML_PRM_DATA_MAX_SIZE 496 +/** + * Main PRM input structure + */ +typedef struct +{ + /* I/O parameters */ + unsigned dataSize; //!< Size of the input TLV data. + unsigned status; //!< OUT: status of the PRM command + union { + /* Input data in TLV format */ + unsigned char inData[NVML_PRM_DATA_MAX_SIZE]; //!< IN: Input data in TLV format + /* Output data in TLV format */ + unsigned char outData[NVML_PRM_DATA_MAX_SIZE]; //!< OUT: Output PRM data in TLV format + }; +} nvmlPRMTLV_v1_t; + +/** + * Read or write a GPU PRM register. The input is assumed to be in TLV format in + * network byte order. + * + * %BLACKWELL_OR_NEWER% + * + * Supported on Linux only. + * + * @param device Identifer of target GPU device + * @param buffer Structure holding the input data in TLV format as well as + * the PRM register contents in TLV format (in the case of a successful + * read operation). + * Note: the input data and any returned data shall be in network byte order. + * + * @return + * - \ref NVML_SUCCESS on success + * - \ref NVML_ERROR_INVALID_ARGUMENT if \p device or \p buffer are invalid + * - \ref NVML_ERROR_NO_PERMISSION if user does not have permission to perform this operation + * - \ref NVML_ERROR_NOT_SUPPORTED if this feature is not supported by the device + * - \ref NVML_ERROR_ARGUMENT_VERSION_MISMATCH if the version specified in \p buffer is not supported + */ +nvmlReturn_t DECLDIR nvmlDeviceReadWritePRM_v1(nvmlDevice_t device, nvmlPRMTLV_v1_t *buffer); + +/** @} */ + /***************************************************************************************************/ /** @defgroup nvmlMultiInstanceGPU Multi Instance GPU Management * This chapter describes NVML operations that are associated with Multi Instance GPU management. @@ -11775,6 +12036,7 @@ nvmlReturn_t DECLDIR nvmlDeviceSetMigMode(nvmlDevice_t device, unsigned int mode * - \ref NVML_ERROR_UNINITIALIZED If library has not been successfully initialized * - \ref NVML_ERROR_INVALID_ARGUMENT If \a device, \a currentMode or \a pendingMode are invalid * - \ref NVML_ERROR_NOT_SUPPORTED If \a device doesn't support MIG mode + * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ nvmlReturn_t DECLDIR nvmlDeviceGetMigMode(nvmlDevice_t device, unsigned int *currentMode, unsigned int *pendingMode); @@ -11834,6 +12096,37 @@ nvmlReturn_t DECLDIR nvmlDeviceGetGpuInstanceProfileInfo(nvmlDevice_t device, un nvmlReturn_t DECLDIR nvmlDeviceGetGpuInstanceProfileInfoV(nvmlDevice_t device, unsigned int profile, nvmlGpuInstanceProfileInfo_v2_t *info); +/** + * GPU instance profile query function that accepts profile ID, instead of profile name. + * It accepts a versioned \ref nvmlGpuInstanceProfileInfo_v2_t or later output structure. + * + * @note The caller must set the \ref nvmlGpuInstanceProfileInfo_v2_t.version field to the + * appropriate version prior to calling this function. For example: + * \code + * nvmlGpuInstanceProfileInfo_v2_t profileInfo = + * { .version = nvmlGpuInstanceProfileInfo_v2 }; + * nvmlReturn_t result = nvmlDeviceGetGpuInstanceProfileInfoV(device, + * profile, + * &profileInfo); + * \endcode + * + * For Ampere &tm; or newer fully supported devices. + * Supported on Linux only. + * + * @param device The identifier of the target device + * @param profileId One of the profile IDs. + * @param info Returns detailed profile information + * + * @return + * - \ref NVML_SUCCESS Upon success + * - \ref NVML_ERROR_UNINITIALIZED If library has not been successfully initialized + * - \ref NVML_ERROR_INVALID_ARGUMENT If \a device, \a profileId, \a info, or \a info->version are invalid + * - \ref NVML_ERROR_NOT_SUPPORTED If \a device doesn't have MIG mode enabled or \a profile isn't supported + * - \ref NVML_ERROR_NO_PERMISSION If user doesn't have permission to perform the operation + */ +nvmlReturn_t DECLDIR nvmlDeviceGetGpuInstanceProfileInfoByIdV(nvmlDevice_t device, unsigned int profileId, + nvmlGpuInstanceProfileInfo_v2_t *info); + /** * Get GPU instance placements. * @@ -12622,12 +12915,6 @@ typedef struct struct nvmlGpmSample_st* handle; } nvmlGpmSample_t; -typedef struct { - char *shortName; - char *longName; - char *unit; -} nvmlGpmMetricMetricInfo_t; - /** * GPM metric information. */ @@ -12636,7 +12923,12 @@ typedef struct unsigned int metricId; //!< IN: NVML_GPM_METRIC_? define of which metric to retrieve nvmlReturn_t nvmlReturn; //!< OUT: Status of this metric. If this is nonzero, then value is not valid double value; //!< OUT: Value of this metric. Is only valid if nvmlReturn is 0 (NVML_SUCCESS) - nvmlGpmMetricMetricInfo_t metricInfo; //!< OUT: Metric name and unit. Those can be NULL if not defined + struct + { + char *shortName; + char *longName; + char *unit; + } metricInfo; //!< OUT: Metric name and unit. Those can be NULL if not defined } nvmlGpmMetric_t; /** @@ -12850,6 +13142,7 @@ typedef nvmlDeviceCapabilities_v1_t nvmlDeviceCapabilities_t; nvmlReturn_t DECLDIR nvmlDeviceGetCapabilities(nvmlDevice_t device, nvmlDeviceCapabilities_t *caps); + /* * Generic bitmask to hold 255 bits, represented by 8 elements of 32 bits */ @@ -13160,6 +13453,45 @@ nvmlReturn_t DECLDIR nvmlDevicePowerSmoothingSetState(nvmlDevice_t device, nvmlPowerSmoothingState_t *state); /** @} */ // @defgroup +/** + * Retrieves the counts of SRAM unique uncorrected ECC errors + * + * %BLACKWELL_OR_NEWER% + * + * Reads SRAM unique uncorrected ECC error counts. The total number of unique errors is returned by + * \a errorCounts->entryCount. Error counts are returned as an array of in the caller-supplied buffer pointed at by + * \a errorCounts->entries. Each error count entry holds the location/address of the unique error, the error count and + * whether the error is parity or not. + * + * To read SRAM unique uncorrected ECC error counts, first determine the size of buffer required to hold the error + * counts by invoking the function with \a errorCounts->entries set to NULL. The required array size is returned in + * \a errorCounts->entryCount. The caller should allocate a buffer of size "errorCounts->entryCount * + * sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_t)". Invoke the function again with the allocated buffer passed in + * \a errorCounts->entries. This time \a errorCounts->entryCount will be taken as the entry array size that caller + * allocates for \a errorCounts->entries. + * + * On successful return of the second query, the function updates \a errorCounts->entries with all unique errors. This + * may fail if \a errorCounts->entryCount is smaller than the actual number of unique errors. This can happen in cases + * like new errors occur since the previous query of \a errorCounts->entryCount. No matter the query succeeds or not, + * the latest number of unique errors will be returned in \a errorCounts->entryCount. + * + * @note The query is only supported when ECC mode is enabled. + * + * @param device The identifier of the target device + * @param errorCounts Pointer to caller-supplied array which returns the unique error count entries + * + * @return + * - \ref NVML_SUCCESS if \a utilization has been populated + * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a errorCounts->entryCount is NULL + * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature or ECC mods is not enabled + * - \ref NVML_ERROR_INSUFFICIENT_SIZE if the allocated error entry array is not big enough + * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + */ +nvmlReturn_t DECLDIR nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(nvmlDevice_t device, + nvmlEccSramUniqueUncorrectedErrorCounts_t *errorCounts); + /** * NVML API versioning support */ diff --git a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/types_gen.go b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/types_gen.go index 3be1796..efa5863 100644 --- a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/types_gen.go +++ b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/types_gen.go @@ -22,7 +22,7 @@ type PciInfoExt_v1 struct { PciSubSystemId uint32 BaseClass uint32 SubClass uint32 - BusId [32]int8 + BusId [32]uint8 } type PciInfoExt struct { @@ -34,17 +34,17 @@ type PciInfoExt struct { PciSubSystemId uint32 BaseClass uint32 SubClass uint32 - BusId [32]int8 + BusId [32]uint8 } type PciInfo struct { - BusIdLegacy [16]int8 + BusIdLegacy [16]uint8 Domain uint32 Bus uint32 Device uint32 PciDeviceId uint32 PciSubSystemId uint32 - BusId [32]int8 + BusId [32]uint8 } type EccErrorCounts struct { @@ -136,6 +136,28 @@ type C2cModeInfo_v1 struct { IsC2cEnabled uint32 } +type DeviceAddressingMode_v1 struct { + Version uint32 + Value uint32 +} + +type DeviceAddressingMode struct { + Version uint32 + Value uint32 +} + +type RepairStatus_v1 struct { + Version uint32 + BChannelRepairPending uint32 + BTpcRepairPending uint32 +} + +type RepairStatus struct { + Version uint32 + BChannelRepairPending uint32 + BTpcRepairPending uint32 +} + type RowRemapperHistogramValues struct { Max uint32 High uint32 @@ -173,17 +195,9 @@ type ViolationTime struct { ViolationTime uint64 } -type GpuThermalSettingsSensor struct { - Controller int32 - DefaultMinTemp int32 - DefaultMaxTemp int32 - CurrentTemp int32 - Target int32 -} - type GpuThermalSettings struct { Count uint32 - Sensor [3]GpuThermalSettingsSensor + Sensor [3]_Ctype_struct___28 } type CoolerInfo_v1 struct { @@ -218,6 +232,16 @@ type UUID struct { Pad_cgo_0 [3]byte } +type Pdi_v1 struct { + Version uint32 + Value uint64 +} + +type Pdi struct { + Version uint32 + Value uint64 +} + type DramEncryptionInfo_v1 struct { Version uint32 EncryptionState uint32 @@ -281,22 +305,28 @@ type FanSpeedInfo struct { type DevicePerfModes_v1 struct { Version uint32 - Str [2048]int8 + Str [2048]uint8 } type DevicePerfModes struct { Version uint32 - Str [2048]int8 + Str [2048]uint8 } type DeviceCurrentClockFreqs_v1 struct { Version uint32 - Str [2048]int8 + Str [2048]uint8 } type DeviceCurrentClockFreqs struct { Version uint32 - Str [2048]int8 + Str [2048]uint8 +} + +type DevicePowerMizerModes_v1 struct { + CurrentMode uint32 + Mode uint32 + SupportedPowerMizerModes uint32 } type ProcessUtilizationSample struct { @@ -404,6 +434,28 @@ type PlatformInfo struct { Pad_cgo_0 [3]byte } +type EccSramUniqueUncorrectedErrorEntry_v1 struct { + Unit uint32 + Location uint32 + Sublocation uint32 + Extlocation uint32 + Address uint32 + IsParity uint32 + Count uint32 +} + +type EccSramUniqueUncorrectedErrorCounts_v1 struct { + Version uint32 + EntryCount uint32 + Entries *EccSramUniqueUncorrectedErrorEntry_v1 +} + +type EccSramUniqueUncorrectedErrorCounts struct { + Version uint32 + EntryCount uint32 + Entries *EccSramUniqueUncorrectedErrorEntry_v1 +} + type DeviceArchitecture uint32 type BusType uint32 @@ -412,16 +464,9 @@ type FanControlPolicy uint32 type PowerSource uint32 -type GpuDynamicPstatesInfoUtilization struct { - BIsPresent uint32 - Percentage uint32 - IncThreshold uint32 - DecThreshold uint32 -} - type GpuDynamicPstatesInfo struct { Flags uint32 - Utilization [8]GpuDynamicPstatesInfoUtilization + Utilization [8]_Ctype_struct___23 } type PowerScopeType byte @@ -531,7 +576,7 @@ type VgpuInstancesUtilizationInfo struct { type VgpuProcessUtilizationSample struct { VgpuInstance uint32 Pid uint32 - ProcessName [64]int8 + ProcessName [64]uint8 TimeStamp uint64 SmUtil uint32 MemUtil uint32 @@ -540,7 +585,7 @@ type VgpuProcessUtilizationSample struct { } type VgpuProcessUtilizationInfo_v1 struct { - ProcessName [64]int8 + ProcessName [64]uint8 TimeStamp uint64 VgpuInstance uint32 Pid uint32 @@ -576,15 +621,6 @@ type VgpuRuntimeState struct { Size uint64 } -type VgpuSchedulerParamsVgpuSchedDataWithARR struct { - AvgFactor uint32 - Timeslice uint32 -} - -type VgpuSchedulerParamsVgpuSchedData struct { - Timeslice uint32 -} - const sizeofVgpuSchedulerParams = unsafe.Sizeof([8]byte{}) type VgpuSchedulerParams [sizeofVgpuSchedulerParams]byte @@ -613,15 +649,6 @@ type VgpuSchedulerGetState struct { SchedulerParams [8]byte } -type VgpuSchedulerSetParamsVgpuSchedDataWithARR struct { - AvgFactor uint32 - Frequency uint32 -} - -type VgpuSchedulerSetParamsVgpuSchedData struct { - Timeslice uint32 -} - const sizeofVgpuSchedulerSetParams = unsafe.Sizeof([8]byte{}) type VgpuSchedulerSetParams [sizeofVgpuSchedulerSetParams]byte @@ -674,8 +701,8 @@ type GridLicenseExpiry struct { type GridLicensableFeature struct { FeatureCode uint32 FeatureState uint32 - LicenseInfo [128]int8 - ProductName [128]int8 + LicenseInfo [128]uint8 + ProductName [128]uint8 FeatureEnabled uint32 LicenseExpiry GridLicenseExpiry } @@ -812,23 +839,23 @@ type nvmlUnit struct { type HwbcEntry struct { HwbcId uint32 - FirmwareVersion [32]int8 + FirmwareVersion [32]uint8 } type LedState struct { - Cause [256]int8 + Cause [256]uint8 Color uint32 } type UnitInfo struct { - Name [96]int8 - Id [96]int8 - Serial [96]int8 - FirmwareVersion [96]int8 + Name [96]uint8 + Id [96]uint8 + Serial [96]uint8 + FirmwareVersion [96]uint8 } type PSUInfo struct { - State [256]int8 + State [256]uint8 Current uint32 Voltage uint32 Power uint32 @@ -1045,23 +1072,36 @@ type GpuFabricInfo_v2 struct { HealthMask uint32 } +type GpuFabricInfo_v3 struct { + Version uint32 + ClusterUuid [16]uint8 + Status uint32 + CliqueId uint32 + State uint8 + HealthMask uint32 + HealthSummary uint8 + Pad_cgo_0 [3]byte +} + type GpuFabricInfoV struct { - Version uint32 - ClusterUuid [16]uint8 - Status uint32 - CliqueId uint32 - State uint8 - HealthMask uint32 + Version uint32 + ClusterUuid [16]uint8 + Status uint32 + CliqueId uint32 + State uint8 + HealthMask uint32 + HealthSummary uint8 + Pad_cgo_0 [3]byte } type SystemDriverBranchInfo_v1 struct { Version uint32 - Branch [80]int8 + Branch [80]uint8 } type SystemDriverBranchInfo struct { Version uint32 - Branch [80]int8 + Branch [80]uint8 } type AffinityScope uint32 @@ -1118,6 +1158,35 @@ type NvlinkSetBwMode struct { Pad_cgo_0 [3]byte } +type NvLinkInfo_v1 struct { + Version uint32 + IsNvleEnabled uint32 +} + +type NvlinkFirmwareVersion struct { + UcodeType uint8 + Major uint32 + Minor uint32 + SubMinor uint32 +} + +type NvlinkFirmwareInfo struct { + FirmwareVersion [100]NvlinkFirmwareVersion + NumValidEntries uint32 +} + +type NvLinkInfo_v2 struct { + Version uint32 + IsNvleEnabled uint32 + FirmwareInfo NvlinkFirmwareInfo +} + +type NvLinkInfo struct { + Version uint32 + IsNvleEnabled uint32 + FirmwareInfo NvlinkFirmwareInfo +} + type VgpuVersion struct { MinVersion uint32 MaxVersion uint32 @@ -1127,24 +1196,24 @@ type nvmlVgpuMetadata struct { Version uint32 Revision uint32 GuestInfoState uint32 - GuestDriverVersion [80]int8 - HostDriverVersion [80]int8 + GuestDriverVersion [80]uint8 + HostDriverVersion [80]uint8 Reserved [6]uint32 VgpuVirtualizationCaps uint32 GuestVgpuVersion uint32 OpaqueDataSize uint32 - OpaqueData [4]int8 + OpaqueData [4]uint8 } type nvmlVgpuPgpuMetadata struct { Version uint32 Revision uint32 - HostDriverVersion [80]int8 + HostDriverVersion [80]uint8 PgpuVirtualizationCaps uint32 Reserved [5]uint32 HostSupportedVgpuRange VgpuVersion OpaqueDataSize uint32 - OpaqueData [4]int8 + OpaqueData [4]uint8 } type VgpuPgpuCompatibility struct { @@ -1154,7 +1223,13 @@ type VgpuPgpuCompatibility struct { type ExcludedDeviceInfo struct { PciInfo PciInfo - Uuid [80]int8 + Uuid [80]uint8 +} + +type PRMTLV_v1 struct { + DataSize uint32 + Status uint32 + InData [496]uint8 } type GpuInstancePlacement struct { @@ -1189,7 +1264,7 @@ type GpuInstanceProfileInfo_v2 struct { JpegCount uint32 OfaCount uint32 MemorySizeMB uint64 - Name [96]int8 + Name [96]uint8 } type GpuInstanceProfileInfo_v3 struct { @@ -1204,7 +1279,7 @@ type GpuInstanceProfileInfo_v3 struct { JpegCount uint32 OfaCount uint32 MemorySizeMB uint64 - Name [96]int8 + Name [96]uint8 Capabilities uint32 Pad_cgo_0 [4]byte } @@ -1244,7 +1319,7 @@ type ComputeInstanceProfileInfo_v2 struct { SharedEncoderCount uint32 SharedJpegCount uint32 SharedOfaCount uint32 - Name [96]int8 + Name [96]uint8 } type ComputeInstanceProfileInfo_v3 struct { @@ -1258,7 +1333,7 @@ type ComputeInstanceProfileInfo_v3 struct { SharedEncoderCount uint32 SharedJpegCount uint32 SharedOfaCount uint32 - Name [96]int8 + Name [96]uint8 Capabilities uint32 } @@ -1278,17 +1353,11 @@ type nvmlGpmSample struct { Handle *_Ctype_struct_nvmlGpmSample_st } -type GpmMetricMetricInfo struct { - ShortName *int8 - LongName *int8 - Unit *int8 -} - type GpmMetric struct { MetricId uint32 NvmlReturn uint32 Value float64 - MetricInfo GpmMetricMetricInfo + MetricInfo _Ctype_struct___19 } type nvmlGpmMetricsGetType struct { diff --git a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/vgpu.go b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/vgpu.go index b1e0fa7..9ab649a 100644 --- a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/vgpu.go +++ b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/vgpu.go @@ -214,6 +214,8 @@ func (vgpuInstance nvmlVgpuInstance) GetLicenseInfo() (VgpuLicenseInfo, Return) } // nvml.VgpuInstanceGetLicenseStatus() +// +// Deprecated: Use VgpuInstanceGetLicenseInfo instead. func (l *library) VgpuInstanceGetLicenseStatus(vgpuInstance VgpuInstance) (int, Return) { return vgpuInstance.GetLicenseStatus() } diff --git a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/zz_generated.api.go b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/zz_generated.api.go index bfe4d07..f4930ff 100644 --- a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/zz_generated.api.go +++ b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/zz_generated.api.go @@ -37,6 +37,7 @@ var ( DeviceGetAccountingStats = libnvml.DeviceGetAccountingStats DeviceGetActiveVgpus = libnvml.DeviceGetActiveVgpus DeviceGetAdaptiveClockInfoStatus = libnvml.DeviceGetAdaptiveClockInfoStatus + DeviceGetAddressingMode = libnvml.DeviceGetAddressingMode DeviceGetApplicationsClock = libnvml.DeviceGetApplicationsClock DeviceGetArchitecture = libnvml.DeviceGetArchitecture DeviceGetAttributes = libnvml.DeviceGetAttributes @@ -103,6 +104,7 @@ var ( DeviceGetGpuInstanceId = libnvml.DeviceGetGpuInstanceId DeviceGetGpuInstancePossiblePlacements = libnvml.DeviceGetGpuInstancePossiblePlacements DeviceGetGpuInstanceProfileInfo = libnvml.DeviceGetGpuInstanceProfileInfo + DeviceGetGpuInstanceProfileInfoByIdV = libnvml.DeviceGetGpuInstanceProfileInfoByIdV DeviceGetGpuInstanceProfileInfoV = libnvml.DeviceGetGpuInstanceProfileInfoV DeviceGetGpuInstanceRemainingCapacity = libnvml.DeviceGetGpuInstanceRemainingCapacity DeviceGetGpuInstances = libnvml.DeviceGetGpuInstances @@ -152,6 +154,7 @@ var ( DeviceGetNumaNodeId = libnvml.DeviceGetNumaNodeId DeviceGetNvLinkCapability = libnvml.DeviceGetNvLinkCapability DeviceGetNvLinkErrorCounter = libnvml.DeviceGetNvLinkErrorCounter + DeviceGetNvLinkInfo = libnvml.DeviceGetNvLinkInfo DeviceGetNvLinkRemoteDeviceType = libnvml.DeviceGetNvLinkRemoteDeviceType DeviceGetNvLinkRemotePciInfo = libnvml.DeviceGetNvLinkRemotePciInfo DeviceGetNvLinkState = libnvml.DeviceGetNvLinkState @@ -168,6 +171,7 @@ var ( DeviceGetPcieReplayCounter = libnvml.DeviceGetPcieReplayCounter DeviceGetPcieSpeed = libnvml.DeviceGetPcieSpeed DeviceGetPcieThroughput = libnvml.DeviceGetPcieThroughput + DeviceGetPdi = libnvml.DeviceGetPdi DeviceGetPerformanceModes = libnvml.DeviceGetPerformanceModes DeviceGetPerformanceState = libnvml.DeviceGetPerformanceState DeviceGetPersistenceMode = libnvml.DeviceGetPersistenceMode @@ -177,12 +181,14 @@ var ( DeviceGetPowerManagementLimit = libnvml.DeviceGetPowerManagementLimit DeviceGetPowerManagementLimitConstraints = libnvml.DeviceGetPowerManagementLimitConstraints DeviceGetPowerManagementMode = libnvml.DeviceGetPowerManagementMode + DeviceGetPowerMizerMode_v1 = libnvml.DeviceGetPowerMizerMode_v1 DeviceGetPowerSource = libnvml.DeviceGetPowerSource DeviceGetPowerState = libnvml.DeviceGetPowerState DeviceGetPowerUsage = libnvml.DeviceGetPowerUsage DeviceGetProcessUtilization = libnvml.DeviceGetProcessUtilization DeviceGetProcessesUtilizationInfo = libnvml.DeviceGetProcessesUtilizationInfo DeviceGetRemappedRows = libnvml.DeviceGetRemappedRows + DeviceGetRepairStatus = libnvml.DeviceGetRepairStatus DeviceGetRetiredPages = libnvml.DeviceGetRetiredPages DeviceGetRetiredPagesPendingStatus = libnvml.DeviceGetRetiredPagesPendingStatus DeviceGetRetiredPages_v2 = libnvml.DeviceGetRetiredPages_v2 @@ -191,6 +197,7 @@ var ( DeviceGetSamples = libnvml.DeviceGetSamples DeviceGetSerial = libnvml.DeviceGetSerial DeviceGetSramEccErrorStatus = libnvml.DeviceGetSramEccErrorStatus + DeviceGetSramUniqueUncorrectedEccErrorCounts = libnvml.DeviceGetSramUniqueUncorrectedEccErrorCounts DeviceGetSupportedClocksEventReasons = libnvml.DeviceGetSupportedClocksEventReasons DeviceGetSupportedClocksThrottleReasons = libnvml.DeviceGetSupportedClocksThrottleReasons DeviceGetSupportedEventTypes = libnvml.DeviceGetSupportedEventTypes @@ -231,6 +238,7 @@ var ( DevicePowerSmoothingSetState = libnvml.DevicePowerSmoothingSetState DevicePowerSmoothingUpdatePresetProfileParam = libnvml.DevicePowerSmoothingUpdatePresetProfileParam DeviceQueryDrainState = libnvml.DeviceQueryDrainState + DeviceReadWritePRM_v1 = libnvml.DeviceReadWritePRM_v1 DeviceRegisterEvents = libnvml.DeviceRegisterEvents DeviceRemoveGpu = libnvml.DeviceRemoveGpu DeviceRemoveGpu_v2 = libnvml.DeviceRemoveGpu_v2 @@ -409,6 +417,7 @@ type Interface interface { DeviceGetAccountingStats(Device, uint32) (AccountingStats, Return) DeviceGetActiveVgpus(Device) ([]VgpuInstance, Return) DeviceGetAdaptiveClockInfoStatus(Device) (uint32, Return) + DeviceGetAddressingMode(Device) (DeviceAddressingMode, Return) DeviceGetApplicationsClock(Device, ClockType) (uint32, Return) DeviceGetArchitecture(Device) (DeviceArchitecture, Return) DeviceGetAttributes(Device) (DeviceAttributes, Return) @@ -428,7 +437,7 @@ type Interface interface { DeviceGetComputeInstanceId(Device) (int, Return) DeviceGetComputeMode(Device) (ComputeMode, Return) DeviceGetComputeRunningProcesses(Device) ([]ProcessInfo, Return) - DeviceGetConfComputeGpuAttestationReport(Device) (ConfComputeGpuAttestationReport, Return) + DeviceGetConfComputeGpuAttestationReport(Device, *ConfComputeGpuAttestationReport) Return DeviceGetConfComputeGpuCertificate(Device) (ConfComputeGpuCertificate, Return) DeviceGetConfComputeMemSizeInfo(Device) (ConfComputeMemSizeInfo, Return) DeviceGetConfComputeProtectedMemoryUsage(Device) (Memory, Return) @@ -475,6 +484,7 @@ type Interface interface { DeviceGetGpuInstanceId(Device) (int, Return) DeviceGetGpuInstancePossiblePlacements(Device, *GpuInstanceProfileInfo) ([]GpuInstancePlacement, Return) DeviceGetGpuInstanceProfileInfo(Device, int) (GpuInstanceProfileInfo, Return) + DeviceGetGpuInstanceProfileInfoByIdV(Device, int) GpuInstanceProfileInfoByIdHandler DeviceGetGpuInstanceProfileInfoV(Device, int) GpuInstanceProfileInfoHandler DeviceGetGpuInstanceRemainingCapacity(Device, *GpuInstanceProfileInfo) (int, Return) DeviceGetGpuInstances(Device, *GpuInstanceProfileInfo) ([]GpuInstance, Return) @@ -524,6 +534,7 @@ type Interface interface { DeviceGetNumaNodeId(Device) (int, Return) DeviceGetNvLinkCapability(Device, int, NvLinkCapability) (uint32, Return) DeviceGetNvLinkErrorCounter(Device, int, NvLinkErrorCounter) (uint64, Return) + DeviceGetNvLinkInfo(Device) NvLinkInfoHandler DeviceGetNvLinkRemoteDeviceType(Device, int) (IntNvLinkDeviceType, Return) DeviceGetNvLinkRemotePciInfo(Device, int) (PciInfo, Return) DeviceGetNvLinkState(Device, int) (EnableState, Return) @@ -540,6 +551,7 @@ type Interface interface { DeviceGetPcieReplayCounter(Device) (int, Return) DeviceGetPcieSpeed(Device) (int, Return) DeviceGetPcieThroughput(Device, PcieUtilCounter) (uint32, Return) + DeviceGetPdi(Device) (Pdi, Return) DeviceGetPerformanceModes(Device) (DevicePerfModes, Return) DeviceGetPerformanceState(Device) (Pstates, Return) DeviceGetPersistenceMode(Device) (EnableState, Return) @@ -549,12 +561,14 @@ type Interface interface { DeviceGetPowerManagementLimit(Device) (uint32, Return) DeviceGetPowerManagementLimitConstraints(Device) (uint32, uint32, Return) DeviceGetPowerManagementMode(Device) (EnableState, Return) + DeviceGetPowerMizerMode_v1(Device) (DevicePowerMizerModes_v1, Return) DeviceGetPowerSource(Device) (PowerSource, Return) DeviceGetPowerState(Device) (Pstates, Return) DeviceGetPowerUsage(Device) (uint32, Return) DeviceGetProcessUtilization(Device, uint64) ([]ProcessUtilizationSample, Return) DeviceGetProcessesUtilizationInfo(Device) (ProcessesUtilizationInfo, Return) DeviceGetRemappedRows(Device) (int, int, bool, bool, Return) + DeviceGetRepairStatus(Device) (RepairStatus, Return) DeviceGetRetiredPages(Device, PageRetirementCause) ([]uint64, Return) DeviceGetRetiredPagesPendingStatus(Device) (EnableState, Return) DeviceGetRetiredPages_v2(Device, PageRetirementCause) ([]uint64, []uint64, Return) @@ -563,6 +577,7 @@ type Interface interface { DeviceGetSamples(Device, SamplingType, uint64) (ValueType, []Sample, Return) DeviceGetSerial(Device) (string, Return) DeviceGetSramEccErrorStatus(Device) (EccSramErrorStatus, Return) + DeviceGetSramUniqueUncorrectedEccErrorCounts(Device, *EccSramUniqueUncorrectedErrorCounts) Return DeviceGetSupportedClocksEventReasons(Device) (uint64, Return) DeviceGetSupportedClocksThrottleReasons(Device) (uint64, Return) DeviceGetSupportedEventTypes(Device) (uint64, Return) @@ -603,6 +618,7 @@ type Interface interface { DevicePowerSmoothingSetState(Device, *PowerSmoothingState) Return DevicePowerSmoothingUpdatePresetProfileParam(Device, *PowerSmoothingProfile) Return DeviceQueryDrainState(*PciInfo) (EnableState, Return) + DeviceReadWritePRM_v1(Device, *PRMTLV_v1) Return DeviceRegisterEvents(Device, uint64, EventSet) Return DeviceRemoveGpu(*PciInfo) Return DeviceRemoveGpu_v2(*PciInfo, DetachGpuState, PcieLinkState) Return @@ -778,6 +794,7 @@ type Device interface { GetAccountingStats(uint32) (AccountingStats, Return) GetActiveVgpus() ([]VgpuInstance, Return) GetAdaptiveClockInfoStatus() (uint32, Return) + GetAddressingMode() (DeviceAddressingMode, Return) GetApplicationsClock(ClockType) (uint32, Return) GetArchitecture() (DeviceArchitecture, Return) GetAttributes() (DeviceAttributes, Return) @@ -797,7 +814,7 @@ type Device interface { GetComputeInstanceId() (int, Return) GetComputeMode() (ComputeMode, Return) GetComputeRunningProcesses() ([]ProcessInfo, Return) - GetConfComputeGpuAttestationReport() (ConfComputeGpuAttestationReport, Return) + GetConfComputeGpuAttestationReport(*ConfComputeGpuAttestationReport) Return GetConfComputeGpuCertificate() (ConfComputeGpuCertificate, Return) GetConfComputeMemSizeInfo() (ConfComputeMemSizeInfo, Return) GetConfComputeProtectedMemoryUsage() (Memory, Return) @@ -843,6 +860,7 @@ type Device interface { GetGpuInstanceId() (int, Return) GetGpuInstancePossiblePlacements(*GpuInstanceProfileInfo) ([]GpuInstancePlacement, Return) GetGpuInstanceProfileInfo(int) (GpuInstanceProfileInfo, Return) + GetGpuInstanceProfileInfoByIdV(int) GpuInstanceProfileInfoByIdHandler GetGpuInstanceProfileInfoV(int) GpuInstanceProfileInfoHandler GetGpuInstanceRemainingCapacity(*GpuInstanceProfileInfo) (int, Return) GetGpuInstances(*GpuInstanceProfileInfo) ([]GpuInstance, Return) @@ -887,6 +905,7 @@ type Device interface { GetNumaNodeId() (int, Return) GetNvLinkCapability(int, NvLinkCapability) (uint32, Return) GetNvLinkErrorCounter(int, NvLinkErrorCounter) (uint64, Return) + GetNvLinkInfo() NvLinkInfoHandler GetNvLinkRemoteDeviceType(int) (IntNvLinkDeviceType, Return) GetNvLinkRemotePciInfo(int) (PciInfo, Return) GetNvLinkState(int) (EnableState, Return) @@ -903,6 +922,7 @@ type Device interface { GetPcieReplayCounter() (int, Return) GetPcieSpeed() (int, Return) GetPcieThroughput(PcieUtilCounter) (uint32, Return) + GetPdi() (Pdi, Return) GetPerformanceModes() (DevicePerfModes, Return) GetPerformanceState() (Pstates, Return) GetPersistenceMode() (EnableState, Return) @@ -912,12 +932,14 @@ type Device interface { GetPowerManagementLimit() (uint32, Return) GetPowerManagementLimitConstraints() (uint32, uint32, Return) GetPowerManagementMode() (EnableState, Return) + GetPowerMizerMode_v1() (DevicePowerMizerModes_v1, Return) GetPowerSource() (PowerSource, Return) GetPowerState() (Pstates, Return) GetPowerUsage() (uint32, Return) GetProcessUtilization(uint64) ([]ProcessUtilizationSample, Return) GetProcessesUtilizationInfo() (ProcessesUtilizationInfo, Return) GetRemappedRows() (int, int, bool, bool, Return) + GetRepairStatus() (RepairStatus, Return) GetRetiredPages(PageRetirementCause) ([]uint64, Return) GetRetiredPagesPendingStatus() (EnableState, Return) GetRetiredPages_v2(PageRetirementCause) ([]uint64, []uint64, Return) @@ -926,6 +948,7 @@ type Device interface { GetSamples(SamplingType, uint64) (ValueType, []Sample, Return) GetSerial() (string, Return) GetSramEccErrorStatus() (EccSramErrorStatus, Return) + GetSramUniqueUncorrectedEccErrorCounts(*EccSramUniqueUncorrectedErrorCounts) Return GetSupportedClocksEventReasons() (uint64, Return) GetSupportedClocksThrottleReasons() (uint64, Return) GetSupportedEventTypes() (uint64, Return) @@ -970,6 +993,7 @@ type Device interface { PowerSmoothingActivatePresetProfile(*PowerSmoothingProfile) Return PowerSmoothingSetState(*PowerSmoothingState) Return PowerSmoothingUpdatePresetProfileParam(*PowerSmoothingProfile) Return + ReadWritePRM_v1(*PRMTLV_v1) Return RegisterEvents(uint64, EventSet) Return ResetApplicationsClocks() Return ResetGpuLockedClocks() Return diff --git a/vendor/github.com/stretchr/testify/assert/assertion_compare.go b/vendor/github.com/stretchr/testify/assert/assertion_compare.go index 7e19eba..ffb24e8 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_compare.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_compare.go @@ -390,7 +390,8 @@ func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []compareResult{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not greater than \"%v\"", e1, e2) + return compareTwoValues(t, e1, e2, []compareResult{compareGreater}, failMessage, msgAndArgs...) } // GreaterOrEqual asserts that the first element is greater than or equal to the second @@ -403,7 +404,8 @@ func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...in if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []compareResult{compareGreater, compareEqual}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not greater than or equal to \"%v\"", e1, e2) + return compareTwoValues(t, e1, e2, []compareResult{compareGreater, compareEqual}, failMessage, msgAndArgs...) } // Less asserts that the first element is less than the second @@ -415,7 +417,8 @@ func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []compareResult{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not less than \"%v\"", e1, e2) + return compareTwoValues(t, e1, e2, []compareResult{compareLess}, failMessage, msgAndArgs...) } // LessOrEqual asserts that the first element is less than or equal to the second @@ -428,7 +431,8 @@ func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...inter if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []compareResult{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not less than or equal to \"%v\"", e1, e2) + return compareTwoValues(t, e1, e2, []compareResult{compareLess, compareEqual}, failMessage, msgAndArgs...) } // Positive asserts that the specified element is positive @@ -440,7 +444,8 @@ func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) bool { h.Helper() } zero := reflect.Zero(reflect.TypeOf(e)) - return compareTwoValues(t, e, zero.Interface(), []compareResult{compareGreater}, "\"%v\" is not positive", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not positive", e) + return compareTwoValues(t, e, zero.Interface(), []compareResult{compareGreater}, failMessage, msgAndArgs...) } // Negative asserts that the specified element is negative @@ -452,7 +457,8 @@ func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) bool { h.Helper() } zero := reflect.Zero(reflect.TypeOf(e)) - return compareTwoValues(t, e, zero.Interface(), []compareResult{compareLess}, "\"%v\" is not negative", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not negative", e) + return compareTwoValues(t, e, zero.Interface(), []compareResult{compareLess}, failMessage, msgAndArgs...) } func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedComparesResults []compareResult, failMessage string, msgAndArgs ...interface{}) bool { @@ -468,11 +474,11 @@ func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedCompare compareResult, isComparable := compare(e1, e2, e1Kind) if !isComparable { - return Fail(t, fmt.Sprintf("Can not compare type \"%s\"", reflect.TypeOf(e1)), msgAndArgs...) + return Fail(t, fmt.Sprintf(`Can not compare type "%T"`, e1), msgAndArgs...) } if !containsValue(allowedComparesResults, compareResult) { - return Fail(t, fmt.Sprintf(failMessage, e1, e2), msgAndArgs...) + return Fail(t, failMessage, msgAndArgs...) } return true diff --git a/vendor/github.com/stretchr/testify/assert/assertion_format.go b/vendor/github.com/stretchr/testify/assert/assertion_format.go index 1906341..c592f6a 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_format.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_format.go @@ -50,10 +50,19 @@ func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string return ElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...) } -// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Emptyf asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // assert.Emptyf(t, obj, "error message %s", "formatted") +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -117,10 +126,8 @@ func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg stri // Errorf asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if assert.Errorf(t, err, "error message %s", "formatted") { -// assert.Equal(t, expectedErrorf, err) -// } +// actualObj, err := SomeFunction() +// assert.Errorf(t, err, "error message %s", "formatted") func Errorf(t TestingT, err error, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -438,7 +445,19 @@ func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interf return IsNonIncreasing(t, object, append([]interface{}{msg}, args...)...) } +// IsNotTypef asserts that the specified objects are not of the same type. +// +// assert.IsNotTypef(t, &NotMyStruct{}, &MyStruct{}, "error message %s", "formatted") +func IsNotTypef(t TestingT, theType interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return IsNotType(t, theType, object, append([]interface{}{msg}, args...)...) +} + // IsTypef asserts that the specified objects are of the same type. +// +// assert.IsTypef(t, &MyStruct{}, &MyStruct{}, "error message %s", "formatted") func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -585,8 +604,7 @@ func NotElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg str return NotElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...) } -// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmptyf asserts that the specified object is NOT [Empty]. // // if assert.NotEmptyf(t, obj, "error message %s", "formatted") { // assert.Equal(t, "two", obj[1]) @@ -693,12 +711,15 @@ func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, return NotSame(t, expected, actual, append([]interface{}{msg}, args...)...) } -// NotSubsetf asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // assert.NotSubsetf(t, [1, 3, 4], [1, 2], "error message %s", "formatted") // assert.NotSubsetf(t, {"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") +// assert.NotSubsetf(t, [1, 3, 4], {1: "one", 2: "two"}, "error message %s", "formatted") +// assert.NotSubsetf(t, {"x": 1, "y": 2}, ["z"], "error message %s", "formatted") func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -782,11 +803,15 @@ func Samef(t TestingT, expected interface{}, actual interface{}, msg string, arg return Same(t, expected, actual, append([]interface{}{msg}, args...)...) } -// Subsetf asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subsetf asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // assert.Subsetf(t, [1, 2, 3], [1, 2], "error message %s", "formatted") // assert.Subsetf(t, {"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") +// assert.Subsetf(t, [1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted") +// assert.Subsetf(t, {"x": 1, "y": 2}, ["x"], "error message %s", "formatted") func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go b/vendor/github.com/stretchr/testify/assert/assertion_forward.go index 2162908..58db928 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_forward.go @@ -92,10 +92,19 @@ func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg st return ElementsMatchf(a.t, listA, listB, msg, args...) } -// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Empty asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // a.Empty(obj) +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -103,10 +112,19 @@ func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool { return Empty(a.t, object, msgAndArgs...) } -// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Emptyf asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // a.Emptyf(obj, "error message %s", "formatted") +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -224,10 +242,8 @@ func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string // Error asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if a.Error(err) { -// assert.Equal(t, expectedError, err) -// } +// actualObj, err := SomeFunction() +// a.Error(err) func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -297,10 +313,8 @@ func (a *Assertions) ErrorIsf(err error, target error, msg string, args ...inter // Errorf asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if a.Errorf(err, "error message %s", "formatted") { -// assert.Equal(t, expectedErrorf, err) -// } +// actualObj, err := SomeFunction() +// a.Errorf(err, "error message %s", "formatted") func (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -868,7 +882,29 @@ func (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...in return IsNonIncreasingf(a.t, object, msg, args...) } +// IsNotType asserts that the specified objects are not of the same type. +// +// a.IsNotType(&NotMyStruct{}, &MyStruct{}) +func (a *Assertions) IsNotType(theType interface{}, object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsNotType(a.t, theType, object, msgAndArgs...) +} + +// IsNotTypef asserts that the specified objects are not of the same type. +// +// a.IsNotTypef(&NotMyStruct{}, &MyStruct{}, "error message %s", "formatted") +func (a *Assertions) IsNotTypef(theType interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsNotTypef(a.t, theType, object, msg, args...) +} + // IsType asserts that the specified objects are of the same type. +// +// a.IsType(&MyStruct{}, &MyStruct{}) func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -877,6 +913,8 @@ func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAnd } // IsTypef asserts that the specified objects are of the same type. +// +// a.IsTypef(&MyStruct{}, &MyStruct{}, "error message %s", "formatted") func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1162,8 +1200,7 @@ func (a *Assertions) NotElementsMatchf(listA interface{}, listB interface{}, msg return NotElementsMatchf(a.t, listA, listB, msg, args...) } -// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmpty asserts that the specified object is NOT [Empty]. // // if a.NotEmpty(obj) { // assert.Equal(t, "two", obj[1]) @@ -1175,8 +1212,7 @@ func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) boo return NotEmpty(a.t, object, msgAndArgs...) } -// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmptyf asserts that the specified object is NOT [Empty]. // // if a.NotEmptyf(obj, "error message %s", "formatted") { // assert.Equal(t, "two", obj[1]) @@ -1378,12 +1414,15 @@ func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg stri return NotSamef(a.t, expected, actual, msg, args...) } -// NotSubset asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubset asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.NotSubset([1, 3, 4], [1, 2]) // a.NotSubset({"x": 1, "y": 2}, {"z": 3}) +// a.NotSubset([1, 3, 4], {1: "one", 2: "two"}) +// a.NotSubset({"x": 1, "y": 2}, ["z"]) func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1391,12 +1430,15 @@ func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs return NotSubset(a.t, list, subset, msgAndArgs...) } -// NotSubsetf asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.NotSubsetf([1, 3, 4], [1, 2], "error message %s", "formatted") // a.NotSubsetf({"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") +// a.NotSubsetf([1, 3, 4], {1: "one", 2: "two"}, "error message %s", "formatted") +// a.NotSubsetf({"x": 1, "y": 2}, ["z"], "error message %s", "formatted") func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1556,11 +1598,15 @@ func (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, return Samef(a.t, expected, actual, msg, args...) } -// Subset asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subset asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.Subset([1, 2, 3], [1, 2]) // a.Subset({"x": 1, "y": 2}, {"x": 1}) +// a.Subset([1, 2, 3], {1: "one", 2: "two"}) +// a.Subset({"x": 1, "y": 2}, ["x"]) func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1568,11 +1614,15 @@ func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ... return Subset(a.t, list, subset, msgAndArgs...) } -// Subsetf asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subsetf asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.Subsetf([1, 2, 3], [1, 2], "error message %s", "formatted") // a.Subsetf({"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") +// a.Subsetf([1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted") +// a.Subsetf({"x": 1, "y": 2}, ["x"], "error message %s", "formatted") func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() diff --git a/vendor/github.com/stretchr/testify/assert/assertion_order.go b/vendor/github.com/stretchr/testify/assert/assertion_order.go index 1d2f718..2fdf80f 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_order.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_order.go @@ -33,7 +33,7 @@ func isOrdered(t TestingT, object interface{}, allowedComparesResults []compareR compareResult, isComparable := compare(prevValueInterface, valueInterface, firstValueKind) if !isComparable { - return Fail(t, fmt.Sprintf("Can not compare type \"%s\" and \"%s\"", reflect.TypeOf(value), reflect.TypeOf(prevValue)), msgAndArgs...) + return Fail(t, fmt.Sprintf(`Can not compare type "%T" and "%T"`, value, prevValue), msgAndArgs...) } if !containsValue(allowedComparesResults, compareResult) { diff --git a/vendor/github.com/stretchr/testify/assert/assertions.go b/vendor/github.com/stretchr/testify/assert/assertions.go index 4e91332..de8de0c 100644 --- a/vendor/github.com/stretchr/testify/assert/assertions.go +++ b/vendor/github.com/stretchr/testify/assert/assertions.go @@ -210,59 +210,77 @@ the problem actually occurred in calling code.*/ // of each stack frame leading from the current test to the assert call that // failed. func CallerInfo() []string { - var pc uintptr - var ok bool var file string var line int var name string + const stackFrameBufferSize = 10 + pcs := make([]uintptr, stackFrameBufferSize) + callers := []string{} - for i := 0; ; i++ { - pc, file, line, ok = runtime.Caller(i) - if !ok { - // The breaks below failed to terminate the loop, and we ran off the - // end of the call stack. - break - } + offset := 1 - // This is a huge edge case, but it will panic if this is the case, see #180 - if file == "" { - break - } + for { + n := runtime.Callers(offset, pcs) - f := runtime.FuncForPC(pc) - if f == nil { - break - } - name = f.Name() - - // testing.tRunner is the standard library function that calls - // tests. Subtests are called directly by tRunner, without going through - // the Test/Benchmark/Example function that contains the t.Run calls, so - // with subtests we should break when we hit tRunner, without adding it - // to the list of callers. - if name == "testing.tRunner" { + if n == 0 { break } - parts := strings.Split(file, "/") - if len(parts) > 1 { - filename := parts[len(parts)-1] - dir := parts[len(parts)-2] - if (dir != "assert" && dir != "mock" && dir != "require") || filename == "mock_test.go" { - callers = append(callers, fmt.Sprintf("%s:%d", file, line)) + frames := runtime.CallersFrames(pcs[:n]) + + for { + frame, more := frames.Next() + pc = frame.PC + file = frame.File + line = frame.Line + + // This is a huge edge case, but it will panic if this is the case, see #180 + if file == "" { + break } - } - // Drop the package - segments := strings.Split(name, ".") - name = segments[len(segments)-1] - if isTest(name, "Test") || - isTest(name, "Benchmark") || - isTest(name, "Example") { - break + f := runtime.FuncForPC(pc) + if f == nil { + break + } + name = f.Name() + + // testing.tRunner is the standard library function that calls + // tests. Subtests are called directly by tRunner, without going through + // the Test/Benchmark/Example function that contains the t.Run calls, so + // with subtests we should break when we hit tRunner, without adding it + // to the list of callers. + if name == "testing.tRunner" { + break + } + + parts := strings.Split(file, "/") + if len(parts) > 1 { + filename := parts[len(parts)-1] + dir := parts[len(parts)-2] + if (dir != "assert" && dir != "mock" && dir != "require") || filename == "mock_test.go" { + callers = append(callers, fmt.Sprintf("%s:%d", file, line)) + } + } + + // Drop the package + dotPos := strings.LastIndexByte(name, '.') + name = name[dotPos+1:] + if isTest(name, "Test") || + isTest(name, "Benchmark") || + isTest(name, "Example") { + break + } + + if !more { + break + } } + + // Next batch + offset += cap(pcs) } return callers @@ -437,17 +455,34 @@ func NotImplements(t TestingT, interfaceObject interface{}, object interface{}, return true } +func isType(expectedType, object interface{}) bool { + return ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) +} + // IsType asserts that the specified objects are of the same type. -func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { +// +// assert.IsType(t, &MyStruct{}, &MyStruct{}) +func IsType(t TestingT, expectedType, object interface{}, msgAndArgs ...interface{}) bool { + if isType(expectedType, object) { + return true + } if h, ok := t.(tHelper); ok { h.Helper() } + return Fail(t, fmt.Sprintf("Object expected to be of type %T, but was %T", expectedType, object), msgAndArgs...) +} - if !ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) { - return Fail(t, fmt.Sprintf("Object expected to be of type %v, but was %v", reflect.TypeOf(expectedType), reflect.TypeOf(object)), msgAndArgs...) +// IsNotType asserts that the specified objects are not of the same type. +// +// assert.IsNotType(t, &NotMyStruct{}, &MyStruct{}) +func IsNotType(t TestingT, theType, object interface{}, msgAndArgs ...interface{}) bool { + if !isType(theType, object) { + return true } - - return true + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Fail(t, fmt.Sprintf("Object type expected to be different than %T", theType), msgAndArgs...) } // Equal asserts that two objects are equal. @@ -475,7 +510,6 @@ func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) } return true - } // validateEqualArgs checks whether provided arguments can be safely used in the @@ -510,8 +544,9 @@ func Same(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) b if !same { // both are pointers but not the same type & pointing to the same address return Fail(t, fmt.Sprintf("Not same: \n"+ - "expected: %p %#v\n"+ - "actual : %p %#v", expected, expected, actual, actual), msgAndArgs...) + "expected: %p %#[1]v\n"+ + "actual : %p %#[2]v", + expected, actual), msgAndArgs...) } return true @@ -530,14 +565,14 @@ func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{} same, ok := samePointers(expected, actual) if !ok { - //fails when the arguments are not pointers + // fails when the arguments are not pointers return !(Fail(t, "Both arguments must be pointers", msgAndArgs...)) } if same { return Fail(t, fmt.Sprintf( - "Expected and actual point to the same object: %p %#v", - expected, expected), msgAndArgs...) + "Expected and actual point to the same object: %p %#[1]v", + expected), msgAndArgs...) } return true } @@ -549,7 +584,7 @@ func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{} func samePointers(first, second interface{}) (same bool, ok bool) { firstPtr, secondPtr := reflect.ValueOf(first), reflect.ValueOf(second) if firstPtr.Kind() != reflect.Ptr || secondPtr.Kind() != reflect.Ptr { - return false, false //not both are pointers + return false, false // not both are pointers } firstType, secondType := reflect.TypeOf(first), reflect.TypeOf(second) @@ -610,7 +645,6 @@ func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interfa } return true - } // EqualExportedValues asserts that the types of two objects are equal and their public @@ -665,7 +699,6 @@ func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{} } return Equal(t, expected, actual, msgAndArgs...) - } // NotNil asserts that the specified object is not nil. @@ -715,37 +748,45 @@ func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { // isEmpty gets whether the specified object is considered empty or not. func isEmpty(object interface{}) bool { - // get nil case out of the way if object == nil { return true } - objValue := reflect.ValueOf(object) + return isEmptyValue(reflect.ValueOf(object)) +} +// isEmptyValue gets whether the specified reflect.Value is considered empty or not. +func isEmptyValue(objValue reflect.Value) bool { + if objValue.IsZero() { + return true + } + // Special cases of non-zero values that we consider empty switch objValue.Kind() { // collection types are empty when they have no element + // Note: array types are empty when they match their zero-initialized state. case reflect.Chan, reflect.Map, reflect.Slice: return objValue.Len() == 0 - // pointers are empty if nil or if the value they point to is empty + // non-nil pointers are empty if the value they point to is empty case reflect.Ptr: - if objValue.IsNil() { - return true - } - deref := objValue.Elem().Interface() - return isEmpty(deref) - // for all other types, compare against the zero value - // array types are empty when they match their zero-initialized state - default: - zero := reflect.Zero(objValue.Type()) - return reflect.DeepEqual(object, zero.Interface()) + return isEmptyValue(objValue.Elem()) } + return false } -// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Empty asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // assert.Empty(t, obj) +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { pass := isEmpty(object) if !pass { @@ -756,11 +797,9 @@ func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { } return pass - } -// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmpty asserts that the specified object is NOT [Empty]. // // if assert.NotEmpty(t, obj) { // assert.Equal(t, "two", obj[1]) @@ -775,7 +814,6 @@ func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { } return pass - } // getLen tries to get the length of an object. @@ -819,7 +857,6 @@ func True(t TestingT, value bool, msgAndArgs ...interface{}) bool { } return true - } // False asserts that the specified value is false. @@ -834,7 +871,6 @@ func False(t TestingT, value bool, msgAndArgs ...interface{}) bool { } return true - } // NotEqual asserts that the specified values are NOT equal. @@ -857,7 +893,6 @@ func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{ } return true - } // NotEqualValues asserts that two objects are not equal even when converted to the same type @@ -880,7 +915,6 @@ func NotEqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...inte // return (true, false) if element was not found. // return (true, true) if element was found. func containsElement(list interface{}, element interface{}) (ok, found bool) { - listValue := reflect.ValueOf(list) listType := reflect.TypeOf(list) if listType == nil { @@ -915,7 +949,6 @@ func containsElement(list interface{}, element interface{}) (ok, found bool) { } } return true, false - } // Contains asserts that the specified string, list(array, slice...) or map contains the @@ -938,7 +971,6 @@ func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bo } return true - } // NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the @@ -961,14 +993,17 @@ func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) } return true - } -// Subset asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subset asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // assert.Subset(t, [1, 2, 3], [1, 2]) // assert.Subset(t, {"x": 1, "y": 2}, {"x": 1}) +// assert.Subset(t, [1, 2, 3], {1: "one", 2: "two"}) +// assert.Subset(t, {"x": 1, "y": 2}, ["x"]) func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) { if h, ok := t.(tHelper); ok { h.Helper() @@ -983,7 +1018,7 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok } subsetKind := reflect.TypeOf(subset).Kind() - if subsetKind != reflect.Array && subsetKind != reflect.Slice && listKind != reflect.Map { + if subsetKind != reflect.Array && subsetKind != reflect.Slice && subsetKind != reflect.Map { return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...) } @@ -1007,6 +1042,13 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok } subsetList := reflect.ValueOf(subset) + if subsetKind == reflect.Map { + keys := make([]interface{}, subsetList.Len()) + for idx, key := range subsetList.MapKeys() { + keys[idx] = key.Interface() + } + subsetList = reflect.ValueOf(keys) + } for i := 0; i < subsetList.Len(); i++ { element := subsetList.Index(i).Interface() ok, found := containsElement(list, element) @@ -1021,12 +1063,15 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok return true } -// NotSubset asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubset asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // assert.NotSubset(t, [1, 3, 4], [1, 2]) // assert.NotSubset(t, {"x": 1, "y": 2}, {"z": 3}) +// assert.NotSubset(t, [1, 3, 4], {1: "one", 2: "two"}) +// assert.NotSubset(t, {"x": 1, "y": 2}, ["z"]) func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1041,7 +1086,7 @@ func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) } subsetKind := reflect.TypeOf(subset).Kind() - if subsetKind != reflect.Array && subsetKind != reflect.Slice && listKind != reflect.Map { + if subsetKind != reflect.Array && subsetKind != reflect.Slice && subsetKind != reflect.Map { return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...) } @@ -1065,11 +1110,18 @@ func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) } subsetList := reflect.ValueOf(subset) + if subsetKind == reflect.Map { + keys := make([]interface{}, subsetList.Len()) + for idx, key := range subsetList.MapKeys() { + keys[idx] = key.Interface() + } + subsetList = reflect.ValueOf(keys) + } for i := 0; i < subsetList.Len(); i++ { element := subsetList.Index(i).Interface() ok, found := containsElement(list, element) if !ok { - return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", list), msgAndArgs...) + return Fail(t, fmt.Sprintf("%q could not be applied builtin len()", list), msgAndArgs...) } if !found { return true @@ -1591,10 +1643,8 @@ func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool { // Error asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if assert.Error(t, err) { -// assert.Equal(t, expectedError, err) -// } +// actualObj, err := SomeFunction() +// assert.Error(t, err) func Error(t TestingT, err error, msgAndArgs ...interface{}) bool { if err == nil { if h, ok := t.(tHelper); ok { @@ -1667,7 +1717,6 @@ func matchRegexp(rx interface{}, str interface{}) bool { default: return r.MatchString(fmt.Sprint(v)) } - } // Regexp asserts that a specified regexp matches a string. @@ -1703,7 +1752,6 @@ func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interf } return !match - } // Zero asserts that i is the zero value for its type. @@ -1814,6 +1862,11 @@ func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{ return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid json.\nJSON parsing error: '%s'", expected, err.Error()), msgAndArgs...) } + // Shortcut if same bytes + if actual == expected { + return true + } + if err := json.Unmarshal([]byte(actual), &actualJSONAsInterface); err != nil { return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid json.\nJSON parsing error: '%s'", actual, err.Error()), msgAndArgs...) } @@ -1832,6 +1885,11 @@ func YAMLEq(t TestingT, expected string, actual string, msgAndArgs ...interface{ return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid yaml.\nYAML parsing error: '%s'", expected, err.Error()), msgAndArgs...) } + // Shortcut if same bytes + if actual == expected { + return true + } + if err := yaml.Unmarshal([]byte(actual), &actualYAMLAsInterface); err != nil { return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid yaml.\nYAML error: '%s'", actual, err.Error()), msgAndArgs...) } @@ -1933,6 +1991,7 @@ func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick t } ch := make(chan bool, 1) + checkCond := func() { ch <- condition() } timer := time.NewTimer(waitFor) defer timer.Stop() @@ -1940,18 +1999,23 @@ func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick t ticker := time.NewTicker(tick) defer ticker.Stop() - for tick := ticker.C; ; { + var tickC <-chan time.Time + + // Check the condition once first on the initial call. + go checkCond() + + for { select { case <-timer.C: return Fail(t, "Condition never satisfied", msgAndArgs...) - case <-tick: - tick = nil - go func() { ch <- condition() }() + case <-tickC: + tickC = nil + go checkCond() case v := <-ch: if v { return true } - tick = ticker.C + tickC = ticker.C } } } @@ -1964,6 +2028,9 @@ type CollectT struct { errors []error } +// Helper is like [testing.T.Helper] but does nothing. +func (CollectT) Helper() {} + // Errorf collects the error. func (c *CollectT) Errorf(format string, args ...interface{}) { c.errors = append(c.errors, fmt.Errorf(format, args...)) @@ -2021,35 +2088,42 @@ func EventuallyWithT(t TestingT, condition func(collect *CollectT), waitFor time var lastFinishedTickErrs []error ch := make(chan *CollectT, 1) + checkCond := func() { + collect := new(CollectT) + defer func() { + ch <- collect + }() + condition(collect) + } + timer := time.NewTimer(waitFor) defer timer.Stop() ticker := time.NewTicker(tick) defer ticker.Stop() - for tick := ticker.C; ; { + var tickC <-chan time.Time + + // Check the condition once first on the initial call. + go checkCond() + + for { select { case <-timer.C: for _, err := range lastFinishedTickErrs { t.Errorf("%v", err) } return Fail(t, "Condition never satisfied", msgAndArgs...) - case <-tick: - tick = nil - go func() { - collect := new(CollectT) - defer func() { - ch <- collect - }() - condition(collect) - }() + case <-tickC: + tickC = nil + go checkCond() case collect := <-ch: if !collect.failed() { return true } // Keep the errors from the last ended condition, so that they can be copied to t if timeout is reached. lastFinishedTickErrs = collect.errors - tick = ticker.C + tickC = ticker.C } } } @@ -2064,6 +2138,7 @@ func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.D } ch := make(chan bool, 1) + checkCond := func() { ch <- condition() } timer := time.NewTimer(waitFor) defer timer.Stop() @@ -2071,18 +2146,23 @@ func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.D ticker := time.NewTicker(tick) defer ticker.Stop() - for tick := ticker.C; ; { + var tickC <-chan time.Time + + // Check the condition once first on the initial call. + go checkCond() + + for { select { case <-timer.C: return true - case <-tick: - tick = nil - go func() { ch <- condition() }() + case <-tickC: + tickC = nil + go checkCond() case v := <-ch: if v { return Fail(t, "Condition satisfied", msgAndArgs...) } - tick = ticker.C + tickC = ticker.C } } } @@ -2100,9 +2180,12 @@ func ErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { var expectedText string if target != nil { expectedText = target.Error() + if err == nil { + return Fail(t, fmt.Sprintf("Expected error with %q in chain but got nil.", expectedText), msgAndArgs...) + } } - chain := buildErrorChainString(err) + chain := buildErrorChainString(err, false) return Fail(t, fmt.Sprintf("Target error should be in err chain:\n"+ "expected: %q\n"+ @@ -2125,7 +2208,7 @@ func NotErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { expectedText = target.Error() } - chain := buildErrorChainString(err) + chain := buildErrorChainString(err, false) return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+ "found: %q\n"+ @@ -2143,11 +2226,17 @@ func ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{ return true } - chain := buildErrorChainString(err) + expectedType := reflect.TypeOf(target).Elem().String() + if err == nil { + return Fail(t, fmt.Sprintf("An error is expected but got nil.\n"+ + "expected: %s", expectedType), msgAndArgs...) + } + + chain := buildErrorChainString(err, true) return Fail(t, fmt.Sprintf("Should be in error chain:\n"+ - "expected: %q\n"+ - "in chain: %s", target, chain, + "expected: %s\n"+ + "in chain: %s", expectedType, chain, ), msgAndArgs...) } @@ -2161,24 +2250,46 @@ func NotErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interfa return true } - chain := buildErrorChainString(err) + chain := buildErrorChainString(err, true) return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+ - "found: %q\n"+ - "in chain: %s", target, chain, + "found: %s\n"+ + "in chain: %s", reflect.TypeOf(target).Elem().String(), chain, ), msgAndArgs...) } -func buildErrorChainString(err error) string { +func unwrapAll(err error) (errs []error) { + errs = append(errs, err) + switch x := err.(type) { + case interface{ Unwrap() error }: + err = x.Unwrap() + if err == nil { + return + } + errs = append(errs, unwrapAll(err)...) + case interface{ Unwrap() []error }: + for _, err := range x.Unwrap() { + errs = append(errs, unwrapAll(err)...) + } + } + return +} + +func buildErrorChainString(err error, withType bool) string { if err == nil { return "" } - e := errors.Unwrap(err) - chain := fmt.Sprintf("%q", err.Error()) - for e != nil { - chain += fmt.Sprintf("\n\t%q", e.Error()) - e = errors.Unwrap(e) + var chain string + errs := unwrapAll(err) + for i := range errs { + if i != 0 { + chain += "\n\t" + } + chain += fmt.Sprintf("%q", errs[i].Error()) + if withType { + chain += fmt.Sprintf(" (%T)", errs[i]) + } } return chain } diff --git a/vendor/github.com/stretchr/testify/assert/doc.go b/vendor/github.com/stretchr/testify/assert/doc.go index 4953981..a0b953a 100644 --- a/vendor/github.com/stretchr/testify/assert/doc.go +++ b/vendor/github.com/stretchr/testify/assert/doc.go @@ -1,5 +1,9 @@ // Package assert provides a set of comprehensive testing tools for use with the normal Go testing system. // +// # Note +// +// All functions in this package return a bool value indicating whether the assertion has passed. +// // # Example Usage // // The following is a complete example using assert in a standard test function: diff --git a/vendor/github.com/stretchr/testify/assert/http_assertions.go b/vendor/github.com/stretchr/testify/assert/http_assertions.go index 861ed4b..5a6bb75 100644 --- a/vendor/github.com/stretchr/testify/assert/http_assertions.go +++ b/vendor/github.com/stretchr/testify/assert/http_assertions.go @@ -138,7 +138,7 @@ func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, contains := strings.Contains(body, fmt.Sprint(str)) if !contains { - Fail(t, fmt.Sprintf("Expected response body for \"%s\" to contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body), msgAndArgs...) + Fail(t, fmt.Sprintf("Expected response body for %q to contain %q but found %q", url+"?"+values.Encode(), str, body), msgAndArgs...) } return contains @@ -158,7 +158,7 @@ func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url strin contains := strings.Contains(body, fmt.Sprint(str)) if contains { - Fail(t, fmt.Sprintf("Expected response body for \"%s\" to NOT contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body), msgAndArgs...) + Fail(t, fmt.Sprintf("Expected response body for %q to NOT contain %q but found %q", url+"?"+values.Encode(), str, body), msgAndArgs...) } return !contains diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go index baa0cc7..5a74c4f 100644 --- a/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go +++ b/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go @@ -1,5 +1,4 @@ //go:build testify_yaml_custom && !testify_yaml_fail && !testify_yaml_default -// +build testify_yaml_custom,!testify_yaml_fail,!testify_yaml_default // Package yaml is an implementation of YAML functions that calls a pluggable implementation. // diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go index b83c6cf..0bae80e 100644 --- a/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go +++ b/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go @@ -1,5 +1,4 @@ //go:build !testify_yaml_fail && !testify_yaml_custom -// +build !testify_yaml_fail,!testify_yaml_custom // Package yaml is just an indirection to handle YAML deserialization. // diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go index e78f7df..8041803 100644 --- a/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go +++ b/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go @@ -1,5 +1,4 @@ //go:build testify_yaml_fail && !testify_yaml_custom && !testify_yaml_default -// +build testify_yaml_fail,!testify_yaml_custom,!testify_yaml_default // Package yaml is an implementation of YAML functions that always fail. // diff --git a/vendor/github.com/stretchr/testify/require/doc.go b/vendor/github.com/stretchr/testify/require/doc.go index 9684347..c8e3f94 100644 --- a/vendor/github.com/stretchr/testify/require/doc.go +++ b/vendor/github.com/stretchr/testify/require/doc.go @@ -23,6 +23,8 @@ // // The `require` package have same global functions as in the `assert` package, // but instead of returning a boolean result they call `t.FailNow()`. +// A consequence of this is that it must be called from the goroutine running +// the test function, not from other goroutines created during the test. // // Every assertion function also takes an optional string message as the final argument, // allowing custom error messages to be appended to the message the assertion method outputs. diff --git a/vendor/github.com/stretchr/testify/require/require.go b/vendor/github.com/stretchr/testify/require/require.go index d892195..2d02f9b 100644 --- a/vendor/github.com/stretchr/testify/require/require.go +++ b/vendor/github.com/stretchr/testify/require/require.go @@ -117,10 +117,19 @@ func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string t.FailNow() } -// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Empty asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // require.Empty(t, obj) +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -131,10 +140,19 @@ func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) { t.FailNow() } -// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Emptyf asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // require.Emptyf(t, obj, "error message %s", "formatted") +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -279,10 +297,8 @@ func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, ar // Error asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if require.Error(t, err) { -// require.Equal(t, expectedError, err) -// } +// actualObj, err := SomeFunction() +// require.Error(t, err) func Error(t TestingT, err error, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -373,10 +389,8 @@ func ErrorIsf(t TestingT, err error, target error, msg string, args ...interface // Errorf asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if require.Errorf(t, err, "error message %s", "formatted") { -// require.Equal(t, expectedErrorf, err) -// } +// actualObj, err := SomeFunction() +// require.Errorf(t, err, "error message %s", "formatted") func Errorf(t TestingT, err error, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1097,7 +1111,35 @@ func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interf t.FailNow() } +// IsNotType asserts that the specified objects are not of the same type. +// +// require.IsNotType(t, &NotMyStruct{}, &MyStruct{}) +func IsNotType(t TestingT, theType interface{}, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsNotType(t, theType, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// IsNotTypef asserts that the specified objects are not of the same type. +// +// require.IsNotTypef(t, &NotMyStruct{}, &MyStruct{}, "error message %s", "formatted") +func IsNotTypef(t TestingT, theType interface{}, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsNotTypef(t, theType, object, msg, args...) { + return + } + t.FailNow() +} + // IsType asserts that the specified objects are of the same type. +// +// require.IsType(t, &MyStruct{}, &MyStruct{}) func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1109,6 +1151,8 @@ func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs } // IsTypef asserts that the specified objects are of the same type. +// +// require.IsTypef(t, &MyStruct{}, &MyStruct{}, "error message %s", "formatted") func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1469,8 +1513,7 @@ func NotElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg str t.FailNow() } -// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmpty asserts that the specified object is NOT [Empty]. // // if require.NotEmpty(t, obj) { // require.Equal(t, "two", obj[1]) @@ -1485,8 +1528,7 @@ func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) { t.FailNow() } -// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmptyf asserts that the specified object is NOT [Empty]. // // if require.NotEmptyf(t, obj, "error message %s", "formatted") { // require.Equal(t, "two", obj[1]) @@ -1745,12 +1787,15 @@ func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, t.FailNow() } -// NotSubset asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubset asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // require.NotSubset(t, [1, 3, 4], [1, 2]) // require.NotSubset(t, {"x": 1, "y": 2}, {"z": 3}) +// require.NotSubset(t, [1, 3, 4], {1: "one", 2: "two"}) +// require.NotSubset(t, {"x": 1, "y": 2}, ["z"]) func NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1761,12 +1806,15 @@ func NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...i t.FailNow() } -// NotSubsetf asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // require.NotSubsetf(t, [1, 3, 4], [1, 2], "error message %s", "formatted") // require.NotSubsetf(t, {"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") +// require.NotSubsetf(t, [1, 3, 4], {1: "one", 2: "two"}, "error message %s", "formatted") +// require.NotSubsetf(t, {"x": 1, "y": 2}, ["z"], "error message %s", "formatted") func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1971,11 +2019,15 @@ func Samef(t TestingT, expected interface{}, actual interface{}, msg string, arg t.FailNow() } -// Subset asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subset asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // require.Subset(t, [1, 2, 3], [1, 2]) // require.Subset(t, {"x": 1, "y": 2}, {"x": 1}) +// require.Subset(t, [1, 2, 3], {1: "one", 2: "two"}) +// require.Subset(t, {"x": 1, "y": 2}, ["x"]) func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1986,11 +2038,15 @@ func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...inte t.FailNow() } -// Subsetf asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subsetf asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // require.Subsetf(t, [1, 2, 3], [1, 2], "error message %s", "formatted") // require.Subsetf(t, {"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") +// require.Subsetf(t, [1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted") +// require.Subsetf(t, {"x": 1, "y": 2}, ["x"], "error message %s", "formatted") func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go b/vendor/github.com/stretchr/testify/require/require_forward.go index 1bd8730..e6f7e94 100644 --- a/vendor/github.com/stretchr/testify/require/require_forward.go +++ b/vendor/github.com/stretchr/testify/require/require_forward.go @@ -93,10 +93,19 @@ func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg st ElementsMatchf(a.t, listA, listB, msg, args...) } -// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Empty asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // a.Empty(obj) +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -104,10 +113,19 @@ func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) { Empty(a.t, object, msgAndArgs...) } -// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Emptyf asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // a.Emptyf(obj, "error message %s", "formatted") +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -225,10 +243,8 @@ func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string // Error asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if a.Error(err) { -// assert.Equal(t, expectedError, err) -// } +// actualObj, err := SomeFunction() +// a.Error(err) func (a *Assertions) Error(err error, msgAndArgs ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -298,10 +314,8 @@ func (a *Assertions) ErrorIsf(err error, target error, msg string, args ...inter // Errorf asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if a.Errorf(err, "error message %s", "formatted") { -// assert.Equal(t, expectedErrorf, err) -// } +// actualObj, err := SomeFunction() +// a.Errorf(err, "error message %s", "formatted") func (a *Assertions) Errorf(err error, msg string, args ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -869,7 +883,29 @@ func (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...in IsNonIncreasingf(a.t, object, msg, args...) } +// IsNotType asserts that the specified objects are not of the same type. +// +// a.IsNotType(&NotMyStruct{}, &MyStruct{}) +func (a *Assertions) IsNotType(theType interface{}, object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsNotType(a.t, theType, object, msgAndArgs...) +} + +// IsNotTypef asserts that the specified objects are not of the same type. +// +// a.IsNotTypef(&NotMyStruct{}, &MyStruct{}, "error message %s", "formatted") +func (a *Assertions) IsNotTypef(theType interface{}, object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsNotTypef(a.t, theType, object, msg, args...) +} + // IsType asserts that the specified objects are of the same type. +// +// a.IsType(&MyStruct{}, &MyStruct{}) func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -878,6 +914,8 @@ func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAnd } // IsTypef asserts that the specified objects are of the same type. +// +// a.IsTypef(&MyStruct{}, &MyStruct{}, "error message %s", "formatted") func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1163,8 +1201,7 @@ func (a *Assertions) NotElementsMatchf(listA interface{}, listB interface{}, msg NotElementsMatchf(a.t, listA, listB, msg, args...) } -// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmpty asserts that the specified object is NOT [Empty]. // // if a.NotEmpty(obj) { // assert.Equal(t, "two", obj[1]) @@ -1176,8 +1213,7 @@ func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) { NotEmpty(a.t, object, msgAndArgs...) } -// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmptyf asserts that the specified object is NOT [Empty]. // // if a.NotEmptyf(obj, "error message %s", "formatted") { // assert.Equal(t, "two", obj[1]) @@ -1379,12 +1415,15 @@ func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg stri NotSamef(a.t, expected, actual, msg, args...) } -// NotSubset asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubset asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.NotSubset([1, 3, 4], [1, 2]) // a.NotSubset({"x": 1, "y": 2}, {"z": 3}) +// a.NotSubset([1, 3, 4], {1: "one", 2: "two"}) +// a.NotSubset({"x": 1, "y": 2}, ["z"]) func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1392,12 +1431,15 @@ func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs NotSubset(a.t, list, subset, msgAndArgs...) } -// NotSubsetf asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.NotSubsetf([1, 3, 4], [1, 2], "error message %s", "formatted") // a.NotSubsetf({"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") +// a.NotSubsetf([1, 3, 4], {1: "one", 2: "two"}, "error message %s", "formatted") +// a.NotSubsetf({"x": 1, "y": 2}, ["z"], "error message %s", "formatted") func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1557,11 +1599,15 @@ func (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, Samef(a.t, expected, actual, msg, args...) } -// Subset asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subset asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.Subset([1, 2, 3], [1, 2]) // a.Subset({"x": 1, "y": 2}, {"x": 1}) +// a.Subset([1, 2, 3], {1: "one", 2: "two"}) +// a.Subset({"x": 1, "y": 2}, ["x"]) func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1569,11 +1615,15 @@ func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ... Subset(a.t, list, subset, msgAndArgs...) } -// Subsetf asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subsetf asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.Subsetf([1, 2, 3], [1, 2], "error message %s", "formatted") // a.Subsetf({"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") +// a.Subsetf([1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted") +// a.Subsetf({"x": 1, "y": 2}, ["x"], "error message %s", "formatted") func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() diff --git a/vendor/modules.txt b/vendor/modules.txt index b4bf369..249c745 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,7 +1,7 @@ -# github.com/NVIDIA/go-nvlib v0.7.3 +# github.com/NVIDIA/go-nvlib v0.8.1 ## explicit; go 1.20 github.com/NVIDIA/go-nvlib/pkg/nvlib/device -# github.com/NVIDIA/go-nvml v0.12.9-0 +# github.com/NVIDIA/go-nvml v0.13.0-1 ## explicit; go 1.20 github.com/NVIDIA/go-nvml/pkg/dl github.com/NVIDIA/go-nvml/pkg/nvml @@ -15,7 +15,7 @@ github.com/google/uuid # github.com/pmezard/go-difflib v1.0.0 ## explicit github.com/pmezard/go-difflib/difflib -# github.com/stretchr/testify v1.10.0 +# github.com/stretchr/testify v1.11.1 ## explicit; go 1.17 github.com/stretchr/testify/assert github.com/stretchr/testify/assert/yaml