Skip to content

Commit f26da46

Browse files
author
Alexey Suhov
authored
Publishing 2020.3.1 LTS content (#3108)
1 parent cd95d8d commit f26da46

File tree

72 files changed

+2377
-1080
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2377
-1080
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright (C) 2020 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
5+
########################################################################
6+
#
7+
# Perform search of TBB package corresponding with specified search order.
8+
#
9+
# TBBROOT var is set into external package path or has a default value
10+
# with IE own version of TBB. Search order is next:
11+
# 1) ${TBBROOT}/cmake
12+
# 2) ${TBBROOT} with IE own version of TBBConfig.cmake (actual for TBB < 2017.7)
13+
#
14+
15+
## Path to IE own version of TBBConfig.cmake old TBB version without cmake config.
16+
if(APPLE)
17+
set(IE_OWN_TBB_CONFIG tbb/mac)
18+
elseif(UNIX)
19+
set(IE_OWN_TBB_CONFIG tbb/lnx)
20+
elseif(WIN)
21+
set(IE_OWN_TBB_CONFIG tbb/win)
22+
else()
23+
unset(IE_OWN_TBB_CONFIG)
24+
endif()
25+
26+
find_package(TBB
27+
CONFIG
28+
NO_DEFAULT_PATH
29+
PATHS ${TBBROOT}/cmake
30+
${CMAKE_CURRENT_LIST_DIR}/${IE_OWN_TBB_CONFIG}
31+
)
32+
find_package_handle_standard_args(TBB CONFIG_MODE)

inference-engine/cmake/dependencies.cmake

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,33 +77,29 @@ endif ()
7777

7878
## TBB package
7979
if (THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
80-
reset_deps_cache(TBBROOT TBB_DIR)
80+
reset_deps_cache(TBBROOT)
8181

8282
if(NOT DEFINED TBB_DIR AND NOT DEFINED ENV{TBB_DIR})
8383
if (WIN32 AND X86_64)
8484
#TODO: add target_path to be platform specific as well, to avoid following if
8585
RESOLVE_DEPENDENCY(TBB
8686
ARCHIVE_WIN "tbb2020_20200415_win.zip"
8787
TARGET_PATH "${TEMP}/tbb"
88-
ENVIRONMENT "TBBROOT"
89-
VERSION_REGEX ".*_([a-z]*_([a-z0-9]+\\.)*[0-9]+).*")
88+
ENVIRONMENT "TBBROOT")
9089
elseif(ANDROID) # Should be before LINUX due LINUX is detected as well
9190
RESOLVE_DEPENDENCY(TBB
9291
ARCHIVE_ANDROID "tbb2020_20200404_android.tgz"
9392
TARGET_PATH "${TEMP}/tbb"
94-
ENVIRONMENT "TBBROOT"
95-
VERSION_REGEX ".*_([a-z]*_([a-z0-9]+\\.)*[0-9]+).*")
93+
ENVIRONMENT "TBBROOT")
9694
elseif(LINUX AND X86_64)
9795
RESOLVE_DEPENDENCY(TBB
9896
ARCHIVE_LIN "tbb2020_20200415_lin_strip.tgz"
99-
TARGET_PATH "${TEMP}/tbb"
100-
ENVIRONMENT "TBBROOT")
97+
TARGET_PATH "${TEMP}/tbb")
10198
elseif(APPLE AND X86_64)
10299
RESOLVE_DEPENDENCY(TBB
103100
ARCHIVE_MAC "tbb2020_20200404_mac.tgz"
104101
TARGET_PATH "${TEMP}/tbb"
105-
ENVIRONMENT "TBBROOT"
106-
VERSION_REGEX ".*_([a-z]*_([a-z0-9]+\\.)*[0-9]+).*")
102+
ENVIRONMENT "TBBROOT")
107103
else()
108104
message(FATAL_ERROR "TBB is not available on current platform")
109105
endif()
@@ -116,12 +112,11 @@ if (THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
116112
endif()
117113

118114
update_deps_cache(TBBROOT "${TBB}" "Path to TBB root folder")
119-
update_deps_cache(TBB_DIR "${TBBROOT}/cmake" "Path to TBB package folder")
120115

121116
if (WIN32)
122-
log_rpath_from_dir(TBB "${TBB_DIR}/../bin")
117+
log_rpath_from_dir(TBB "${TBB}/bin")
123118
else ()
124-
log_rpath_from_dir(TBB "${TBB_DIR}/../lib")
119+
log_rpath_from_dir(TBB "${TBB}/lib")
125120
endif ()
126121
debug_message(STATUS "tbb=" ${TBB})
127122
endif ()

inference-engine/cmake/ie_parallel.cmake

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22
# SPDX-License-Identifier: Apache-2.0
33
#
44

5+
if (THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
6+
find_package(TBB COMPONENTS tbb tbbmalloc)
7+
if (TBB_FOUND)
8+
if (${TBB_VERSION} VERSION_LESS 2020)
9+
ext_message(WARNING "TBB version is less than OpenVINO recommends to use.\
10+
Some TBB related features like NUMA-aware tbb::task_arena\
11+
execution will be disabled.")
12+
endif()
13+
else ()
14+
ext_message(WARNING "TBB was not found by the configured TBB_DIR/TBBROOT path. \
15+
SEQ method will be used.")
16+
endif ()
17+
endif()
18+
519
function(set_ie_threading_interface_for TARGET_NAME)
620
get_target_property(target_type ${TARGET_NAME} TYPE)
721
if(target_type STREQUAL "INTERFACE_LIBRARY")
@@ -48,7 +62,6 @@ function(set_ie_threading_interface_for TARGET_NAME)
4862
set(IE_THREAD_DEFINE "IE_THREAD_SEQ")
4963

5064
if (THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
51-
find_package(TBB COMPONENTS tbb tbbmalloc)
5265
if (TBB_FOUND)
5366
set(IE_THREAD_DEFINE "IE_THREAD_TBB")
5467
ie_target_link_libraries(${TARGET_NAME} ${LINK_TYPE} ${TBB_IMPORTED_TARGETS})
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
#===============================================================================
2+
# Copyright 2017-2020 Intel Corporation
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#===============================================================================
16+
17+
# TBB_FOUND should not be set explicitly. It is defined automatically by CMake.
18+
# Handling of TBB_VERSION is in TBBConfigVersion.cmake.
19+
20+
if (NOT TBB_FIND_COMPONENTS)
21+
set(TBB_FIND_COMPONENTS "tbb;tbbmalloc;tbbmalloc_proxy")
22+
foreach (_tbb_component ${TBB_FIND_COMPONENTS})
23+
set(TBB_FIND_REQUIRED_${_tbb_component} 1)
24+
endforeach()
25+
endif()
26+
27+
# Add components with internal dependencies: tbbmalloc_proxy -> tbbmalloc
28+
list(FIND TBB_FIND_COMPONENTS tbbmalloc_proxy _tbbmalloc_proxy_ix)
29+
if (NOT _tbbmalloc_proxy_ix EQUAL -1)
30+
list(FIND TBB_FIND_COMPONENTS tbbmalloc _tbbmalloc_ix)
31+
if (_tbbmalloc_ix EQUAL -1)
32+
list(APPEND TBB_FIND_COMPONENTS tbbmalloc)
33+
set(TBB_FIND_REQUIRED_tbbmalloc ${TBB_FIND_REQUIRED_tbbmalloc_proxy})
34+
endif()
35+
endif()
36+
37+
if (NOT TBBROOT)
38+
if(DEFINED ENV{TBBROOT})
39+
set (TBBROOT $ENV{TBBROOT})
40+
endif()
41+
endif()
42+
43+
set(_tbb_root ${TBBROOT})
44+
45+
set(_tbb_x32_subdir ia32)
46+
set(_tbb_x64_subdir intel64)
47+
48+
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
49+
set(_tbb_arch_subdir ${_tbb_x64_subdir})
50+
else()
51+
set(_tbb_arch_subdir ${_tbb_x32_subdir})
52+
endif()
53+
54+
if (CMAKE_CXX_COMPILER_LOADED)
55+
set(_tbb_compiler_id ${CMAKE_CXX_COMPILER_ID})
56+
set(_tbb_compiler_ver ${CMAKE_CXX_COMPILER_VERSION})
57+
elseif (CMAKE_C_COMPILER_LOADED)
58+
set(_tbb_compiler_id ${CMAKE_C_COMPILER_ID})
59+
set(_tbb_compiler_ver ${CMAKE_C_COMPILER_VERSION})
60+
endif()
61+
62+
# For non-GCC compilers try to find version of system GCC to choose right compiler subdirectory.
63+
if (NOT _tbb_compiler_id STREQUAL "GNU")
64+
execute_process(COMMAND gcc --version OUTPUT_VARIABLE _tbb_gcc_ver_output ERROR_QUIET)
65+
string(REGEX REPLACE ".*gcc.*([0-9]+\\.[0-9]+)\\.[0-9]+.*" "\\1" _tbb_compiler_ver "${_tbb_gcc_ver_output}")
66+
if (NOT _tbb_compiler_ver)
67+
message(FATAL_ERROR "This Intel TBB package is intended to be used only environment with available 'gcc'")
68+
endif()
69+
unset(_tbb_gcc_ver_output)
70+
endif()
71+
72+
if (EXISTS "${_tbb_root}/lib/${_tbb_arch_subdir}")
73+
set(_tbb_lib ${_tbb_root}/lib/${_tbb_arch_subdir})
74+
set(_tbb_inc ${_tbb_root}/include)
75+
76+
file(GLOB _tbb_gcc_versions_available RELATIVE ${_tbb_lib} ${_tbb_lib}/*)
77+
# shall we check _tbb_gcc_versions_available is not empty?
78+
foreach (_tbb_gcc_version ${_tbb_gcc_versions_available})
79+
string(SUBSTRING ${_tbb_gcc_version} 3 -1 _tbb_gcc_version_number)
80+
if (NOT _tbb_compiler_ver VERSION_LESS _tbb_gcc_version_number)
81+
set(_tbb_compiler_subdir ${_tbb_gcc_version})
82+
endif()
83+
endforeach()
84+
else()
85+
if (TBBROOT)
86+
set(__tbb_hint_path "${TBBROOT}")
87+
else()
88+
set(__tbb_hint_path "/non/existing/path")
89+
endif()
90+
91+
# try to find TBB in the system
92+
find_library(_tbb_lib NAMES tbb
93+
HINTS "${__tbb_hint_path}"
94+
PATH_SUFFIXES lib lib64)
95+
find_path(_tbb_inc NAMES tbb.h
96+
HINTS "${__tbb_hint_path}"
97+
PATH_SUFFIXES include tbb include/tbb)
98+
unset(__tbb_hint_path)
99+
100+
if (NOT _tbb_lib OR NOT _tbb_inc)
101+
message("FATAL_ERROR" "Cannot find TBB")
102+
endif()
103+
104+
get_filename_component(_tbb_lib "${_tbb_lib}" PATH)
105+
get_filename_component(_tbb_inc "${_tbb_inc}" PATH)
106+
107+
set(_tbb_arch_subdir "")
108+
set(_tbb_compiler_subdir "")
109+
endif()
110+
111+
unset(_tbb_gcc_version_number)
112+
unset(_tbb_compiler_id)
113+
unset(_tbb_compiler_ver)
114+
115+
# Now we check that all the needed component are present
116+
get_filename_component(_tbb_lib_path "${_tbb_lib}/${_tbb_compiler_subdir}" ABSOLUTE)
117+
118+
if (TBB_FOUND)
119+
return()
120+
endif()
121+
122+
# detect version
123+
find_file(_tbb_def_header tbb_stddef.h HINTS "${_tbb_root}/include/tbb")
124+
125+
if (_tbb_def_header)
126+
file(READ "${_tbb_def_header}" _tbb_def_content)
127+
string(REGEX MATCH "TBB_VERSION_MAJOR[ ]*[0-9]*" _tbb_version_major ${_tbb_def_content})
128+
string(REGEX MATCH "[0-9][0-9]*" _tbb_version_major ${_tbb_version_major})
129+
130+
string(REGEX MATCH "TBB_VERSION_MINOR[ ]*[0-9]" _tbb_version_minor ${_tbb_def_content})
131+
string(REGEX MATCH "[0-9][0-9]*" _tbb_version_minor ${_tbb_version_minor})
132+
133+
set(TBB_VERSION "${_tbb_version_major}.${_tbb_version_minor}")
134+
else()
135+
set(TBB_VERSION "")
136+
endif()
137+
138+
foreach (_tbb_soversion 2 12)
139+
foreach (_tbb_component ${TBB_FIND_COMPONENTS})
140+
set(_tbb_release_lib
141+
"${_tbb_lib_path}/lib${_tbb_component}.so.${_tbb_soversion}")
142+
set(_tbb_debug_lib
143+
"${_tbb_lib_path}/lib${_tbb_component}_debug.so.${_tbb_soversion}")
144+
145+
# oneDNN change: check library existence (BUILD_MODE related only, not both)
146+
string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPERCASE_CMAKE_BUILD_TYPE)
147+
if (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
148+
if (EXISTS "${_tbb_debug_lib}")
149+
set(_lib_exists TRUE)
150+
elseif (EXISTS "${_tbb_release_lib}")
151+
message(FATAL_ERROR
152+
"Intel TBB release library is found here: ${_tbb_release_lib}. "
153+
"But the debug library
154+
(lib${_tbb_component}_debug.so.${_tbb_soversion}) is missing.")
155+
endif()
156+
else()
157+
if (EXISTS "${_tbb_release_lib}")
158+
set(_lib_exists TRUE)
159+
endif()
160+
endif()
161+
162+
if (_lib_exists)
163+
if (NOT TARGET TBB::${_tbb_component})
164+
add_library(TBB::${_tbb_component} SHARED IMPORTED)
165+
set_target_properties(TBB::${_tbb_component} PROPERTIES
166+
IMPORTED_CONFIGURATIONS "RELEASE;DEBUG"
167+
IMPORTED_LOCATION_RELEASE "${_tbb_release_lib}"
168+
IMPORTED_LOCATION_DEBUG "${_tbb_debug_lib}"
169+
INTERFACE_INCLUDE_DIRECTORIES "${_tbb_inc}")
170+
171+
# Add internal dependencies for imported targets: TBB::tbbmalloc_proxy -> TBB::tbbmalloc
172+
if (_tbb_component STREQUAL tbbmalloc_proxy)
173+
set_target_properties(TBB::tbbmalloc_proxy PROPERTIES INTERFACE_LINK_LIBRARIES TBB::tbbmalloc)
174+
endif()
175+
176+
list(APPEND TBB_IMPORTED_TARGETS TBB::${_tbb_component})
177+
set(TBB_${_tbb_component}_FOUND 1)
178+
endif()
179+
break()
180+
endif()
181+
endforeach()
182+
endforeach()
183+
184+
if (NOT _lib_exists AND TBB_FIND_REQUIRED AND TBB_FIND_REQUIRED_${_tbb_component})
185+
message(FATAL_ERROR "Missed required Intel TBB component: ${_tbb_component}")
186+
endif()
187+
188+
unset(_tbb_x32_subdir)
189+
unset(_tbb_x64_subdir)
190+
unset(_tbb_arch_subdir)
191+
unset(_tbb_compiler_subdir)
192+
unset(_tbbmalloc_proxy_ix)
193+
unset(_tbbmalloc_ix)
194+
unset(_tbb_lib_path)
195+
unset(_tbb_release_lib)
196+
unset(_tbb_debug_lib)

0 commit comments

Comments
 (0)