/** List the OpenCL implementations that contain at least one GPU device. */
 public static CLPlatform[] listGPUPoweredPlatforms() {
   CLPlatform[] platforms = listPlatforms();
   List<CLPlatform> out = new ArrayList<CLPlatform>(platforms.length);
   for (CLPlatform platform : platforms) {
     if (platform.listGPUDevices(true).length > 0) out.add(platform);
   }
   return out.toArray(new CLPlatform[out.size()]);
 }
 /**
  * Creates an OpenCL context able to share entities with the current OpenGL context.
  *
  * @throws RuntimeException if JavaCL is unable to create an OpenGL-shared OpenCL context.
  */
 public static CLContext createContextFromCurrentGL() {
   RuntimeException first = null;
   for (CLPlatform platform : listPlatforms()) {
     try {
       CLContext ctx = platform.createContextFromCurrentGL();
       if (ctx != null) return ctx;
     } catch (RuntimeException ex) {
       if (first == null) first = ex;
     }
   }
   throw new RuntimeException(
       "Failed to create an OpenCL context based on the current OpenGL context", first);
 }
 /**
  * Returns the "best" OpenCL device based on the comparison of the provided prioritized device
  * feature.<br>
  * The returned device does not necessarily exhibit the features listed in preferredFeatures, but
  * it has the best ordered composition of them.<br>
  * For instance on a system with a GPU and a CPU device, <code>
  * JavaCL.getBestDevice(CPU, MaxComputeUnits)</code> will return the CPU device, but on another
  * system with two GPUs and no CPU device it will return the GPU that has the most compute units.
  */
 public static CLDevice getBestDevice(CLPlatform.DeviceFeature... preferredFeatures) {
   List<CLDevice> devices = new ArrayList<CLDevice>();
   for (CLPlatform platform : listPlatforms())
     devices.addAll(Arrays.asList(platform.listAllDevices(true)));
   return CLPlatform.getBestDevice(Arrays.asList(preferredFeatures), devices);
 }