#if ((IE_THREAD == IE_THREAD_TBB) || (IE_THREAD == IE_THREAD_TBB_AUTO))
std::vector<int> getAvailableNUMANodes() {
+#if TBB_INTERFACE_VERSION >= 11100
return tbb::info::numa_nodes();
+#else
+ return {0};
+#endif
}
#endif
#if IE_THREAD == IE_THREAD_TBB || IE_THREAD == IE_THREAD_TBB_AUTO
auto concurrency = (0 == _impl->_config._threadsPerStream) ? tbb::task_arena::automatic : _impl->_config._threadsPerStream;
if (ThreadBindingType::NUMA == _impl->_config._threadBindingType) {
+#if TBB_INTERFACE_VERSION >= 11100 // TBB has numa aware task_arena api
_taskArena.reset(new tbb::task_arena{tbb::task_arena::constraints{_numaNodeId, concurrency}});
+#else
+ _taskArena.reset(new tbb::task_arena{concurrency});
+#endif
} else if ((0 != _impl->_config._threadsPerStream) || (ThreadBindingType::CORES == _impl->_config._threadBindingType)) {
_taskArena.reset(new tbb::task_arena{concurrency});
if (ThreadBindingType::CORES == _impl->_config._threadBindingType) {
void IStreamsExecutor::Config::SetConfig(const std::string& key, const std::string& value) {
if (key == CONFIG_KEY(CPU_BIND_THREAD)) {
if (value == CONFIG_VALUE(YES) || value == CONFIG_VALUE(NUMA)) {
+#if (IE_THREAD == IE_THREAD_TBB || IE_THREAD == IE_THREAD_TBB_AUTO) && (TBB_INTERFACE_VERSION < 11100)
+ if (value == CONFIG_VALUE(NUMA))
+ THROW_IE_EXCEPTION << CONFIG_KEY(CPU_BIND_THREAD) << " property value was set to NUMA. But IE was built with "
+ << "TBB version without NUMA-aware API. Current TBB API version is " << TBB_INTERFACE_VERSION
+ << ", required API version 11100 or greater.";
+#endif
+
#if (defined(__APPLE__) || defined(_WIN32))
// on the Windows and Apple the CORES and NUMA pinning options are the same
_threadBindingType = IStreamsExecutor::ThreadBindingType::NUMA;
using namespace InferenceEngine;
+Config::Config() {
+#if (defined(__APPLE__) || defined(_WIN32))
+#if (IE_THREAD == IE_THREAD_TBB || IE_THREAD == IE_THREAD_TBB_AUTO) && (TBB_INTERFACE_VERSION >= 11100)
+ // If we sure that TBB has NUMA aware API part.
+ streamExecutorConfig._threadBindingType = InferenceEngine::IStreamsExecutor::NUMA;
+#else
+ streamExecutorConfig._threadBindingType = InferenceEngine::IStreamsExecutor::NONE;
+#endif
+#else
+ streamExecutorConfig._threadBindingType = InferenceEngine::IStreamsExecutor::CORES;
+#endif
+
+ updateProperties();
+}
+
+
void Config::readProperties(const std::map<std::string, std::string> &prop) {
auto streamExecutorConfigKeys = streamExecutorConfig.SupportedKeys();
for (auto& kvp : prop) {
namespace MKLDNNPlugin {
struct Config {
- Config() {
-#if (defined(__APPLE__) || defined(_WIN32))
- streamExecutorConfig._threadBindingType = InferenceEngine::IStreamsExecutor::NUMA;
-#else
- streamExecutorConfig._threadBindingType = InferenceEngine::IStreamsExecutor::CORES;
-#endif
- updateProperties();
- }
+ Config();
enum LPTransformsMode {
Off,