Package org.ejml.concurrency
Class EjmlConcurrency
java.lang.Object
pabeles.concurrency.ConcurrencyOps
org.ejml.concurrency.EjmlConcurrency
Central class for controlling concurrency in EJML.
-
Nested Class Summary
Nested classes/interfaces inherited from class pabeles.concurrency.ConcurrencyOps
ConcurrencyOps.NewInstance<D>, ConcurrencyOps.Reset<D>
-
Field Summary
Modifier and TypeFieldDescriptionstatic int
Minimum number of elements in a matrix before it will switch to concurrent implementationstatic boolean
Used to toggle auto matic switching to concurrent algorithms -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
static void
setMaxThreads
(int maxThreads) Sets the maximum number of threads available in the thread pool and adjusts USE_CONCURRENT.static boolean
useConcurrent
(Matrix mat) Returns true if the operation on the matrix should use the concurrent implementation.static boolean
Returns true if the operation on the matrix should use the concurrent implementation.Methods inherited from class pabeles.concurrency.ConcurrencyOps
getMaxThreads, getThreadPool, loopBlocks, loopBlocks, loopBlocks, loopBlocks, loopFor, loopFor, loopFor, max, min, sum
-
Field Details
-
USE_CONCURRENT
public static boolean USE_CONCURRENTUsed to toggle auto matic switching to concurrent algorithms -
ELEMENT_THRESHOLD
public static int ELEMENT_THRESHOLDMinimum number of elements in a matrix before it will switch to concurrent implementation
-
-
Constructor Details
-
EjmlConcurrency
public EjmlConcurrency()
-
-
Method Details
-
setMaxThreads
public static void setMaxThreads(int maxThreads) Sets the maximum number of threads available in the thread pool and adjusts USE_CONCURRENT. If the number of threads is less than 2 then USE_CONCURRENT will be set to false and the single thread version of code will be called. Otherwise USE_CONCURRENT will be true and the max threads in the pool set to the specified number.- Parameters:
maxThreads
- Maximum number of threads. &le 1 means it will not be threaded.
-
isUseConcurrent
public static boolean isUseConcurrent() -
useConcurrent
Returns true if the operation on the matrix should use the concurrent implementation. If the matrix is too small it should always use a single threaded implementation since the overhead will slow it down. -
useConcurrent
Returns true if the operation on the matrix should use the concurrent implementation. If the matrix is too small it should always use a single threaded implementation since the overhead will slow it down.
-