File multi_threading_manual.hpp¶
-
class IManualMultiThreadingConfig¶
- #include <multi_threading_manual.hpp>
Defines an interface for all classes that allow to configure the multi-threading behavior of a parallelizable algorithm by manually specifying the number of threads to be used.
Subclassed by ManualMultiThreadingConfig
Public Functions
-
inline virtual ~IManualMultiThreadingConfig()¶
-
virtual uint32 getNumPreferredThreads() const = 0¶
Returns the number of preferred threads.
- Returns:
The number of preferred threads or 0, if all available CPU cores are utilized
-
virtual IManualMultiThreadingConfig &setNumPreferredThreads(uint32 numPreferredThreads) = 0¶
Sets the number of preferred threads. If not enough CPU cores are available or if multi-threading support was disabled at compile-time, as many threads as possible will be used.
- Parameters:
numPreferredThreads – The preferred number of threads. Must be at least 1 or 0, if all available CPU cores should be utilized
- Returns:
A reference to an object of type
IManualMultiThreadingConfigthat allows further configuration of the multi-threading behavior
-
inline virtual ~IManualMultiThreadingConfig()¶
-
class ManualMultiThreadingConfig : public IMultiThreadingConfig, public IManualMultiThreadingConfig¶
- #include <multi_threading_manual.hpp>
Allows to configure the multi-threading behavior of a parallelizable algorithm by manually specifying the number of threads to be used.
Public Functions
-
ManualMultiThreadingConfig()¶
-
virtual uint32 getNumPreferredThreads() const override¶
Returns the number of preferred threads.
- Returns:
The number of preferred threads or 0, if all available CPU cores are utilized
-
virtual IManualMultiThreadingConfig &setNumPreferredThreads(uint32 numPreferredThreads) override¶
Sets the number of preferred threads. If not enough CPU cores are available or if multi-threading support was disabled at compile-time, as many threads as possible will be used.
- Parameters:
numPreferredThreads – The preferred number of threads. Must be at least 1 or 0, if all available CPU cores should be utilized
- Returns:
A reference to an object of type
IManualMultiThreadingConfigthat allows further configuration of the multi-threading behavior
-
virtual MultiThreadingSettings getSettings(const IFeatureMatrix &featureMatrix, uint32 numOutputs) const override¶
Determines and returns the settings to be used by parallelizable algorithms, depending on the available hardware and whether multi-threading support was enabled at compile-time.
- Parameters:
featureMatrix – A reference to an object of type
IFeatureMatrixthat provides access to the feature values of the training examplesnumOutputs – The total number of available outputs
- Returns:
The
MultiThreadingSettingsto be used
-
ManualMultiThreadingConfig()¶