Class ParallelProcessor<T extends InputFromManager,S>
- Type Parameters:
T
- input-object typeS
- shared-state type
- All Implemented Interfaces:
ReplaceTask<T,
S>
Each input is processed in a separate thread on an available core.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkMisconfigured
(BeanInstanceMap defaultInstances) Checks that a bean's properties conform to expectations.protected TaskStatistics
execute
(Outputter rootOutputter, List<T> inputs, ParametersExperiment parametersExperiment) Executes the parallel processing of jobs.int
How many processors to avoid using for the tasks.int
Theoretical maximum number of (CPU) processors to use in parallel.int
How many GPU processors to use when this is possible as a substitute for a CPU processorint
When the number of ongoing jobs is less than this threshold, they are shown in event logs. 0 disables.void
setKeepProcessorsFree
(int keepProcessorsFree) How many processors to avoid using for the tasks.void
setMaxNumberProcessors
(int maxNumberProcessors) Theoretical maximum number of (CPU) processors to use in parallel.void
setNumberGPUProcessors
(int numberGPUProcessors) How many GPU processors to use when this is possible as a substitute for a CPU processorvoid
setShowOngoingJobsLessThan
(int showOngoingJobsLessThan) When the number of ongoing jobs is less than this threshold, they are shown in event logs. 0 disables.Methods inherited from class org.anchoranalysis.experiment.bean.processor.JobProcessor
executeLogStatistics, getTask, hasVeryQuickPerInputExecution, isInputCompatibleWith, isSuppressExceptions, replaceTask, setSuppressExceptions, setTask
Methods inherited from class org.anchoranalysis.bean.AnchorBean
describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
ParallelProcessor
public ParallelProcessor()
-
-
Method Details
-
checkMisconfigured
Description copied from class:AnchorBean
Checks that a bean's properties conform to expectations.- Overrides:
checkMisconfigured
in classAnchorBean<JobProcessor<T extends InputFromManager,
S>> - Parameters:
defaultInstances
- all available default instances if theDefaultInstance
annotation is used- Throws:
BeanMisconfiguredException
- if the bean has not been configured properly as XML
-
execute
protected TaskStatistics execute(Outputter rootOutputter, List<T> inputs, ParametersExperiment parametersExperiment) throws ExperimentExecutionException Executes the parallel processing of jobs.- Specified by:
execute
in classJobProcessor<T extends InputFromManager,
S> - Parameters:
rootOutputter
- the root outputter for the experimentinputs
- the list of inputs to processparametersExperiment
- the experiment parameters- Returns:
- the statistics of the executed tasks
- Throws:
ExperimentExecutionException
- if an error occurs during execution
-
getMaxNumberProcessors
public int getMaxNumberProcessors()Theoretical maximum number of (CPU) processors to use in parallel.In practice, the effective maximum is
min(maxNumberProcessors,numberAvailableProcessors)
, usually lower. -
setMaxNumberProcessors
public void setMaxNumberProcessors(int maxNumberProcessors) Theoretical maximum number of (CPU) processors to use in parallel.In practice, the effective maximum is
min(maxNumberProcessors,numberAvailableProcessors)
, usually lower. -
getShowOngoingJobsLessThan
public int getShowOngoingJobsLessThan()When the number of ongoing jobs is less than this threshold, they are shown in event logs. 0 disables. -
setShowOngoingJobsLessThan
public void setShowOngoingJobsLessThan(int showOngoingJobsLessThan) When the number of ongoing jobs is less than this threshold, they are shown in event logs. 0 disables. -
getKeepProcessorsFree
public int getKeepProcessorsFree()How many processors to avoid using for the tasks.When using the maximum available number of processors, a certain amount are deliberately not used, to save them for other tasks on the operating system. This is particularly valuable on a desktop PC where other tasks (e.g web browsing) may be ongoing during processing.
-
setKeepProcessorsFree
public void setKeepProcessorsFree(int keepProcessorsFree) How many processors to avoid using for the tasks.When using the maximum available number of processors, a certain amount are deliberately not used, to save them for other tasks on the operating system. This is particularly valuable on a desktop PC where other tasks (e.g web browsing) may be ongoing during processing.
-
getNumberGPUProcessors
public int getNumberGPUProcessors()How many GPU processors to use when this is possible as a substitute for a CPU processor -
setNumberGPUProcessors
public void setNumberGPUProcessors(int numberGPUProcessors) How many GPU processors to use when this is possible as a substitute for a CPU processor
-