@Override public String toString() { return "Context (" + getDevices() + ')'; }
/** * Creates a new program cache using the first device from the specified * context. * @param context the context * @see #ProgramCache(com.jme3.opencl.Context, com.jme3.opencl.Device) */ public ProgramCache(Context context) { this(context, context.getDevices().get(0)); }
/** * Creates a command queue sending commands to the specified device. * The device must be an entry of {@link #getDevices() }. * @param device the target device * @return the command queue */ public abstract CommandQueue createQueue(Device device);
private void updateInfos() { if (testBuffer == null && clContext != null && !bufferCreated) { try { testBuffer = clContext.createBuffer(1024).register(); LOG.info("Test buffer created"); } catch (OpenCLException ex) { LOG.log(Level.SEVERE, "Unable to create buffer", ex); } bufferCreated = true; } Context c = context.getOpenCLContext(); if (c == clContext) { return; } clContext = c; LOG.info("context changed"); testBuffer = null; bufferCreated = false; StringBuilder text = new StringBuilder(); text.append("Current context:\n"); text.append(" Platform: ").append(clContext.getDevices().get(0).getPlatform().getName()).append("\n"); text.append(" Device: ").append(clContext.getDevices().get(0).getName()).append("\n"); text.append(" Profile: ").append(clContext.getDevices().get(0).getProfile()).append("\n"); text.append(" Memory: ").append(clContext.getDevices().get(0).getGlobalMemorySize()).append(" B\n"); text.append(" Compute Units: ").append(clContext.getDevices().get(0).getComputeUnits()).append("\n"); infoLabel.setText(text.toString()); }
return; CommandQueue clQueue = clContext.createQueue(clContext.getDevices().get(0)); .append(clContext.getDevices().get(0).getPlatform().getName()) .append("\n Devices: ").append(clContext.getDevices()); str.append("\nTests:"); str.append("\n Random numbers: ").append(testRandom(clContext, clQueue));
private void initOpenCL1() { clContext = context.getOpenCLContext(); Device device = clContext.getDevices().get(0); clQueue = clContext.createQueue(device).register();
.append(clContext.getDevices().get(0).getPlatform().getName()) .append("\n Devices: ").append(clContext.getDevices()); str.append("\nTests:"); str.append("\n Buffers: ").append(testBuffer(clContext, clQueue));
private boolean testRandom(Context clContext, CommandQueue clQueue) { try { boolean supportsDoubles = clContext.getDevices().get(0).hasDouble();
return; Device device = clContext.getDevices().get(0); clQueue = clContext.createQueue(device); clQueue.register(); infoText = new BitmapText(fnt, false); infoText.setText("Device: "+clContext.getDevices()); infoText.setLocalTranslation(0, settings.getHeight(), 0); guiNode.attachChild(infoText);
@Override public String toString() { return "Context (" + getDevices() + ')'; }
/** * Creates a new program cache using the first device from the specified * context. * @param context the context * @see #ProgramCache(com.jme3.opencl.Context, com.jme3.opencl.Device) */ public ProgramCache(Context context) { this(context, context.getDevices().get(0)); }
/** * Creates a command queue sending commands to the specified device. * The device must be an entry of {@link #getDevices() }. * @param device the target device * @return the command queue */ public abstract CommandQueue createQueue(Device device);