org.encog.neural.networks.training.concurrent
Class ConcurrentTrainingManager
- java.lang.Object
-
- org.encog.neural.networks.training.concurrent.ConcurrentTrainingManager
-
- All Implemented Interfaces:
- java.lang.Runnable
public final class ConcurrentTrainingManager extends java.lang.Object implements java.lang.RunnableConcurrent 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddPerformer(ConcurrentTrainingPerformer performer)Add a performer.voidaddTrainingJob(TrainingJob job)Add a training job.voidclearPerformers()Clear all of the performers.voidclearQueue()Clear the workload.voiddetectPerformers()Detect performers.voiddetectPerformers(boolean splitCores)Detect performers.static ConcurrentTrainingManagergetInstance()booleanisSingleThreaded()voidjobDone(long time, ConcurrentTrainingPerformerCPU perf)Wait for job to finish.voidjoin()Wait for all tasks to finish.voidrun()Perform the training.voidsetReport(StatusReportable report)Setup the object to report status to.voidsetSingleThreaded(boolean singleThreaded)voidstart()Start the manager.java.lang.StringtoString()ConcurrentTrainingPerformerwaitForFreePerformer()Wait for a free performer.
-
-
-
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:
runin interfacejava.lang.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 java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
waitForFreePerformer
public ConcurrentTrainingPerformer waitForFreePerformer()
Wait for a free performer.- Returns:
- The free performer.
-
-
DMelt 3.0 © DataMelt by jWork.ORG