Parallel Colt 0.5

edu.emory.mathcs.utils
Class ConcurrencyUtils

java.lang.Object
  extended by edu.emory.mathcs.utils.ConcurrencyUtils

public class ConcurrencyUtils
extends Object

Utility methods.

Author:
Piotr Wendykier (piotr.wendykier@gmail.com)

Field Summary
static ExecutorService threadPool
           
 
Constructor Summary
ConcurrencyUtils()
           
 
Method Summary
static int concurrency()
          Returns the number of available processors
static int extendDimension(int x)
           
static int getNumberOfProcessors()
          Returns the number of available processors ( = number of threads used in calculations).
static int getThreadsBeginN_1D_FFT_2Threads()
          Returns the minimal size of 1D data for which two threads are used.
static int getThreadsBeginN_1D_FFT_4Threads()
          Returns the minimal size of 1D data for which four threads are used.
static int getThreadsBeginN_1D()
          Returns the minimal size of 1D data for which threads are used.
static int getThreadsBeginN_2D()
          Returns the minimal size of 2D data for which threads are used.
static int getThreadsBeginN_3D()
          Returns the minimal size of 3D data for which threads are used.
static boolean isPowerOf2(int n)
          Checks if n is a power-of-two number
static int nextExp2(int n)
           
static int nextPow2(int x)
          Returns the closest power of two greater than or equal to x.
static int prevPow2(int x)
          Returns the closest power of two less than or equal to x
static void resetThreadsBeginN_FFT()
          Resets the minimal size of 1D data for which two and four threads are used.
static void resetThreadsBeginN()
          Resets the minimal size of 1D, 2D and 3D data for which threads are used.
static int setNumberOfProcessors(int n)
          Sets the number of available processors ( = number of threads used in calculations).
static void setThreadsBeginN_1D_FFT_2Threads(int n)
          Sets the minimal size of 1D data for which two threads are used.
static void setThreadsBeginN_1D_FFT_4Threads(int n)
          Sets the minimal size of 1D data for which four threads are used.
static void setThreadsBeginN_1D(int n)
          Sets the minimal size of 1D data for which threads are used.
static void setThreadsBeginN_2D(int n)
          Sets the minimal size of 2D data for which threads are used.
static void setThreadsBeginN_3D(int n)
          Sets the minimal size of 3D data for which threads are used.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

threadPool

public static ExecutorService threadPool
Constructor Detail

ConcurrencyUtils

public ConcurrencyUtils()
Method Detail

concurrency

public static int concurrency()
Returns the number of available processors

Returns:
number of available processors

getNumberOfProcessors

public static int getNumberOfProcessors()
Returns the number of available processors ( = number of threads used in calculations).

Returns:
the number of available processors

getThreadsBeginN_1D

public static int getThreadsBeginN_1D()
Returns the minimal size of 1D data for which threads are used.

Returns:
the minimal size of 1D data for which threads are used

getThreadsBeginN_1D_FFT_2Threads

public static int getThreadsBeginN_1D_FFT_2Threads()
Returns the minimal size of 1D data for which two threads are used.

Returns:
the minimal size of 1D data for which two threads are used

getThreadsBeginN_1D_FFT_4Threads

public static int getThreadsBeginN_1D_FFT_4Threads()
Returns the minimal size of 1D data for which four threads are used.

Returns:
the minimal size of 1D data for which four threads are used

getThreadsBeginN_2D

public static int getThreadsBeginN_2D()
Returns the minimal size of 2D data for which threads are used.

Returns:
the minimal size of 2D data for which threads are used

getThreadsBeginN_3D

public static int getThreadsBeginN_3D()
Returns the minimal size of 3D data for which threads are used.

Returns:
the minimal size of 3D data for which threads are used

setThreadsBeginN_1D_FFT_2Threads

public static void setThreadsBeginN_1D_FFT_2Threads(int n)
Sets the minimal size of 1D data for which two threads are used.

Parameters:
n - the minimal size of 1D data for which two threads are used

setThreadsBeginN_1D_FFT_4Threads

public static void setThreadsBeginN_1D_FFT_4Threads(int n)
Sets the minimal size of 1D data for which four threads are used.

Parameters:
n - the minimal size of 1D data for which four threads are used

setThreadsBeginN_1D

public static void setThreadsBeginN_1D(int n)
Sets the minimal size of 1D data for which threads are used.

Parameters:
n - the minimal size of 1D data for which threads are used

setThreadsBeginN_2D

public static void setThreadsBeginN_2D(int n)
Sets the minimal size of 2D data for which threads are used.

Parameters:
n - the minimal size of 2D data for which threads are used

setThreadsBeginN_3D

public static void setThreadsBeginN_3D(int n)
Sets the minimal size of 3D data for which threads are used.

Parameters:
n - the minimal size of 3D data for which threads are used

resetThreadsBeginN_FFT

public static void resetThreadsBeginN_FFT()
Resets the minimal size of 1D data for which two and four threads are used.


resetThreadsBeginN

public static void resetThreadsBeginN()
Resets the minimal size of 1D, 2D and 3D data for which threads are used.


setNumberOfProcessors

public static int setNumberOfProcessors(int n)
Sets the number of available processors ( = number of threads used in calculations). If n is not a power of 2, then the number of available processors is set to the closest power of two less than n.

Parameters:
n -
Returns:
the number of available processors

nextPow2

public static int nextPow2(int x)
Returns the closest power of two greater than or equal to x.

Parameters:
x -
Returns:
the closest power of two greater than or equal to x

extendDimension

public static int extendDimension(int x)

nextExp2

public static int nextExp2(int n)

prevPow2

public static int prevPow2(int x)
Returns the closest power of two less than or equal to x

Parameters:
x -
Returns:
the closest power of two less then or equal to x

isPowerOf2

public static boolean isPowerOf2(int n)
Checks if n is a power-of-two number

Parameters:
n -
Returns:
true if n is power of 2

Parallel Colt 0.5

Jump to the Parallel Colt Homepage