Anteru's blog
  • Consulting
  • Research
    • Assisted environment probe placement
    • Assisted texture assignment
    • Edge-Friend: Fast and Deterministic Catmull-Clark Subdivision Surfaces
    • Error Metrics for Smart Image Refinement
    • High-Quality Shadows for Streaming Terrain Rendering
    • Hybrid Sample-based Surface Rendering
    • Interactive rendering of Giga-Particle Fluid Simulations
    • Quantitative Analysis of Voxel Raytracing Acceleration Structures
    • Real-time Hybrid Hair Rendering
    • Real-Time Procedural Generation with GPU Work Graphs
    • Scalable rendering for very large meshes
    • Spatiotemporal Variance-Guided Filtering for Motion Blur
    • Subpixel Reconstruction Antialiasing
    • Tiled light trees
    • Towards Practical Meshlet Compression
  • About
  • Archive

Robust OpenCL initialization, part #2 (Optimus & friends)

April 28, 2014
  • Graphics
  • Opencl
  • Programming
approximately 1 minutes to read

I totally forgot it, but there is one thing related to robust OpenCL initialization which is difficult to impossible to solve robustly, and that is handling hybrid graphics. This blog post is NVIDIA/Intel specific, which is a very common configuration these days, and it will only affect you if you want to use graphics & compute interop.

The problem that you will run into is easy to explain:

  • The D3D device is created on the Intel integrated chip (device #0 if you enumerate them), which is (potentially) re-routed to the NVIDIA driver due to Optimus
  • OpenCL interop will not be aware of this, so the Intel OpenCL runtime will try to interop with a hijacked Intel driver, and fail

If Optimus is disabled (i.e. there is no NVIDIA graphics adapter), everything will work fine. Similarly, it’ll just work if you have the integrated chip disabled. The problems only crop up if both devices are active and available.

Unfortunately, I don’t have a good solutions for this problem. The most robust way seems to be to enumerate all devices and prefer NVIDIA over Intel, which may not be what you want (especially if the user asked for the integrated device.) Ideally, you’d like some query to check if Optimus is present and if it should be used for your application, and only then, use NVIDIA, but so far, I haven’t found a way to do this (if you know a solution, please drop a line in the comments!)

I’m not sure what happens with AMD’s equivalent (Enduro), but I would assume that it’ll be similarly complicated. If you know it, please tell me so I can update this post accordingly!

Previous post
Next post

Recent posts

  • Data formats: Why CSV and JSON aren't the best
    Posted on 2024-12-29
  • Replacing cron with systemd-timers
    Posted on 2024-04-21
  • Open Source Maintenance
    Posted on 2024-04-02
  • Angular, Caddy, Gunicorn and Django
    Posted on 2023-10-21
  • Effective meetings
    Posted on 2022-09-12
  • Older posts

Find me on the web

  • GitHub
  • GPU database
  • Projects

Follow me

Anteru NIV_Anteru
Contents © 2005-2025
Anteru
Imprint/Impressum
Privacy policy/Datenschutz
Made with Liara
Last updated February 03, 2019