Skip to content

Commit

Permalink
Convert all uppercase local variables to lowercase
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Klues <kklues@nvidia.com>
  • Loading branch information
klueska committed Apr 12, 2024
1 parent 80b4064 commit 3d3e863
Show file tree
Hide file tree
Showing 8 changed files with 2,075 additions and 2,072 deletions.
761 changes: 382 additions & 379 deletions pkg/nvml/api.go

Large diffs are not rendered by default.

2,678 changes: 1,339 additions & 1,339 deletions pkg/nvml/device.go

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions pkg/nvml/event_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ func (l *library) EventSetCreate() (EventSet, Return) {
}

// nvml.EventSetWait()
func (l *library) EventSetWait(Set EventSet, Timeoutms uint32) (EventData, Return) {
return Set.Wait(Timeoutms)
func (l *library) EventSetWait(set EventSet, timeoutms uint32) (EventData, Return) {
return set.Wait(timeoutms)
}

func (Set nvmlEventSet) Wait(Timeoutms uint32) (EventData, Return) {
var Data EventData
ret := nvmlEventSetWait(Set, &Data, Timeoutms)
return Data, ret
func (set nvmlEventSet) Wait(timeoutms uint32) (EventData, Return) {
var data EventData
ret := nvmlEventSetWait(set, &data, timeoutms)
return data, ret
}

// nvml.EventSetFree()
func (l *library) EventSetFree(Set EventSet) Return {
return Set.Free()
func (l *library) EventSetFree(set EventSet) Return {
return set.Free()
}

func (Set nvmlEventSet) Free() Return {
return nvmlEventSetFree(Set)
func (set nvmlEventSet) Free() Return {
return nvmlEventSetFree(set)
}
86 changes: 43 additions & 43 deletions pkg/nvml/gpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,88 +19,88 @@ type GpmMetricsGetVType struct {
metricsGet *GpmMetricsGetType
}

func (l *library) GpmMetricsGetV(MetricsGet *GpmMetricsGetType) GpmMetricsGetVType {
return GpmMetricsGetVType{MetricsGet}
func (l *library) GpmMetricsGetV(metricsGet *GpmMetricsGetType) GpmMetricsGetVType {
return GpmMetricsGetVType{metricsGet}
}
func (MetricsGetV GpmMetricsGetVType) V1() Return {
MetricsGetV.metricsGet.Version = 1
return nvmlGpmMetricsGet(MetricsGetV.metricsGet)
func (metricsGetV GpmMetricsGetVType) V1() Return {
metricsGetV.metricsGet.Version = 1
return nvmlGpmMetricsGet(metricsGetV.metricsGet)
}

func (l *library) GpmMetricsGet(MetricsGet *GpmMetricsGetType) Return {
MetricsGet.Version = GPM_METRICS_GET_VERSION
return nvmlGpmMetricsGet(MetricsGet)
func (l *library) GpmMetricsGet(metricsGet *GpmMetricsGetType) Return {
metricsGet.Version = GPM_METRICS_GET_VERSION
return nvmlGpmMetricsGet(metricsGet)
}

// nvml.GpmSampleFree()
func (l *library) GpmSampleFree(GpmSample GpmSample) Return {
return GpmSample.Free()
func (l *library) GpmSampleFree(gpmSample GpmSample) Return {
return gpmSample.Free()
}

func (GpmSample nvmlGpmSample) Free() Return {
return nvmlGpmSampleFree(GpmSample)
func (gpmSample nvmlGpmSample) Free() Return {
return nvmlGpmSampleFree(gpmSample)
}

// nvml.GpmSampleAlloc()
func (l *library) GpmSampleAlloc() (GpmSample, Return) {
var GpmSample nvmlGpmSample
ret := nvmlGpmSampleAlloc(&GpmSample)
return GpmSample, ret
var gpmSample nvmlGpmSample
ret := nvmlGpmSampleAlloc(&gpmSample)
return gpmSample, ret
}

// nvml.GpmSampleGet()
func (l *library) GpmSampleGet(Device Device, GpmSample GpmSample) Return {
return GpmSample.Get(Device)
func (l *library) GpmSampleGet(device Device, gpmSample GpmSample) Return {
return gpmSample.Get(device)
}

func (Device nvmlDevice) GpmSampleGet(GpmSample GpmSample) Return {
return GpmSample.Get(Device)
func (device nvmlDevice) GpmSampleGet(gpmSample GpmSample) Return {
return gpmSample.Get(device)
}

func (GpmSample nvmlGpmSample) Get(Device Device) Return {
return nvmlGpmSampleGet(Device.(nvmlDevice), GpmSample)
func (gpmSample nvmlGpmSample) Get(device Device) Return {
return nvmlGpmSampleGet(device.(nvmlDevice), gpmSample)
}

// nvml.GpmQueryDeviceSupport()
type GpmSupportV struct {
device nvmlDevice
}

func (l *library) GpmQueryDeviceSupportV(Device Device) GpmSupportV {
return Device.GpmQueryDeviceSupportV()
func (l *library) GpmQueryDeviceSupportV(device Device) GpmSupportV {
return device.GpmQueryDeviceSupportV()
}

func (Device nvmlDevice) GpmQueryDeviceSupportV() GpmSupportV {
return GpmSupportV{Device}
func (device nvmlDevice) GpmQueryDeviceSupportV() GpmSupportV {
return GpmSupportV{device}
}

func (GpmSupportV GpmSupportV) V1() (GpmSupport, Return) {
var GpmSupport GpmSupport
GpmSupport.Version = 1
ret := nvmlGpmQueryDeviceSupport(GpmSupportV.device, &GpmSupport)
return GpmSupport, ret
func (gpmSupportV GpmSupportV) V1() (GpmSupport, Return) {
var gpmSupport GpmSupport
gpmSupport.Version = 1
ret := nvmlGpmQueryDeviceSupport(gpmSupportV.device, &gpmSupport)
return gpmSupport, ret
}

func (l *library) GpmQueryDeviceSupport(Device Device) (GpmSupport, Return) {
return Device.GpmQueryDeviceSupport()
func (l *library) GpmQueryDeviceSupport(device Device) (GpmSupport, Return) {
return device.GpmQueryDeviceSupport()
}

func (Device nvmlDevice) GpmQueryDeviceSupport() (GpmSupport, Return) {
var GpmSupport GpmSupport
GpmSupport.Version = GPM_SUPPORT_VERSION
ret := nvmlGpmQueryDeviceSupport(Device, &GpmSupport)
return GpmSupport, ret
func (device nvmlDevice) GpmQueryDeviceSupport() (GpmSupport, Return) {
var gpmSupport GpmSupport
gpmSupport.Version = GPM_SUPPORT_VERSION
ret := nvmlGpmQueryDeviceSupport(device, &gpmSupport)
return gpmSupport, ret
}

// nvml.GpmMigSampleGet()
func (l *library) GpmMigSampleGet(Device Device, GpuInstanceId int, GpmSample GpmSample) Return {
return GpmSample.MigGet(Device, GpuInstanceId)
func (l *library) GpmMigSampleGet(device Device, gpuInstanceId int, gpmSample GpmSample) Return {
return gpmSample.MigGet(device, gpuInstanceId)
}

func (Device nvmlDevice) GpmMigSampleGet(GpuInstanceId int, GpmSample GpmSample) Return {
return GpmSample.MigGet(Device, GpuInstanceId)
func (device nvmlDevice) GpmMigSampleGet(gpuInstanceId int, gpmSample GpmSample) Return {
return gpmSample.MigGet(device, gpuInstanceId)
}

func (GpmSample nvmlGpmSample) MigGet(Device Device, GpuInstanceId int) Return {
return nvmlGpmMigSampleGet(Device.(nvmlDevice), uint32(GpuInstanceId), GpmSample)
func (gpmSample nvmlGpmSample) MigGet(device Device, gpuInstanceId int) Return {
return nvmlGpmMigSampleGet(device.(nvmlDevice), uint32(gpuInstanceId), gpmSample)
}
4 changes: 2 additions & 2 deletions pkg/nvml/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ func (l *library) Init() Return {
}

// nvml.InitWithFlags()
func (l *library) InitWithFlags(Flags uint32) Return {
func (l *library) InitWithFlags(flags uint32) Return {
if err := libnvml.load(); err != nil {
return ERROR_LIBRARY_NOT_FOUND
}
return nvmlInitWithFlags(Flags)
return nvmlInitWithFlags(flags)
}

// nvml.Shutdown()
Expand Down
32 changes: 16 additions & 16 deletions pkg/nvml/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,39 +43,39 @@ func (l *library) SystemGetCudaDriverVersion_v2() (int, Return) {
}

// nvml.SystemGetProcessName()
func (l *library) SystemGetProcessName(Pid int) (string, Return) {
Name := make([]byte, SYSTEM_PROCESS_NAME_BUFFER_SIZE)
ret := nvmlSystemGetProcessName(uint32(Pid), &Name[0], SYSTEM_PROCESS_NAME_BUFFER_SIZE)
return string(Name[:clen(Name)]), ret
func (l *library) SystemGetProcessName(pid int) (string, Return) {
name := make([]byte, SYSTEM_PROCESS_NAME_BUFFER_SIZE)
ret := nvmlSystemGetProcessName(uint32(pid), &name[0], SYSTEM_PROCESS_NAME_BUFFER_SIZE)
return string(name[:clen(name)]), ret
}

// nvml.SystemGetHicVersion()
func (l *library) SystemGetHicVersion() ([]HwbcEntry, Return) {
var HwbcCount uint32 = 1 // Will be reduced upon returning
var hwbcCount uint32 = 1 // Will be reduced upon returning
for {
HwbcEntries := make([]HwbcEntry, HwbcCount)
ret := nvmlSystemGetHicVersion(&HwbcCount, &HwbcEntries[0])
hwbcEntries := make([]HwbcEntry, hwbcCount)
ret := nvmlSystemGetHicVersion(&hwbcCount, &hwbcEntries[0])
if ret == SUCCESS {
return HwbcEntries[:HwbcCount], ret
return hwbcEntries[:hwbcCount], ret
}
if ret != ERROR_INSUFFICIENT_SIZE {
return nil, ret
}
HwbcCount *= 2
hwbcCount *= 2
}
}

// nvml.SystemGetTopologyGpuSet()
func (l *library) SystemGetTopologyGpuSet(CpuNumber int) ([]Device, Return) {
var Count uint32
ret := nvmlSystemGetTopologyGpuSet(uint32(CpuNumber), &Count, nil)
func (l *library) SystemGetTopologyGpuSet(cpuNumber int) ([]Device, Return) {
var count uint32
ret := nvmlSystemGetTopologyGpuSet(uint32(cpuNumber), &count, nil)
if ret != SUCCESS {
return nil, ret
}
if Count == 0 {
if count == 0 {
return []Device{}, ret
}
DeviceArray := make([]nvmlDevice, Count)
ret = nvmlSystemGetTopologyGpuSet(uint32(CpuNumber), &Count, &DeviceArray[0])
return convertSlice[nvmlDevice, Device](DeviceArray), ret
deviceArray := make([]nvmlDevice, count)
ret = nvmlSystemGetTopologyGpuSet(uint32(cpuNumber), &count, &deviceArray[0])
return convertSlice[nvmlDevice, Device](deviceArray), ret
}
92 changes: 46 additions & 46 deletions pkg/nvml/unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,92 +22,92 @@ func (l *library) UnitGetCount() (int, Return) {
}

// nvml.UnitGetHandleByIndex()
func (l *library) UnitGetHandleByIndex(Index int) (Unit, Return) {
var Unit nvmlUnit
ret := nvmlUnitGetHandleByIndex(uint32(Index), &Unit)
return Unit, ret
func (l *library) UnitGetHandleByIndex(index int) (Unit, Return) {
var unit nvmlUnit
ret := nvmlUnitGetHandleByIndex(uint32(index), &unit)
return unit, ret
}

// nvml.UnitGetUnitInfo()
func (l *library) UnitGetUnitInfo(Unit Unit) (UnitInfo, Return) {
return Unit.GetUnitInfo()
func (l *library) UnitGetUnitInfo(unit Unit) (UnitInfo, Return) {
return unit.GetUnitInfo()
}

func (Unit nvmlUnit) GetUnitInfo() (UnitInfo, Return) {
var Info UnitInfo
ret := nvmlUnitGetUnitInfo(Unit, &Info)
return Info, ret
func (unit nvmlUnit) GetUnitInfo() (UnitInfo, Return) {
var info UnitInfo
ret := nvmlUnitGetUnitInfo(unit, &info)
return info, ret
}

// nvml.UnitGetLedState()
func (l *library) UnitGetLedState(Unit Unit) (LedState, Return) {
return Unit.GetLedState()
func (l *library) UnitGetLedState(unit Unit) (LedState, Return) {
return unit.GetLedState()
}

func (Unit nvmlUnit) GetLedState() (LedState, Return) {
var State LedState
ret := nvmlUnitGetLedState(Unit, &State)
return State, ret
func (unit nvmlUnit) GetLedState() (LedState, Return) {
var state LedState
ret := nvmlUnitGetLedState(unit, &state)
return state, ret
}

// nvml.UnitGetPsuInfo()
func (l *library) UnitGetPsuInfo(Unit Unit) (PSUInfo, Return) {
return Unit.GetPsuInfo()
func (l *library) UnitGetPsuInfo(unit Unit) (PSUInfo, Return) {
return unit.GetPsuInfo()
}

func (Unit nvmlUnit) GetPsuInfo() (PSUInfo, Return) {
var Psu PSUInfo
ret := nvmlUnitGetPsuInfo(Unit, &Psu)
return Psu, ret
func (unit nvmlUnit) GetPsuInfo() (PSUInfo, Return) {
var psu PSUInfo
ret := nvmlUnitGetPsuInfo(unit, &psu)
return psu, ret
}

// nvml.UnitGetTemperature()
func (l *library) UnitGetTemperature(Unit Unit, Type int) (uint32, Return) {
return Unit.GetTemperature(Type)
func (l *library) UnitGetTemperature(unit Unit, ttype int) (uint32, Return) {
return unit.GetTemperature(ttype)
}

func (Unit nvmlUnit) GetTemperature(Type int) (uint32, Return) {
var Temp uint32
ret := nvmlUnitGetTemperature(Unit, uint32(Type), &Temp)
return Temp, ret
func (unit nvmlUnit) GetTemperature(ttype int) (uint32, Return) {
var temp uint32
ret := nvmlUnitGetTemperature(unit, uint32(ttype), &temp)
return temp, ret
}

// nvml.UnitGetFanSpeedInfo()
func (l *library) UnitGetFanSpeedInfo(Unit Unit) (UnitFanSpeeds, Return) {
return Unit.GetFanSpeedInfo()
func (l *library) UnitGetFanSpeedInfo(unit Unit) (UnitFanSpeeds, Return) {
return unit.GetFanSpeedInfo()
}

func (Unit nvmlUnit) GetFanSpeedInfo() (UnitFanSpeeds, Return) {
var FanSpeeds UnitFanSpeeds
ret := nvmlUnitGetFanSpeedInfo(Unit, &FanSpeeds)
return FanSpeeds, ret
func (unit nvmlUnit) GetFanSpeedInfo() (UnitFanSpeeds, Return) {
var fanSpeeds UnitFanSpeeds
ret := nvmlUnitGetFanSpeedInfo(unit, &fanSpeeds)
return fanSpeeds, ret
}

// nvml.UnitGetDevices()
func (l *library) UnitGetDevices(Unit Unit) ([]Device, Return) {
return Unit.GetDevices()
func (l *library) UnitGetDevices(unit Unit) ([]Device, Return) {
return unit.GetDevices()
}

func (Unit nvmlUnit) GetDevices() ([]Device, Return) {
var DeviceCount uint32 = 1 // Will be reduced upon returning
func (unit nvmlUnit) GetDevices() ([]Device, Return) {
var deviceCount uint32 = 1 // Will be reduced upon returning
for {
Devices := make([]nvmlDevice, DeviceCount)
ret := nvmlUnitGetDevices(Unit, &DeviceCount, &Devices[0])
devices := make([]nvmlDevice, deviceCount)
ret := nvmlUnitGetDevices(unit, &deviceCount, &devices[0])
if ret == SUCCESS {
return convertSlice[nvmlDevice, Device](Devices[:DeviceCount]), ret
return convertSlice[nvmlDevice, Device](devices[:deviceCount]), ret
}
if ret != ERROR_INSUFFICIENT_SIZE {
return nil, ret
}
DeviceCount *= 2
deviceCount *= 2
}
}

// nvml.UnitSetLedState()
func (l *library) UnitSetLedState(Unit Unit, Color LedColor) Return {
return Unit.SetLedState(Color)
func (l *library) UnitSetLedState(unit Unit, color LedColor) Return {
return unit.SetLedState(color)
}

func (Unit nvmlUnit) SetLedState(Color LedColor) Return {
return nvmlUnitSetLedState(Unit, Color)
func (unit nvmlUnit) SetLedState(color LedColor) Return {
return nvmlUnitSetLedState(unit, color)
}

0 comments on commit 3d3e863

Please sign in to comment.