Xiaoxia/onetbb old version (#12303)

* support oneTBB old version

* fix oneTBB version mismatch issues

* fix clang issue

* add 'tbb' path to setupvars.sh and OpenVINOConfig.cmake.in

* Update scripts/setupvars/setupvars.sh

Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
Co-authored-by: Shen, Wanglei <wanglei.shen@intel.com>
This commit is contained in:
Sun Xiaoxia 2022-07-27 16:49:53 +08:00 committed by GitHub
parent 761a6d10d0
commit 1dd13e2cf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 2 deletions

View File

@ -151,6 +151,9 @@ function(ov_download_tbb)
if(EXISTS "${TBBROOT}/lib/cmake/TBB/TBBConfig.cmake")
# oneTBB case
update_deps_cache(TBB_DIR "${TBBROOT}/lib/cmake/TBB" "Path to TBB cmake folder")
elseif(EXISTS "${TBBROOT}/lib/cmake/tbb/TBBConfig.cmake")
# oneTBB release package version less than 2021.6.0
update_deps_cache(TBB_DIR "${TBBROOT}/lib/cmake/tbb" "Path to TBB cmake folder")
elseif(EXISTS "${TBBROOT}/lib64/cmake/TBB/TBBConfig.cmake")
# 64-bits oneTBB case
update_deps_cache(TBB_DIR "${TBBROOT}/lib64/cmake/TBB" "Path to TBB cmake folder")

View File

@ -160,6 +160,7 @@ if((THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO") AND NOT TBB_FOUND
# oneTBB case exposed via export TBBROOT=<custom TBB root>
"${ENV_TBBROOT}/lib64/cmake/TBB"
"${ENV_TBBROOT}/lib/cmake/TBB"
"${ENV_TBBROOT}/lib/cmake/tbb"
# "$ENV{TBB_DIR}"
# for custom TBB exposed via cmake -DTBBROOT=<custom TBB root>
"${TBBROOT}/cmake"

View File

@ -55,6 +55,8 @@ if [ -e "$INSTALLDIR/runtime/3rdparty/tbb" ]; then
if [ -e "$INSTALLDIR/runtime/3rdparty/tbb/lib/cmake/TBB" ]; then
export TBB_DIR=$INSTALLDIR/runtime/3rdparty/tbb/lib/cmake/TBB
elif [ -e "$INSTALLDIR/runtime/3rdparty/tbb/lib/cmake/tbb" ]; then
export TBB_DIR=$INSTALLDIR/runtime/3rdparty/tbb/lib/cmake/tbb
elif [ -e "$INSTALLDIR/runtime/3rdparty/tbb/lib64/cmake/TBB" ]; then
export TBB_DIR=$INSTALLDIR/runtime/3rdparty/tbb/lib64/cmake/TBB
elif [ -e "$INSTALLDIR/runtime/3rdparty/tbb/cmake" ]; then

View File

@ -29,6 +29,9 @@
# ifndef TBB_PREVIEW_LOCAL_OBSERVER
# define TBB_PREVIEW_LOCAL_OBSERVER 1
# endif
# ifndef TBB_PREVIEW_WAITING_FOR_WORKERS
# define TBB_PREVIEW_WAITING_FOR_WORKERS 1
# endif
# ifndef TBB_PREVIEW_NUMA_SUPPORT
# define TBB_PREVIEW_NUMA_SUPPORT 1
# endif

View File

@ -64,6 +64,9 @@ void ExecutorManagerImpl::setTbbFlag(bool flag) {
if (!tbbTaskScheduler) {
# if (TBB_INTERFACE_VERSION < 12000)
tbbTaskScheduler = std::make_shared<tbb::task_scheduler_init>();
# elif (TBB_INTERFACE_VERSION < 12060)
tbbTaskScheduler =
std::make_shared<oneapi::tbb::task_scheduler_handle>(oneapi::tbb::task_scheduler_handle::get());
# else
tbbTaskScheduler = std::make_shared<oneapi::tbb::task_scheduler_handle>(tbb::attach{});
# endif

View File

@ -282,8 +282,8 @@ ie_headers_compilation_with_custom_flags(TEST_SUFFIX PluginApiCxx17
CXX_STANDARD 17 PLUGIN_API)
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
if(TBB_VERSION VERSION_EQUAL 2021.2)
# TBB 2021.2 has a bug in headers with CXX_STANDARD 20
if(TBB_VERSION VERSION_EQUAL 2021.2.2)
# TBB 2021.2.2 has a bug in headers with CXX_STANDARD 20
# see https://github.com/oneapi-src/oneTBB/issues/379
set(skip_headers_list HEADERS_TO_SKIP "threading/ie_thread_local.hpp")
endif()