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
IManualMultiThreadingConfig
that 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
IManualMultiThreadingConfig
that allows further configuration of the multi-threading behavior
-
virtual uint32 getNumThreads(const IFeatureMatrix &featureMatrix, uint32 numLabels) const override¶
Determines and returns the number of threads that can actually be used by a parallelizable algorithm, depending on the number of available CPU cores and whether multi-threading support was enabled at compile-time.
- Parameters:
featureMatrix – A reference to an object of type
IFeatureMatrix
that provides access to the feature values of the training examplesnumLabels – The total number of available labels
- Returns:
The number of threads that can actually be used
-
ManualMultiThreadingConfig()¶