Package elki.parallel
Class ParallelCore
- java.lang.Object
-
- elki.parallel.ParallelCore
-
public class ParallelCore extends java.lang.Object
Core for parallel processing in ELKI, based onThreadPoolExecutor
.TODO: make configurable how many threads are used.
- Since:
- 0.7.0
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description static int
ALL_PROCESSORS
The number of CPUs to use.private int
connected
Number of connected submitters.private java.util.concurrent.ThreadPoolExecutor
executor
Executor service.private int
processors
Maximum number of processors to use.private static ParallelCore
STATIC
Static core
-
Constructor Summary
Constructors Modifier Constructor Description protected
ParallelCore(int processors)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connect()
Connect to the executor.void
disconnect()
Disconnect to the executor.static ParallelCore
getCore()
Get the static core object.int
getParallelism()
Get desired level of parallelism<T> java.util.concurrent.Future<T>
submit(java.util.concurrent.Callable<T> task)
Submit a task to the executor core.
-
-
-
Field Detail
-
ALL_PROCESSORS
public static final int ALL_PROCESSORS
The number of CPUs to use.
-
STATIC
private static final ParallelCore STATIC
Static core
-
executor
private volatile java.util.concurrent.ThreadPoolExecutor executor
Executor service.
-
connected
private volatile int connected
Number of connected submitters.
-
processors
private int processors
Maximum number of processors to use.
-
-
Method Detail
-
getCore
public static ParallelCore getCore()
Get the static core object.- Returns:
- Core
-
getParallelism
public int getParallelism()
Get desired level of parallelism- Returns:
- Number of threads to run in parallel
-
submit
public <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> task)
Submit a task to the executor core.- Parameters:
task
- Submitted task- Returns:
- Future to observe completion
-
connect
public void connect()
Connect to the executor.
-
disconnect
public void disconnect()
Disconnect to the executor.
-
-