Skip to content

Commit

Permalink
javadoc improvements in concurrent package.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbien committed Aug 3, 2011
1 parent 9eb6589 commit 7ca1a00
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 5 deletions.
Expand Up @@ -30,7 +30,10 @@
package com.jogamp.opencl.util.concurrent;

import com.jogamp.opencl.CLCommandQueue;
import com.jogamp.opencl.CLContext;
import com.jogamp.opencl.CLDevice;
import com.jogamp.opencl.CLResource;
import com.jogamp.opencl.CLSubDevice;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand All @@ -44,7 +47,19 @@
import java.util.concurrent.TimeoutException;

/**
* Common superclass for Executor services supporting OpenCL driven tasks.
* A {@link ExecutorService} specialized for OpenCL driven tasks.
* <p>
* Implementations will usually use one dedicated thread for every {@link CLCommandQueue} in the pool.
* Every queue will usually work on a different {@link CLDevice}, which may or may not be in the same {@link CLContext}.
* </p>
* <p>
* For optimal performance it can be better to not use the CPU device the host application (and the OpenCL driver)
* is running on in the executor. Another option is to split the CPU into {@link CLSubDevice}s to control the used computing
* units of the device.
* </p>
* <p>
* A CLExecutorService must be {@link #release()}d to free up OpenCL resources if no longer needed.
* </p>
* @author Michael Bien
*/
public abstract class CLAbstractExecutorService implements CLResource {
Expand Down
2 changes: 2 additions & 0 deletions src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java
Expand Up @@ -49,9 +49,11 @@

/**
* A multithreaded, fixed size pool of OpenCL command queues.
* <p>
* CLCommandQueuePool serves as a multiplexer distributing tasks over N queues usually connected to N devices.
* The usage of this pool is similar to {@link ExecutorService} but it uses {@link CLTask}s
* instead of {@link Callable}s and provides a per-queue context for resource sharing across all tasks of one queue.
* </p>
* @author Michael Bien
*/
public class CLCommandQueuePool extends CLAbstractExecutorService {
Expand Down
11 changes: 10 additions & 1 deletion src/com/jogamp/opencl/util/concurrent/CLForkJoinPool.java
Expand Up @@ -43,7 +43,11 @@
import java.util.concurrent.Future;

/**
* JOCL implementation of the {@link ForkJoinPool}.
* A multithreaded, fixed size pool of OpenCL command queues supporting fork-join tasks.
* <p>
* The usage is similar to {@link ForkJoinPool} but uses {@link CLRecursiveTask}s.
* </p>
* @see CLRecursiveTask
* @author Michael Bien
*/
public class CLForkJoinPool extends CLAbstractExecutorService {
Expand Down Expand Up @@ -101,6 +105,7 @@ ForkJoinPool getExcecutor() {
/**
* Returns an estimate of the total number of tasks stolen from
* one thread's work queue by another.
* @see ForkJoinPool#getStealCount()
*/
public long getStealCount() {
return getExcecutor().getStealCount();
Expand All @@ -110,6 +115,7 @@ public long getStealCount() {
* Returns an estimate of the number of tasks submitted to this
* pool that have not yet begun executing. This method may take
* time proportional to the number of submissions.
* @see ForkJoinPool#getQueuedSubmissionCount()
*/
public int getQueuedSubmissionCount() {
return getExcecutor().getQueuedSubmissionCount();
Expand All @@ -122,6 +128,7 @@ public int getQueuedSubmissionCount() {
* an approximation, obtained by iterating across all threads in
* the pool. This method may be useful for tuning task
* granularities.
* @see ForkJoinPool#getQueuedTaskCount()
*/
public long getQueuedTaskCount() {
return getExcecutor().getQueuedTaskCount();
Expand All @@ -130,6 +137,7 @@ public long getQueuedTaskCount() {
/**
* Returns {@code true} if there are any tasks submitted to this
* pool that have not yet begun executing.
* @see ForkJoinPool#hasQueuedSubmissions()
*/
public boolean hasQueuedSubmissions() {
return getExcecutor().hasQueuedSubmissions();
Expand All @@ -143,6 +151,7 @@ public boolean hasQueuedSubmissions() {
* conservative; it might not return {@code true} immediately upon
* idleness of all threads, but will eventually become true if
* threads remain inactive.
* @see ForkJoinPool#isQuiescent()
*/
public boolean isQuiescent() {
return getExcecutor().isQuiescent();
Expand Down
1 change: 1 addition & 0 deletions src/com/jogamp/opencl/util/concurrent/CLRecursiveTask.java
Expand Up @@ -35,6 +35,7 @@

/**
* A recursive decomposable task executed on a {@link CLCommandQueue}.
* The two main operations are {@link #fork()} for decomposing and {@link #join()} to wait for a forked task.
* @see RecursiveTask
* @author Michael Bien
*/
Expand Down
Expand Up @@ -36,7 +36,7 @@
import java.util.concurrent.TimeUnit;

/**
* A {@link CompletionService} for {@link CLTask}s executed in a {@link CLCommandQueuePool}.
* A {@link CompletionService} for {@link CLTask}s executed in a {@link CLAbstractExecutorService}.
* It simplifies asynchronous execution of tasks with the same result type in a potentially shared pool.
* @see CompletionService
* @author Michael Bien
Expand All @@ -47,7 +47,7 @@ public class CLTaskCompletionService<R> {
private final CLAbstractExecutorService executor;

/**
* Creates an CLTaskCompletionService using the supplied pool for base
* Creates an CLTaskCompletionService using the supplied executor for base
* task execution and a LinkedBlockingQueue with the capacity of {@link Integer#MAX_VALUE}
* as a completion queue.
*/
Expand All @@ -57,7 +57,7 @@ public CLTaskCompletionService(CLAbstractExecutorService executor) {
}

/**
* Creates an CLTaskCompletionService using the supplied pool for base
* Creates an CLTaskCompletionService using the supplied executor for base
* task execution the supplied queue as its completion queue.
*/
public CLTaskCompletionService(CLAbstractExecutorService pool, BlockingQueue<Future<R>> queue) {
Expand Down

0 comments on commit 7ca1a00

Please sign in to comment.