Added default multi threaded configuration (#1310)
* Added default multythreaded configuration * Fixed typo
This commit is contained in:
parent
804a579be9
commit
b5e092c00b
@ -126,4 +126,17 @@ Parameter IStreamsExecutor::Config::GetConfig(const std::string& key) {
|
||||
return {};
|
||||
}
|
||||
|
||||
IStreamsExecutor::Config IStreamsExecutor::Config::MakeDefaultMultiThreaded(const IStreamsExecutor::Config& initial) {
|
||||
const auto envThreads = parallel_get_env_threads();
|
||||
const auto& numaNodes = getAvailableNUMANodes();
|
||||
const auto numaNodesNum = numaNodes.size();
|
||||
auto streamExecutorConfig = initial;
|
||||
const auto hwCores = streamExecutorConfig._streams > 1 && numaNodesNum == 1 ? parallel_get_max_threads() : getNumberOfCPUCores();
|
||||
const auto threads = streamExecutorConfig._threads ? streamExecutorConfig._threads : (envThreads ? envThreads : hwCores);
|
||||
streamExecutorConfig._threadsPerStream = streamExecutorConfig._streams
|
||||
? std::max(1, threads/streamExecutorConfig._streams)
|
||||
: threads;
|
||||
return streamExecutorConfig;
|
||||
}
|
||||
|
||||
} // namespace InferenceEngine
|
@ -68,6 +68,14 @@ public:
|
||||
*/
|
||||
Parameter GetConfig(const std::string& key);
|
||||
|
||||
/**
|
||||
* @brief Create appropriate multithreaded configuration
|
||||
* filing unconfigured values from initial configuration using hardware properties
|
||||
* @param initial Inital configuration
|
||||
* @return configured values
|
||||
*/
|
||||
static Config MakeDefaultMultiThreaded(const Config& initial);
|
||||
|
||||
std::string _name; //!< Used by `ITT` to name executor threads
|
||||
int _streams = 1; //!< Number of streams.
|
||||
int _threadsPerStream = 0; //!< Number of threads per stream that executes `ie_parallel` calls
|
||||
|
Loading…
Reference in New Issue
Block a user