Enable/disable Optimus/Enduro in cross platform manner

北城余情 提交于 2019-12-20 05:15:45

问题


In order to save power it is common in recent graphics architectures to dynamically switch between a discrete high-performance and an integrated lower-performance GPU, where the high-performance GPU is only enabled when the need for extra performance is present.

This technology is branded as nvidia Optimus and AMD Enduro for the two main GPU vendors.

However due to the non-standardized way in which these technologies work, managing them from a developer's perspective can be a nightmare. For example in this PDF from nvidia on the subject, they explain the many intricacies, limitations and pitfalls that you will have to worry about as a developer to manage nvidia Optimus on just one platform.

As an example, in the linked PDF above, the following is a tip for selecting GPU on Windows:

extern "C" {
 _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
}

However that will only work for nvidia GPUs on Windows platform. What would be the equivalent for AMD/Intel on OSX/Linux, and on AMD hardware?

So in more detail my question is, how can I

  1. Detect the presence of Optimus/Enduro and possibly other dynamically=switching GPU architectures programmatically?
  2. Select which of the GPUs should be enabled programmatically?
  3. Do so in a manner that is cross-platform over all relevant platforms?
  4. Do so in a manner that works together with all technologies that might use GPU such as DX/OpenGL/Vulkan/OpenCL/CUDA/Qt?

I am working with C++14/Qt5.7 codebase under Ubuntu 16.04-amd64 using nVidia hardware.

来源:https://stackoverflow.com/questions/40684299/enable-disable-optimus-enduro-in-cross-platform-manner

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!