org.encog.neural.networks.training.concurrent

## Class ConcurrentTrainingManager

- java.lang.Object
- - org.encog.neural.networks.training.concurrent.ConcurrentTrainingManager

- All Implemented Interfaces:
    Runnable

      public final class ConcurrentTrainingManager
      extends Object
      implements Runnable

  Concurrent training manager. This class allows you to queue up network training tasks to be executed either by the CPU cores or OpenCL devices. This allows the CPU/GPU to train neural networks at the same time.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addPerformer(ConcurrentTrainingPerformer performer)` Add a performer.
    `void` | `addTrainingJob(TrainingJob job)` Add a training job.
    `void` | `clearPerformers()` Clear all of the performers.
    `void` | `clearQueue()` Clear the workload.
    `void` | `detectPerformers()` Detect performers.
    `void` | `detectPerformers(boolean splitCores)` Detect performers.
    `static ConcurrentTrainingManager` | `getInstance()`
    `boolean` | `isSingleThreaded()`
    `void` | `jobDone(long time, ConcurrentTrainingPerformerCPU perf)` Wait for job to finish.
    `void` | `join()` Wait for all tasks to finish.
    `void` | `run()` Perform the training.
    `void` | `setReport(StatusReportable report)` Setup the object to report status to.
    `void` | `setSingleThreaded(boolean singleThreaded)`
    `void` | `start()` Start the manager.
    `String` | `toString()`
    `ConcurrentTrainingPerformer` | `waitForFreePerformer()` Wait for a free performer.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### getInstance

          public static ConcurrentTrainingManager getInstance()

      Returns:
        The singleton instance.

    - #### addPerformer

          public void addPerformer(ConcurrentTrainingPerformer performer)

      Add a performer.
      Parameters:
        `performer` - The performer to add.

    - #### addTrainingJob

          public void addTrainingJob(TrainingJob job)

      Add a training job.
      Parameters:
        `job` - The training job to add.

    - #### clearPerformers

          public void clearPerformers()

      Clear all of the performers.

    - #### clearQueue

          public void clearQueue()

      Clear the workload.

    - #### detectPerformers

          public void detectPerformers()

      Detect performers. Create one performer for each OpenCL device, and another for the CPU's. If there is an OpenCL device already for the CPU, do not create another CPU performer.

    - #### detectPerformers

          public void detectPerformers(boolean splitCores)

      Detect performers. Create one performer for each OpenCL device, and another for the CPU's. If there is an OpenCL device already for the CPU, do not create another CPU performer.
      Parameters:
        `splitCores` - True, if a CPU performer should be created for each core.

    - #### isSingleThreaded

          public boolean isSingleThreaded()

      Returns:
        True, if single threaded.

    - #### jobDone

          public void jobDone(long time,
                     ConcurrentTrainingPerformerCPU perf)

      Wait for job to finish.
      Parameters:
        `time` - The time to wait.
        `perf` - The performer.

    - #### join

          public void join()

      Wait for all tasks to finish.

    - #### run

          public void run()

      Perform the training.
      Specified by:
        `run` in interface `Runnable`

    - #### setReport

          public void setReport(StatusReportable report)

      Setup the object to report status to.
      Parameters:
        `report` - The object to report status to.

    - #### setSingleThreaded

          public void setSingleThreaded(boolean singleThreaded)

    - #### start

          public void start()

      Start the manager.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### waitForFreePerformer

          public ConcurrentTrainingPerformer waitForFreePerformer()

      Wait for a free performer.
      Returns:
        The free performer.

Copyright © 2014. All Rights Reserved.