public CLDevice getBestDevice() { return getBestDevice(Arrays.asList(DeviceFeature.MaxComputeUnits), Arrays.asList(listAllDevices(true))); }
public CLDevice getBestDevice() { return getBestDevice(Arrays.asList(DeviceFeature.MaxComputeUnits), Arrays.asList(listAllDevices(true))); }
private void platformChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_platformChanged CLPlatform platform = (CLPlatform)platformCombo.getSelectedItem(); if (platform != null) { CLDevice[] devices = platform.listAllDevices(true); deviceCombo.setModel(new DefaultComboBoxModel(devices)); setDevice(platform.getBestDevice()); } else { deviceCombo.setModel(new DefaultComboBoxModel(new Object[0])); } }//GEN-LAST:event_platformChanged
/** * 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); } /**
/** * 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); } /**
devicesCombo.setSelectedItem(CLPlatform.getBestDevice(Arrays.asList(CLPlatform.DeviceFeature.MaxComputeUnits), devices)); } catch (Exception ex) { ex.printStackTrace();