Documentation of 'edu.emory.utils.ConcurrencyUtils' Java class
ConcurrencyUtils
edu.emory.utils

Class ConcurrencyUtils



  • public class ConcurrencyUtils
    extends java.lang.Object
    Concurrency utilities.
    • Constructor Summary

      Constructors 
      Constructor and Description
      ConcurrencyUtils() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static int extendDimension(int x) 
      static int getNumberOfProcessors()
      Returns the number of available processors
      static int getNumberOfThreads()
      Returns the current number of threads.
      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 void setNumberOfThreads(int n)
      Sets the number of threads
      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.
      static void shutdown()
      Shutdowns the thread pool.
      static void sleep(long millis)
      Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds.
      static <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> task)
      Submits a value-returning task for execution and returns a Future representing the pending results of the task.
      static java.util.concurrent.Future<?> submit(java.lang.Runnable task)
      Submits a Runnable task for execution and returns a Future representing that task.
      static void waitForCompletion(java.util.concurrent.Future<?>[] futures)
      Waits for all threads to complete computation.
      static double[] waitForCompletion(java.util.concurrent.Future<?>[] futures, DComplexDComplexDComplexFunction aggr)
      Waits for all threads to complete computation and aggregates the result.
      static double waitForCompletion(java.util.concurrent.Future<?>[] futures, DoubleDoubleFunction aggr)
      Waits for all threads to complete computation and aggregates the result.
      static float[] waitForCompletion(java.util.concurrent.Future<?>[] futures, FComplexFComplexFComplexFunction aggr)
      Waits for all threads to complete computation and aggregates the result.
      static float waitForCompletion(java.util.concurrent.Future<?>[] futures, FloatFloatFunction aggr)
      Waits for all threads to complete computation and aggregates the result.
      static int waitForCompletion(java.util.concurrent.Future<?>[] futures, IntIntFunction aggr)
      Waits for all threads to complete computation and aggregates the result.
      static long waitForCompletion(java.util.concurrent.Future<?>[] futures, LongLongFunction aggr)
      Waits for all threads to complete computation and aggregates the result.
      static java.lang.Object waitForCompletion(java.util.concurrent.Future<?>[] futures, ObjectObjectFunction aggr)
      Waits for all threads to complete computation and aggregates the result.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConcurrencyUtils

        public ConcurrencyUtils()
    • Method Detail

      • sleep

        public static void sleep(long millis)
        Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds.
        Parameters:
        millis -
      • shutdown

        public static void shutdown()
        Shutdowns the thread pool.
      • submit

        public static <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> task)
        Submits a value-returning task for execution and returns a Future representing the pending results of the task.
        Type Parameters:
        T -
        Parameters:
        task - task for execution
        Returns:
        a handle to the task submitted for execution
      • submit

        public static java.util.concurrent.Future<?> submit(java.lang.Runnable task)
        Submits a Runnable task for execution and returns a Future representing that task.
        Parameters:
        task - task for execution
        Returns:
        a handle to the task submitted for execution
      • getNumberOfProcessors

        public static int getNumberOfProcessors()
        Returns the number of available processors
        Returns:
        number of available processors
      • getNumberOfThreads

        public static int getNumberOfThreads()
        Returns the current number of threads.
        Returns:
        the current number of threads.
      • waitForCompletion

        public static void waitForCompletion(java.util.concurrent.Future<?>[] futures)
        Waits for all threads to complete computation.
        Parameters:
        futures - handles to running threads
      • waitForCompletion

        public static double waitForCompletion(java.util.concurrent.Future<?>[] futures,
                                               DoubleDoubleFunction aggr)
        Waits for all threads to complete computation and aggregates the result.
        Parameters:
        futures - handles to running threads
        aggr - an aggregation function
        Returns:
        the result of aggregation
      • waitForCompletion

        public static int waitForCompletion(java.util.concurrent.Future<?>[] futures,
                                            IntIntFunction aggr)
        Waits for all threads to complete computation and aggregates the result.
        Parameters:
        futures - handles to running threads
        aggr - an aggregation function
        Returns:
        the result of aggregation
      • waitForCompletion

        public static long waitForCompletion(java.util.concurrent.Future<?>[] futures,
                                             LongLongFunction aggr)
        Waits for all threads to complete computation and aggregates the result.
        Parameters:
        futures - handles to running threads
        aggr - an aggregation function
        Returns:
        the result of aggregation
      • waitForCompletion

        public static java.lang.Object waitForCompletion(java.util.concurrent.Future<?>[] futures,
                                                         ObjectObjectFunction aggr)
        Waits for all threads to complete computation and aggregates the result.
        Parameters:
        futures - handles to running threads
        aggr - an aggregation function
        Returns:
        the result of aggregation
      • waitForCompletion

        public static double[] waitForCompletion(java.util.concurrent.Future<?>[] futures,
                                                 DComplexDComplexDComplexFunction aggr)
        Waits for all threads to complete computation and aggregates the result.
        Parameters:
        futures - handles to running threads
        aggr - an aggregation function
        Returns:
        the result of aggregation
      • waitForCompletion

        public static float[] waitForCompletion(java.util.concurrent.Future<?>[] futures,
                                                FComplexFComplexFComplexFunction aggr)
        Waits for all threads to complete computation and aggregates the result.
        Parameters:
        futures - handles to running threads
        aggr - an aggregation function
        Returns:
        the result of aggregation
      • waitForCompletion

        public static float waitForCompletion(java.util.concurrent.Future<?>[] futures,
                                              FloatFloatFunction aggr)
        Waits for all threads to complete computation and aggregates the result.
        Parameters:
        futures - handles to running threads
        aggr - an aggregation function
        Returns:
        the result of aggregation
      • 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.
      • setNumberOfThreads

        public static void setNumberOfThreads(int n)
        Sets the number of threads
        Parameters:
        n -
      • 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

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.