public CLDevice getBestDevice() { return getBestDevice(Arrays.asList(DeviceFeature.MaxComputeUnits), Arrays.asList(listAllDevices(true))); }
public CLContext createContextFromCurrentGL() { return createGLCompatibleContext(listAllDevices(true)); }
public CLDevice getBestDevice() { return getBestDevice(Arrays.asList(DeviceFeature.MaxComputeUnits), Arrays.asList(listAllDevices(true))); }
public CLContext createContextFromCurrentGL() { return createGLCompatibleContext(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); } /**
for (CLDevice device : platform.listAllDevices(false)) { Map<String, Object> devInfos = new TreeMap<String, Object>(platInfos); for (Map.Entry<String, Method> devMet : devMets.entrySet()) {
for (CLDevice device : platform.listAllDevices(false)) { Map<String, Object> devInfos = new TreeMap<String, Object>(platInfos); for (Map.Entry<String, Method> devMet : devMets.entrySet()) {
for (CLDevice device : platform.listAllDevices(false)) { Map<String, Object> devInfos = new TreeMap<String, Object>(platInfos); for (Map.Entry<String, Method> devMet : devMets.entrySet()) {
public List<CLPlatform> getPlatforms() { CLPlatform[] platforms = JavaCL.listPlatforms(); boolean hasSharing = false; plat: for (CLPlatform platform : platforms) if (platform.isGLSharingSupported()) for (CLDevice device : platform.listAllDevices(false)) if (device.isGLSharingSupported()) { hasSharing = true; break plat; } configFromGLCheck.setEnabled(hasSharing); if (!hasSharing) { configFromGLCheck.setText(configFromGLCheck.getText() + " (unavailable option)"); configFromGLCheck.setToolTipText("Did not find any OpenCL platform with OpenGL sharing support."); } return Arrays.asList(platforms); }
CLDevice createDevice() { return createPlatform().listAllDevices(true)[0]; }
@Parameterized.Parameters public static List<Object[]> getDeviceParameters() { List<Object[]> ret = new ArrayList<Object[]>(); for (CLPlatform platform : JavaCL.listPlatforms()) { for (CLDevice device : platform.listAllDevices(true)) { ret.add(new Object[] { device }); } } return ret; }
@Parameterized.Parameters public static List<Object[]> getDeviceParameters() { List<Object[]> ret = new ArrayList<Object[]>(); for (CLPlatform platform : JavaCL.listPlatforms()) for (CLDevice device : platform.listAllDevices(true)) ret.add(new Object[] { device }); return ret; } /*
@Test public void ensureHasDevices() { CLDevice[] devices = platform.listAllDevices(false); assertTrue("No device in platform " + platform, devices.length > 0); } @Parameters
try { for (CLPlatform platform : JavaCL.listPlatforms()) { for (CLDevice device : platform.listAllDevices(true)) { devicesCombo.addItem(device); devices.add(device);
private synchronized void initializeCLContextAndQueueOrNothing(int platformNumber, int deviceNumber) { //should check for index out of bounds later. need to figure out how I should throw the errors if(context==null || q == null) { CLDevice device = JavaCL.listPlatforms()[platformNumber].listAllDevices(false)[deviceNumber]; System.out.println("Device = " + device); context = (JavaCL.createContext(null, device)); q = (context.createDefaultQueue()); } } }
public static CLDevice[] getDevices(Target target) { CLPlatform platform = listPlatforms()[0]; switch (target) { case CPU: return platform.listCPUDevices(true); case GPU: return platform.listGPUDevices(true); case CPU_GPU: return platform.listAllDevices(true); default: throw new IllegalArgumentException("Unknown target : " + target); } } public static class ExecResult<B> {
@Test public void test() { if (!ByteOrderHack.hackEnabled) return; for (CLPlatform platform : JavaCL.listPlatforms()) { for (CLDevice device : platform.listAllDevices(true)) { assertEquals(device.getByteOrder(), ByteOrderHack.checkByteOrderNeededForBuffers(device)); } } } }