/** * 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); }