[GH-ISSUE #46] Max memory clock methods point to current memory clock methods #33

Closed
opened 2026-05-05 03:22:39 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @singlecheeze on GitHub (Oct 27, 2022).
Original GitHub issue: https://github.com/XuehaiPan/nvitop/issues/46

Originally assigned to: @XuehaiPan on GitHub.

"gpu_max_clock_graphics_mhz": gpu.max_graphics_clock(),
"gpu_max_clock_sm_mhz": gpu.max_sm_clock(),
"gpu_max_clock_memory_mhz": gpu.max_memory_clock(),
"gpu_max_clock_video_mhz": gpu.max_video_clock(),
    def max_graphics_clock(self) -> Union[int, NaType]:  # in MHz
        """Maximum frequency of graphics (shader) clock in MHz.

        Returns: Union[int, NaType]
            The maximum frequency of graphics (shader) clock in MHz, or :const:`nvitop.NA` when not applicable.

        Command line equivalent:

        .. code:: bash

            nvidia-smi --id=<IDENTIFIER> --format=csv,noheader,nounits --query-gpu=clocks.max.graphics
        """  # pylint: disable=line-too-long

        return self.clock_infos().graphics
    @memoize_when_activated
    @ttl_cache(ttl=5.0)
    def clock_infos(self) -> ClockInfos:  # in MHz
        """Returns a named tuple with current clock speeds (in MHz) for the device.

        Returns: ClockInfos(graphics, sm, memory, video)
            A named tuple with current clock speeds (in MHz) for the device, the item could be :const:`nvitop.NA` when not applicable.
        """  # pylint: disable=line-too-long

        return ClockInfos(
            graphics=libnvml.nvmlQuery(
                'nvmlDeviceGetClockInfo', self.handle, libnvml.NVML_CLOCK_GRAPHICS
            ),
            sm=libnvml.nvmlQuery('nvmlDeviceGetClockInfo', self.handle, libnvml.NVML_CLOCK_SM),
            memory=libnvml.nvmlQuery('nvmlDeviceGetClockInfo', self.handle, libnvml.NVML_CLOCK_MEM),
            video=libnvml.nvmlQuery(
                'nvmlDeviceGetClockInfo', self.handle, libnvml.NVML_CLOCK_VIDEO
            ),
        )

    clocks = clock_infos
Originally created by @singlecheeze on GitHub (Oct 27, 2022). Original GitHub issue: https://github.com/XuehaiPan/nvitop/issues/46 Originally assigned to: @XuehaiPan on GitHub. ```python "gpu_max_clock_graphics_mhz": gpu.max_graphics_clock(), "gpu_max_clock_sm_mhz": gpu.max_sm_clock(), "gpu_max_clock_memory_mhz": gpu.max_memory_clock(), "gpu_max_clock_video_mhz": gpu.max_video_clock(), ``` ```python def max_graphics_clock(self) -> Union[int, NaType]: # in MHz """Maximum frequency of graphics (shader) clock in MHz. Returns: Union[int, NaType] The maximum frequency of graphics (shader) clock in MHz, or :const:`nvitop.NA` when not applicable. Command line equivalent: .. code:: bash nvidia-smi --id=<IDENTIFIER> --format=csv,noheader,nounits --query-gpu=clocks.max.graphics """ # pylint: disable=line-too-long return self.clock_infos().graphics ``` ```python @memoize_when_activated @ttl_cache(ttl=5.0) def clock_infos(self) -> ClockInfos: # in MHz """Returns a named tuple with current clock speeds (in MHz) for the device. Returns: ClockInfos(graphics, sm, memory, video) A named tuple with current clock speeds (in MHz) for the device, the item could be :const:`nvitop.NA` when not applicable. """ # pylint: disable=line-too-long return ClockInfos( graphics=libnvml.nvmlQuery( 'nvmlDeviceGetClockInfo', self.handle, libnvml.NVML_CLOCK_GRAPHICS ), sm=libnvml.nvmlQuery('nvmlDeviceGetClockInfo', self.handle, libnvml.NVML_CLOCK_SM), memory=libnvml.nvmlQuery('nvmlDeviceGetClockInfo', self.handle, libnvml.NVML_CLOCK_MEM), video=libnvml.nvmlQuery( 'nvmlDeviceGetClockInfo', self.handle, libnvml.NVML_CLOCK_VIDEO ), ) clocks = clock_infos ```
gitea-mirror 2026-05-05 03:22:39 -06:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@XuehaiPan commented on GitHub (Oct 27, 2022):

@singlecheeze Thanks for reporting this! It’s a bug by mistake. I have added a quick fix in the main branch and will be included in a future release.

As a temporary solution, you can use:

sm_clock = device.clock_infos().sm          # current (MHz)
max_sm_clock = device.max_clock_infos().sm  # maximum (MHz)

or

clocks = device.clock_speed_infos()
sm_clock = clocks.current.sm
max_sm_clock = clocks.max.sm
<!-- gh-comment-id:1293840817 --> @XuehaiPan commented on GitHub (Oct 27, 2022): @singlecheeze Thanks for reporting this! It’s a bug by mistake. I have added a quick fix in the main branch and will be included in a future release. As a temporary solution, you can use: ```python sm_clock = device.clock_infos().sm # current (MHz) max_sm_clock = device.max_clock_infos().sm # maximum (MHz) ``` or ```python clocks = device.clock_speed_infos() sm_clock = clocks.current.sm max_sm_clock = clocks.max.sm ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/nvitop#33
No description provided.