|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jogamp.opencl.util.concurrent.CLCommandQueuePool<C>
public class CLCommandQueuePool<C extends CLQueueContext>
A multithreaded, fixed size pool of OpenCL command queues.
It serves as a multiplexer distributing tasks over N queues usually run on N devices.
The usage of this pool is similar to ExecutorService but it uses CLTasks
instead of Callables and provides a per-queue context for resource sharing across all tasks of one queue.
| Nested Class Summary | |
|---|---|
static class |
CLCommandQueuePool.FinishAction
The action executed after a task completes. |
| Method Summary | ||
|---|---|---|
static
|
create(CLQueueContextFactory<C> factory,
CLMultiContext mc,
CLCommandQueue.Mode... modes)
|
|
static
|
create(CLQueueContextFactory<C> factory,
Collection<CLCommandQueue> queues)
|
|
static
|
create(CLQueueContextFactory<C> factory,
Collection<CLDevice> devices,
CLCommandQueue.Mode... modes)
|
|
void |
finishQueues()
Calls CLCommandQueue.finish() on all queues. |
|
void |
flushQueues()
Calls CLCommandQueue.flush() on all queues. |
|
CLCommandQueuePool.FinishAction |
getFinishAction()
|
|
List<CLCommandQueue> |
getQueues()
Returns the command queues used in this pool. |
|
int |
getSize()
Returns the size of this pool (number of command queues). |
|
|
invokeAll(Collection<? extends CLTask<? super C,R>> tasks)
Submits all tasks to the pool for immediate execution (blocking) and returns their Future holding the result. |
|
|
invokeAll(Collection<? extends CLTask<? super C,R>> tasks,
long timeout,
TimeUnit unit)
Submits all tasks to the pool for immediate execution (blocking) and returns their Future holding the result. |
|
boolean |
isReleased()
Returns true if CLResource.release() has been called. |
|
void |
release()
Releases all queues. |
|
void |
setFinishAction(CLCommandQueuePool.FinishAction action)
Sets the action which is run after every completed task. |
|
|
submit(CLTask<? super C,R> task)
Submits this task to the pool for execution returning its Future. |
|
|
submitAll(Collection<? extends CLTask<? super C,R>> tasks)
Submits all tasks to the pool for execution and returns their Future. |
|
|
switchContext(CLQueueContextFactory<C> factory)
Switches the context of all queues - this operation can be expensive. |
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static <C extends CLQueueContext> CLCommandQueuePool<C> create(CLQueueContextFactory<C> factory,
CLMultiContext mc,
CLCommandQueue.Mode... modes)
public static <C extends CLQueueContext> CLCommandQueuePool<C> create(CLQueueContextFactory<C> factory,
Collection<CLDevice> devices,
CLCommandQueue.Mode... modes)
public static <C extends CLQueueContext> CLCommandQueuePool create(CLQueueContextFactory<C> factory,
Collection<CLCommandQueue> queues)
public <R> Future<R> submit(CLTask<? super C,R> task)
Future.
ExecutorService.submit(java.util.concurrent.Callable)public <R> List<Future<R>> submitAll(Collection<? extends CLTask<? super C,R>> tasks)
Future.
Calls submit(com.jogamp.opencl.util.concurrent.CLTask) for every task.
public <R> List<Future<R>> invokeAll(Collection<? extends CLTask<? super C,R>> tasks)
throws InterruptedException
Future holding the result.
InterruptedExceptionExecutorService.invokeAll(java.util.Collection)
public <R> List<Future<R>> invokeAll(Collection<? extends CLTask<? super C,R>> tasks,
long timeout,
TimeUnit unit)
throws InterruptedException
Future holding the result.
InterruptedExceptionExecutorService.invokeAll(java.util.Collection, long, java.util.concurrent.TimeUnit)public <C extends CLQueueContext> CLCommandQueuePool switchContext(CLQueueContextFactory<C> factory)
public void flushQueues()
CLCommandQueue.flush() on all queues.
public void finishQueues()
CLCommandQueue.finish() on all queues.
public void release()
release in interface CLResourcepublic List<CLCommandQueue> getQueues()
public int getSize()
public CLCommandQueuePool.FinishAction getFinishAction()
public boolean isReleased()
CLResourceCLResource.release() has been called.
isReleased in interface CLResourcepublic void setFinishAction(CLCommandQueuePool.FinishAction action)
CLCommandQueuePool.FinishAction.DO_NOTHING.
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||