Skip to content

Commit

Permalink
Merge pull request #25 from NVIDIA/add-set-compute-mode
Browse files Browse the repository at this point in the history
Add SetComputeMode method to Device
  • Loading branch information
elezar authored Mar 11, 2024
2 parents 22de91f + 2feaa48 commit 6ac4869
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/nvml/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,9 @@ func (d nvmlDevice) GetNvLinkRemotePciInfo(link int) (PciInfo, Return) {
p, r := nvml.Device(d).GetNvLinkRemotePciInfo(link)
return PciInfo(p), Return(r)
}

// SetComputeMode sets the compute mode for the device.
func (d nvmlDevice) SetComputeMode(mode ComputeMode) Return {
r := nvml.Device(d).SetComputeMode(nvml.ComputeMode(mode))
return Return(r)
}
44 changes: 44 additions & 0 deletions pkg/nvml/device_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/nvml/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type Device interface {
GetUUID() (string, Return)
IsMigDeviceHandle() (bool, Return)
RegisterEvents(uint64, EventSet) Return
SetComputeMode(ComputeMode) Return
SetMigMode(Mode int) (Return, Return)
// nvmlDeviceHandle returns a pointer to the underlying NVML device.
nvmlDeviceHandle() *nvml.Device
Expand Down Expand Up @@ -156,3 +157,6 @@ type GpuTopologyLevel nvml.GpuTopologyLevel

// EnableState represents a generic enable/disable enum
type EnableState nvml.EnableState

// ComputeMode represents the compute mode for a device
type ComputeMode nvml.ComputeMode

0 comments on commit 6ac4869

Please sign in to comment.