Skip to content

Commit

Permalink
add frequency.
Browse files Browse the repository at this point in the history
  • Loading branch information
bethune-bryant committed Jul 30, 2024
1 parent 85d0dbf commit 2c9aadf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions gpustat/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ def processes(self) -> Optional[List[ProcessInfo]]:
"""Get the list of running processes on the GPU."""
return self.entry['processes']

@property
def clk_freq(self) -> Optional[int]:
"""
"""
v = self.entry['clk_freq']
return int(v) if v is not None else None

def print_to(self, fp, *,
with_colors=True, # deprecated arg
show_cmd=False,
Expand Down Expand Up @@ -335,6 +342,10 @@ def __getattr__(self, name): # type: ignore
if show_power is True or 'limit' in show_power:
_write(" / ")
_write(rjustify(safe_self.power_limit, 3), ' W', color='CPowL')

_write(", ")
_write(rjustify(safe_self.clk_freq, 3), color='CPowU')
_write(" MHz")

# Memory
_write(" | ")
Expand Down Expand Up @@ -551,6 +562,10 @@ def _wrapped(*args, **kwargs):
power_limit = safenvml(N.nvmlDeviceGetEnforcedPowerLimit)(handle)
gpu_info['enforced.power.limit'] = power_limit // 1000 if power_limit is not None else None

# Frequency
freq = safenvml(N.nvmlDeviceGetClkFreq)(handle)
gpu_info['clk_freq'] = freq if freq is not None else None

# Processes
nv_comp_processes = safenvml(N.nvmlDeviceGetComputeRunningProcesses)(handle)
nv_graphics_processes = safenvml(N.nvmlDeviceGetGraphicsRunningProcesses)(handle)
Expand Down
3 changes: 3 additions & 0 deletions gpustat/rocml.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ def nvmlDeviceGetComputeRunningProcesses(dev):
def nvmlDeviceGetGraphicsRunningProcesses(dev):
return None

def nvmlDeviceGetClkFreq(dev):
return rocml.smi_get_device_freq(dev)

# Upon importing this module, let rocml be initialized and remain active
# throughout the lifespan of the python process (until gpustat exists).
_initialized: bool
Expand Down

0 comments on commit 2c9aadf

Please sign in to comment.