title: Java/OpenCL: Checking which graphics card is enabled
body: <p>Using OpenCL I am able to obtain a list of graphics cards available in my system (code snippet below), but I haven't found a way to determine which one is being used at runtime. Is this possible?</p>
  
  <pre><code>for (CLPlatform platform : CLPlatform.listCLPlatforms())
  {
      for (CLDevice gpuDevice : platform.listCLDevices())
      {
          // The CPU shows up as a device, so filter it out.
           if (gpuDevice.getType() == CLDevice.Type.GPU &amp;&amp; gpuDevice.isAvailable())
          {
              availableGPUDevices.add(gpuDevice);
              numGPUDevices++;
          }
      }
  }
  </code></pre>
  
  <p>In theory I'd like to be able to add something along the lines of: </p>
  
  <pre><code>if (platform.getActiveGpu().getType() != AMD or NVIDIA) (pseudo-code)
  {
      // show warning that a more powerful GPU is available
  }
  </code></pre>
  
  <p>The only piece I'm missing is the ability to determine which GPU is active at the time. Any help is greatly appreciated - thank you!!</p>
  
  <p>Clarification: by "which GPU is active" I mean I'm looking to determine, at the moment my code to check this is executing, which GPU is responsible for rendering the content on screen. My understanding is that both GPUs won't be rendering parts of the screen at the same time, so while I know it can switch quite a bit, I'd like to capture a snapshot of which GPU is running at that moment.</p>