public boolean isEmpty() { return getFirst() == null && getSecond() == null; } }
public boolean isFull() { return getFirst() != null && getSecond() != null; }
@SuppressWarnings("unchecked") public int compareTo(Pair<U, V> o) { Comparable<U> cu = (Comparable<U>)getFirst(); if (cu == null) { if (first != null) return 1; } else { int d = cu.compareTo(o.getFirst()); if (d != 0) return d; } Comparable<V> cv = (Comparable<V>)getSecond(); if (cv == null) return second != null ? 1 : -1; return cv.compareTo(o.getSecond()); }
new JScrollPane(new JLabel(new ImageIcon(imgs.getSecond())))
new JScrollPane(new JLabel(new ImageIcon(imgs.getSecond())))
/** * Restore a program previously saved with {@link CLProgram#store(java.io.OutputStream) } * @param in will be closed * @return a CLProgram object representing the previously saved program * @throws IOException */ public CLProgram loadProgram(InputStream in) throws IOException { Pair<Map<CLDevice, byte[]>, String> binaries = CLProgram.readBinaries(Arrays.asList(getDevices()), null, in); return createProgram(binaries.getFirst(), binaries.getSecond()); }
@SuppressWarnings("unchecked") public CLEvent reduce(CLQueue queue, CLBuffer<B> input, long inputLength, Pointer<B> output, int maxReductionSize, CLEvent... eventsToWaitFor) { Pair<CLBuffer<B>, CLEvent[]> outAndEvts = reduceHelper(queue, input, (int)inputLength, maxReductionSize, eventsToWaitFor); return outAndEvts.getFirst().read(queue, 0, valueChannels, output, false, outAndEvts.getSecond()); } @Override
@Override public CLEvent reduce(CLQueue queue, CLBuffer<B> input, long inputLength, CLBuffer<B> output, int maxReductionSize, CLEvent... eventsToWaitFor) { Pair<CLBuffer<B>, CLEvent[]> outAndEvts = reduceHelper(queue, input, (int)inputLength, maxReductionSize, eventsToWaitFor); return outAndEvts.getFirst().copyTo(queue, 0, valueChannels, output, 0, outAndEvts.getSecond()); } @SuppressWarnings("unchecked")
/** * Restore a program previously saved with {@link CLProgram#store(java.io.OutputStream) } * @param in will be closed * @return a CLProgram object representing the previously saved program * @throws IOException */ public CLProgram loadProgram(InputStream in) throws IOException { Pair<Map<CLDevice, byte[]>, String> binaries = CLProgram.readBinaries(Arrays.asList(getDevices()), null, in); return createProgram(binaries.getFirst(), binaries.getSecond()); }
@SuppressWarnings("unchecked") public CLEvent reduce(CLQueue queue, CLBuffer<B> input, long inputLength, Pointer<B> output, int maxReductionSize, CLEvent... eventsToWaitFor) { Pair<CLBuffer<B>, CLEvent[]> outAndEvts = reduceHelper(queue, input, (int)inputLength, maxReductionSize, eventsToWaitFor); return outAndEvts.getFirst().read(queue, 0, valueChannels, output, false, outAndEvts.getSecond()); } @Override
@Override public CLEvent reduce(CLQueue queue, CLBuffer<B> input, long inputLength, CLBuffer<B> output, int maxReductionSize, CLEvent... eventsToWaitFor) { Pair<CLBuffer<B>, CLEvent[]> outAndEvts = reduceHelper(queue, input, (int)inputLength, maxReductionSize, eventsToWaitFor); return outAndEvts.getFirst().copyTo(queue, 0, valueChannels, output, 0, outAndEvts.getSecond()); } @SuppressWarnings("unchecked")
Pair<Map<CLDevice, byte[]>, String> bins = readBinaries(Arrays.asList(getDevices()), contentSignature, new FileInputStream(cacheFile)); setBinaries(bins.getFirst()); this.source = bins.getSecond(); assert log(Level.INFO, "Read binaries cache from '" + cacheFile + "'"); readBinaries = true;
Pair<Map<CLDevice, byte[]>, String> bins = readBinaries(Arrays.asList(getDevices()), contentSignature, new FileInputStream(cacheFile)); setBinaries(bins.getFirst()); this.source = bins.getSecond(); assert log(Level.INFO, "Read binaries cache from '" + cacheFile + "'"); readBinaries = true;
CLEvent createEvent() { CLContext c = createContext(); return c.createBuffer(CLMem.Usage.Input, Integer.class, 10).mapLater(c.createDefaultQueue(), CLMem.MapFlags.Read).getSecond(); }