NVIDIA guide for CUDA developers on Optimus platforms: querying CUDA devices, Direct3D/OpenGL interop, and Control Panel profiles.
This reference guide from NVIDIA explains how CUDA developers should query for GPU capabilities on systems that use NVIDIA Optimus technology. It describes how Optimus systems contain both an Intel integrated graphics processor (IGP) and an NVIDIA GPU, and how the driver decides whether an application runs on the GPU or the IGP, so that CUDA applications behave correctly on Optimus notebooks.
The guide covers querying for a CUDA device with and without graphics interoperability, including the CUDA runtime and driver API calls used and code samples for choosing the highest-performance CUDA-capable device. It also describes restrictions for Direct3D and OpenGL interoperability, plus the use of NVIDIA Control Panel application profiles and driver updates.
| Optimus system hardware | An Intel integrated graphics processor (IGP) plus an NVIDIA GPU |
|---|---|
| Display output handling | The final image output to the display is handled by the Intel IGP |
| GPU output transfer bus | PCI-Express |
| CUDA device query APIs | cudaGetDeviceProperties (CUDA runtime API) and cuDeviceComputeCapability (CUDA Driver API) |
| Graphics interoperability APIs | Direct3D and OpenGL |
Use the CUDA API functions cudaGetDeviceProperties (CUDA runtime API) and cuDeviceComputeCapability (CUDA Driver API). The CUDA Sample deviceQuery or deviceQueryDrv has more details.
If the graphics context is created before any CUDA API calls, it may be created on the Intel IGP, which does not allow graphics interoperability with CUDA running on the NVIDIA GPU.
Create an application profile in the NVIDIA Control Panel, so the context is always created on the NVIDIA GPU when the application is launched.
It would see the Intel graphics adapter as the primary display device, which is not capable of running CUDA, so the application should detect the second device, the NVIDIA GPU.