【问题标题】:How to get GPU temperature programmatically in OSX?如何在 OSX 中以编程方式获取 GPU 温度?
【发布时间】:2014-03-24 09:04:33
【问题描述】:

我正在尝试以编程方式在 mac 的 OSX 平台上获取 GPU 温度

我试图用谷歌搜索解决方案,但我找不到它,我只能找到 CPU 温度和 GPU 使用百分比。

是否有一些 API 或库可以检索传感器数据?

有人可以告诉我从哪里开始吗? 或者提供一些例子?

【问题讨论】:

  • Fan Control Prefpane 是开源的 (GPL)。源包含在下载中。
  • @Emmanuel 它用于 CPU(CPU 很容易通过 SMC 获得)我需要 Gpu 图形处理器。
  • 对不起,我要去预约眼科医生了……
  • @Emmanuel 没关系 :) 还是谢谢!

标签: objective-c c macos gpu sensors


【解决方案1】:

https://developer.nvidia.com/cuda-faq

问:如何从我的应用程序中获取有关 GPU 温度的信息? 在 Microsoft Windows 平台上,NVIDIA 的 NVAPI 提供对 GPU 的访问 温度和许多其他低级 GPU 功能

在 Linux 下,“nvidia-smi”实用程序包含在 标准驱动程序安装,还显示所有 GPU 温度 已安装的设备。

编辑

在进一步了解基于 linux 的系统提供的“nvidia-smi”实用程序时,我发现他们提供了基于 C 的 API 来获取 GPU 温度。

https://developer.nvidia.com/nvidia-management-library-nvml https://developer.nvidia.com/nvidia-system-management-interface

https://developer.nvidia.com/sites/default/files/akamai/cuda/files/CUDADownloads/NVML_cuda5/nvml.4.304.55.pdf

从手册中,我可以看到以下 API 可用于找出“nvidia-smi”提供的 API:

7.9.2.8 nvmlReturn_t DECLDIR nvmlUnitGetTemperature (nvmlUnit_t unit, unsigned int type, unsigned
int  temp)
Retrieves the temperature readings for the unit, in degrees C.
For S-class products.
Depending on the product, readings may be available for intake (type=0), exhaust (type=1) and board (type=2).
Parameters:
unit The identifier of the target unit
type The type of reading to take
temp Reference in which to return the intake temperature
Returns:
• NVML_SUCCESS if temp has been populated
• NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
• NVML_ERROR_INVALID_ARGUMENT if unit or type is invalid or temp is NULL
• NVML_ERROR_NOT_SUPPORTED if this is not an S-class product
• NVML_ERROR_UNKNOWN on any unexpected error

希望这会很有用,这样您就可以满足您的要求。 “nvidia-smi”在内部使用上述 API 来找出用户获取的 GPU 的温度。这是 NVIDIA 提供的命令行实用程序。

【讨论】:

  • 但是SMC on(例如MBP)不应该知道INFO来相对调整FAN速度吗?我确信有一些通用的方法,可以从用户范围内访问。
  • @Roma-MT:好吧,我可能不太了解 GPU,我的信息是根据我对您的问题的发现让您知道。但是,您似乎正在尝试在用户空间模式下获取/查找有关硬件的工具低级信息。通常这些信息是并且应该保留给内核模式。无论如何,我的帖子没有任何进一步的更新。
  • 好的,非常感谢!!内核模式也是可以接受的))
  • @Roma-MT:查看我编辑过的帖子。希望这对你有用。
  • 我会尝试实现它,我会在知道答案后立即更新您,谢谢 MR :)
【解决方案2】:

试试这个名为“magican”的,图标是大象,cpu和gpu温度可以显示在状态栏,点击可以看到你启动的进度 http://i.stack.imgur.com/ekeW2.png

从http://www.magicansoft.com/下载

【讨论】:

  • 是的,我看到了这个软件,但我正在寻找库或原生 API 来使用 obj-c 或 c 直接从内核获取这些数据。 (感谢您的快速回复)编辑我的问题以避免进一步的误解。
  • 嗯,它是 [C]PU 温度 :)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-29
  • 2011-09-07
  • 2018-04-07
  • 2011-01-10
  • 1970-01-01
相关资源
最近更新 更多