Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Max memory clock methods point to current memory clock methods #46

Closed
singlecheeze opened this issue Oct 27, 2022 · 1 comment
Closed
Assignees
Labels
bug Something isn't working

Comments

@singlecheeze
Copy link

"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
@XuehaiPan XuehaiPan added the bug Something isn't working label Oct 27, 2022
@XuehaiPan XuehaiPan self-assigned this Oct 27, 2022
@XuehaiPan
Copy link
Owner

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants