Skip to content

Commit 112ade3

Browse files
committed
Committing TBB 2019 Update 5 source code
1 parent 2ace525 commit 112ade3

Some content is hidden

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

49 files changed

+2145
-598
lines changed

CHANGES

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,42 @@
22
The list of most significant changes made over time in
33
Intel(R) Threading Building Blocks (Intel(R) TBB).
44

5+
Intel TBB 2019 Update 5
6+
TBB_INTERFACE_VERSION == 11005
7+
8+
Changes (w.r.t. Intel TBB 2019 Update 4):
9+
10+
- Associating a task_scheduler_observer with an implicit or explicit
11+
task arena is now a fully supported feature.
12+
- Added a CMake module TBBInstallConfig that allows to generate and
13+
install CMake configuration files for TBB packages.
14+
Inspired by Hans Johnson (https://github.com/01org/tbb/pull/119).
15+
- Added node handles, methods merge() and unsafe_extract() to concurrent
16+
unordered containers.
17+
- Added constructors with Compare argument to concurrent_priority_queue
18+
(https://github.com/01org/tbb/issues/109).
19+
- Controlling the stack size of worker threads is now supported for
20+
Universal Windows Platform.
21+
- Improved tbb::zip_iterator to work with algorithms that swap values
22+
via iterators.
23+
- Improved support for user-specified allocators in concurrent_hash_map,
24+
including construction of allocator-aware data types.
25+
- For ReaderWriterMutex types, upgrades and downgrades now succeed if
26+
the mutex is already in the requested state.
27+
Inspired by Niadb (https://github.com/01org/tbb/pull/122).
28+
29+
Preview Features:
30+
31+
- The task_scheduler_observer::may_sleep() method has been removed.
32+
33+
Bugs fixed:
34+
35+
- Fixed the issue with a pipeline parallel filter executing serially if
36+
it follows a thread-bound filter.
37+
- Fixed a performance regression observed when multiple parallel
38+
algorithms start simultaneously.
39+
40+
------------------------------------------------------------------------
541
Intel TBB 2019 Update 4
642
TBB_INTERFACE_VERSION == 11004
743

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Threading Building Blocks 2019 Update 4
2-
[![Stable release](https://img.shields.io/badge/version-2019_U4-green.svg)](https://github.com/01org/tbb/releases/tag/2019_U4)
1+
# Threading Building Blocks 2019 Update 5
2+
[![Stable release](https://img.shields.io/badge/version-2019_U5-green.svg)](https://github.com/01org/tbb/releases/tag/2019_U5)
33
[![Apache License Version 2.0](https://img.shields.io/badge/license-Apache_2.0-green.svg)](LICENSE)
44

55
Threading Building Blocks (TBB) lets you easily write parallel C++ programs that take

cmake/README.rst

Lines changed: 133 additions & 60 deletions
Large diffs are not rendered by default.

cmake/TBBInstallConfig.cmake

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Copyright (c) 2017-2019 Intel Corporation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
#
16+
#
17+
#
18+
19+
include(CMakeParseArguments)
20+
21+
# Save the location of Intel TBB CMake modules here, as it will not be possible to do inside functions,
22+
# see for details: https://cmake.org/cmake/help/latest/variable/CMAKE_CURRENT_LIST_DIR.html
23+
set(_tbb_cmake_module_path ${CMAKE_CURRENT_LIST_DIR})
24+
25+
function(tbb_install_config)
26+
set(oneValueArgs INSTALL_DIR
27+
SYSTEM_NAME
28+
LIB_REL_PATH INC_REL_PATH TBB_VERSION TBB_VERSION_FILE
29+
LIB_PATH INC_PATH) # If TBB is installed on the system
30+
31+
cmake_parse_arguments(tbb_IC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
32+
33+
get_filename_component(config_install_dir ${tbb_IC_INSTALL_DIR} ABSOLUTE)
34+
file(MAKE_DIRECTORY ${config_install_dir})
35+
36+
# --- TBB_LIB_REL_PATH handling ---
37+
set(TBB_LIB_REL_PATH "../..")
38+
39+
if (tbb_IC_LIB_REL_PATH)
40+
set(TBB_LIB_REL_PATH ${tbb_IC_LIB_REL_PATH})
41+
endif()
42+
43+
if (tbb_IC_LIB_PATH)
44+
get_filename_component(lib_abs_path ${tbb_IC_LIB_PATH} ABSOLUTE)
45+
file(RELATIVE_PATH TBB_LIB_REL_PATH ${config_install_dir} ${lib_abs_path})
46+
unset(lib_abs_path)
47+
endif()
48+
# ------
49+
50+
# --- TBB_INC_REL_PATH handling ---
51+
set(TBB_INC_REL_PATH "../../../include")
52+
53+
if (tbb_IC_INC_REL_PATH)
54+
set(TBB_INC_REL_PATH ${tbb_IC_INC_REL_PATH})
55+
endif()
56+
57+
if (tbb_IC_INC_PATH)
58+
get_filename_component(inc_abs_path ${tbb_IC_INC_PATH} ABSOLUTE)
59+
file(RELATIVE_PATH TBB_INC_REL_PATH ${config_install_dir} ${inc_abs_path})
60+
unset(inc_abs_path)
61+
endif()
62+
# ------
63+
64+
# --- TBB_VERSION handling ---
65+
if (tbb_IC_TBB_VERSION)
66+
set(TBB_VERSION ${tbb_IC_TBB_VERSION})
67+
else()
68+
set(tbb_version_file "${config_install_dir}/${TBB_INC_REL_PATH}/tbb/tbb_stddef.h")
69+
if (tbb_IC_TBB_VERSION_FILE)
70+
set(tbb_version_file ${tbb_IC_TBB_VERSION_FILE})
71+
endif()
72+
73+
file(READ ${tbb_version_file} _tbb_stddef)
74+
string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" _tbb_ver_major "${_tbb_stddef}")
75+
string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" _tbb_ver_minor "${_tbb_stddef}")
76+
string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" _tbb_ver_interface "${_tbb_stddef}")
77+
set(TBB_VERSION "${_tbb_ver_major}.${_tbb_ver_minor}.${_tbb_ver_interface}")
78+
endif()
79+
# ------
80+
81+
set(tbb_system_name ${CMAKE_SYSTEM_NAME})
82+
if (tbb_IC_SYSTEM_NAME)
83+
set(tbb_system_name ${tbb_IC_SYSTEM_NAME})
84+
endif()
85+
86+
if (tbb_system_name STREQUAL "Linux")
87+
set(TBB_LIB_PREFIX "lib")
88+
set(TBB_LIB_EXT "so.2")
89+
elseif (tbb_system_name STREQUAL "Darwin")
90+
set(TBB_LIB_PREFIX "lib")
91+
set(TBB_LIB_EXT "dylib")
92+
else()
93+
message(FATAL_ERROR "Unsupported OS name: ${tbb_system_name}")
94+
endif()
95+
96+
configure_file(${_tbb_cmake_module_path}/templates/TBBConfig.cmake.in ${config_install_dir}/TBBConfig.cmake @ONLY)
97+
configure_file(${_tbb_cmake_module_path}/templates/TBBConfigVersion.cmake.in ${config_install_dir}/TBBConfigVersion.cmake @ONLY)
98+
endfunction()

cmake/TBBMakeConfig.cmake

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,15 @@ if (WINDOWS_STORE)
120120
endif()")
121121

122122
if (tbb_MK_CONFIG_FOR_SOURCE)
123-
set(TBB_IMPLIB_RELEASE "\nIMPORTED_IMPLIB_RELEASE \"${tbb_MK_TBB_RELEASE_DIR}/\${_tbb_component}.lib\"")
124-
set(TBB_IMPLIB_DEBUG "\nIMPORTED_IMPLIB_DEBUG \"${tbb_MK_TBB_DEBUG_DIR}/\${_tbb_component}_debug.lib\"")
123+
set(TBB_IMPLIB_RELEASE "
124+
IMPORTED_IMPLIB_RELEASE \"${tbb_MK_TBB_RELEASE_DIR}/\${_tbb_component}.lib\"")
125+
set(TBB_IMPLIB_DEBUG "
126+
IMPORTED_IMPLIB_DEBUG \"${tbb_MK_TBB_DEBUG_DIR}/\${_tbb_component}_debug.lib\"")
125127
else()
126-
set(TBB_IMPLIB_RELEASE "\nIMPORTED_IMPLIB_RELEASE \"\${_tbb_root}/lib/\${_tbb_arch_subdir}/\${_tbb_compiler_subdir}/\${_tbb_component}.lib\"")
127-
set(TBB_IMPLIB_DEBUG "\nIMPORTED_IMPLIB_DEBUG \"\${_tbb_root}/lib/\${_tbb_arch_subdir}/\${_tbb_compiler_subdir}/\${_tbb_component}_debug.lib\"")
128+
set(TBB_IMPLIB_RELEASE "
129+
IMPORTED_IMPLIB_RELEASE \"\${_tbb_root}/lib/\${_tbb_arch_subdir}/\${_tbb_compiler_subdir}/\${_tbb_component}.lib\"")
130+
set(TBB_IMPLIB_DEBUG "
131+
IMPORTED_IMPLIB_DEBUG \"\${_tbb_root}/lib/\${_tbb_arch_subdir}/\${_tbb_compiler_subdir}/\${_tbb_component}_debug.lib\"")
128132
endif()
129133

130134
# Note: multiline variable
@@ -156,11 +160,34 @@ endif()")
156160
set(TBB_VERSION "${_tbb_ver_major}.${_tbb_ver_minor}.${TBB_INTERFACE_VERSION}")
157161

158162
if (tbb_MK_CONFIG_FOR_SOURCE)
159-
set(_tbb_config_template TBBConfigForSource.cmake.in)
163+
set(TBB_CHOOSE_ARCH_AND_COMPILER "")
164+
set(TBB_RELEASE_LIB_PATH "${TBB_RELEASE_DIR}")
165+
set(TBB_DEBUG_LIB_PATH "${TBB_DEBUG_DIR}")
166+
set(TBB_UNSET_ADDITIONAL_VARIABLES "")
160167
else()
161-
set(_tbb_config_template TBBConfig.cmake.in)
168+
# Note: multiline variable
169+
set(TBB_CHOOSE_ARCH_AND_COMPILER "
170+
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
171+
set(_tbb_arch_subdir ${TBB_X64_SUBDIR})
172+
else()
173+
set(_tbb_arch_subdir ${TBB_X32_SUBDIR})
174+
endif()
175+
176+
${TBB_CHOOSE_COMPILER_SUBDIR}
177+
178+
get_filename_component(_tbb_lib_path \"\${_tbb_root}/${TBB_SHARED_LIB_DIR}/\${_tbb_arch_subdir}/\${_tbb_compiler_subdir}\" ABSOLUTE)
179+
")
180+
181+
set(TBB_RELEASE_LIB_PATH "\${_tbb_lib_path}")
182+
set(TBB_DEBUG_LIB_PATH "\${_tbb_lib_path}")
183+
184+
# Note: multiline variable
185+
set(TBB_UNSET_ADDITIONAL_VARIABLES "
186+
unset(_tbb_arch_subdir)
187+
unset(_tbb_compiler_subdir)")
162188
endif()
163-
configure_file(${_tbb_cmake_module_path}/templates/${_tbb_config_template} ${tbb_config_dir}/TBBConfig.cmake @ONLY)
189+
190+
configure_file(${_tbb_cmake_module_path}/templates/TBBConfigInternal.cmake.in ${tbb_config_dir}/TBBConfig.cmake @ONLY)
164191
configure_file(${_tbb_cmake_module_path}/templates/TBBConfigVersion.cmake.in ${tbb_config_dir}/TBBConfigVersion.cmake @ONLY)
165192

166193
set(${tbb_MK_CONFIG_DIR} ${tbb_config_dir} PARENT_SCOPE)

cmake/tbb_config_installer.cmake

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Copyright (c) 2017-2019 Intel Corporation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
#
16+
#
17+
#
18+
19+
function(tbb_conf_gen_print_help)
20+
message("Usage: cmake -DINSTALL_DIR=<config_install_dir> -DSYSTEM_NAME=Linux|Darwin <parameters> -P tbb_config_generator.cmake
21+
22+
Parameters:
23+
For custom TBB package:
24+
-DTBB_VERSION_FILE=<tbb_version_file>
25+
-DTBB_VERSION=<major>.<minor>.<interface> (alternative to TBB_VERSION_FILE)
26+
-DLIB_REL_PATH=<relative_path_to_tbb_binaries>
27+
-DINC_REL_PATH=<relative_path_to_tbb_headers>
28+
For installed TBB:
29+
-DLIB_PATH=<path_to_installed_tbb_binaries>
30+
-DINC_PATH=<path_to_installed_tbb_headers>
31+
")
32+
endfunction()
33+
34+
if (NOT DEFINED INSTALL_DIR)
35+
tbb_conf_gen_print_help()
36+
message(FATAL_ERROR "Required parameter INSTALL_DIR is not defined")
37+
endif()
38+
39+
if (NOT DEFINED SYSTEM_NAME)
40+
tbb_conf_gen_print_help()
41+
message(FATAL_ERROR "Required parameter SYSTEM_NAME is not defined")
42+
endif()
43+
44+
foreach (arg TBB_VERSION LIB_REL_PATH INC_REL_PATH TBB_VERSION_FILE LIB_PATH INC_PATH)
45+
set(optional_args ${optional_args} ${arg} ${${arg}})
46+
endforeach()
47+
48+
include(${CMAKE_CURRENT_LIST_DIR}/TBBInstallConfig.cmake)
49+
tbb_install_config(INSTALL_DIR ${INSTALL_DIR} SYSTEM_NAME ${SYSTEM_NAME} ${optional_args})
50+
message(STATUS "TBBConfig files were created in ${INSTALL_DIR}")

cmake/templates/TBBConfig.cmake.in

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,30 @@
1616
#
1717
#
1818

19-
# TBB_FOUND should not be set explicitly. It is defined automatically by CMake.
20-
# Handling of TBB_VERSION is in TBBConfigVersion.cmake.
19+
# It defines the following variables:
20+
# TBB_tbb_FOUND
21+
# TBB_tbbmalloc_FOUND
22+
# TBB_tbbmalloc_proxy_FOUND
23+
# TBB_IMPORTED_TARGETS
24+
#
25+
# TBBConfigVersion.cmake defines TBB_VERSION
26+
#
27+
# Initialize to default values
28+
if (NOT TBB_tbb_FOUND)
29+
set(TBB_tbb_FOUND 0)
30+
endif()
31+
if (NOT TBB_tbbmalloc_FOUND)
32+
set(TBB_tbbmalloc_FOUND 0)
33+
endif()
34+
if (NOT TBB_tbbmalloc_proxy_FOUND)
35+
set(TBB_tbbmalloc_proxy_FOUND 0)
36+
endif()
37+
if (NOT TBB_IMPORTED_TARGETS)
38+
set(TBB_IMPORTED_TARGETS "")
39+
endif()
2140

2241
if (NOT TBB_FIND_COMPONENTS)
23-
set(TBB_FIND_COMPONENTS "@TBB_DEFAULT_COMPONENTS@")
42+
set(TBB_FIND_COMPONENTS "tbb;tbbmalloc;tbbmalloc_proxy")
2443
foreach (_tbb_component ${TBB_FIND_COMPONENTS})
2544
set(TBB_FIND_REQUIRED_${_tbb_component} 1)
2645
endforeach()
@@ -34,66 +53,47 @@ if (NOT _tbbmalloc_proxy_ix EQUAL -1)
3453
list(APPEND TBB_FIND_COMPONENTS tbbmalloc)
3554
set(TBB_FIND_REQUIRED_tbbmalloc ${TBB_FIND_REQUIRED_tbbmalloc_proxy})
3655
endif()
56+
unset(_tbbmalloc_ix)
3757
endif()
38-
39-
set(TBB_INTERFACE_VERSION @TBB_INTERFACE_VERSION@)
40-
41-
get_filename_component(_tbb_root "${CMAKE_CURRENT_LIST_FILE}" PATH)
42-
get_filename_component(_tbb_root "${_tbb_root}" PATH)
43-
44-
set(_tbb_x32_subdir @TBB_X32_SUBDIR@)
45-
set(_tbb_x64_subdir @TBB_X64_SUBDIR@)
46-
47-
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
48-
set(_tbb_arch_subdir ${_tbb_x64_subdir})
49-
else()
50-
set(_tbb_arch_subdir ${_tbb_x32_subdir})
51-
endif()
52-
53-
@TBB_CHOOSE_COMPILER_SUBDIR@
54-
55-
get_filename_component(_tbb_lib_path "${_tbb_root}/@TBB_SHARED_LIB_DIR@/${_tbb_arch_subdir}/${_tbb_compiler_subdir}" ABSOLUTE)
58+
unset(_tbbmalloc_proxy_ix)
5659

5760
foreach (_tbb_component ${TBB_FIND_COMPONENTS})
58-
set(_tbb_release_lib "${_tbb_lib_path}/@TBB_LIB_PREFIX@${_tbb_component}.@TBB_LIB_EXT@")
59-
set(_tbb_debug_lib "${_tbb_lib_path}/@TBB_LIB_PREFIX@${_tbb_component}_debug.@TBB_LIB_EXT@")
61+
set(_tbb_release_lib "${CMAKE_CURRENT_LIST_DIR}/@TBB_LIB_REL_PATH@/@TBB_LIB_PREFIX@${_tbb_component}.@TBB_LIB_EXT@")
62+
set(_tbb_debug_lib "${CMAKE_CURRENT_LIST_DIR}/@TBB_LIB_REL_PATH@/@TBB_LIB_PREFIX@${_tbb_component}_debug.@TBB_LIB_EXT@")
6063

6164
if (EXISTS "${_tbb_release_lib}" OR EXISTS "${_tbb_debug_lib}")
62-
add_library(TBB::${_tbb_component} SHARED IMPORTED)
63-
set_target_properties(TBB::${_tbb_component} PROPERTIES
64-
INTERFACE_INCLUDE_DIRECTORIES "${_tbb_root}/include"@TBB_COMPILE_DEFINITIONS@)
65-
66-
67-
if (EXISTS "${_tbb_release_lib}")
68-
set_target_properties(TBB::${_tbb_component} PROPERTIES
69-
IMPORTED_LOCATION_RELEASE "${_tbb_release_lib}"@TBB_IMPLIB_RELEASE@)
70-
set_property(TARGET TBB::${_tbb_component} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
71-
endif()
72-
73-
if (EXISTS "${_tbb_debug_lib}")
65+
if (NOT TARGET TBB::${_tbb_component})
66+
add_library(TBB::${_tbb_component} SHARED IMPORTED)
7467
set_target_properties(TBB::${_tbb_component} PROPERTIES
75-
IMPORTED_LOCATION_DEBUG "${_tbb_debug_lib}"@TBB_IMPLIB_DEBUG@)
76-
set_property(TARGET TBB::${_tbb_component} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
77-
endif()
78-
79-
# Add internal dependencies for imported targets: TBB::tbbmalloc_proxy -> TBB::tbbmalloc
80-
if (_tbb_component STREQUAL tbbmalloc_proxy)
81-
set_target_properties(TBB::tbbmalloc_proxy PROPERTIES INTERFACE_LINK_LIBRARIES TBB::tbbmalloc)
68+
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/@TBB_INC_REL_PATH@")
69+
70+
if (EXISTS "${_tbb_release_lib}")
71+
set_target_properties(TBB::${_tbb_component} PROPERTIES
72+
IMPORTED_LOCATION_RELEASE "${_tbb_release_lib}")
73+
set_property(TARGET TBB::${_tbb_component} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
74+
endif()
75+
76+
if (EXISTS "${_tbb_debug_lib}")
77+
set_target_properties(TBB::${_tbb_component} PROPERTIES
78+
IMPORTED_LOCATION_DEBUG "${_tbb_debug_lib}")
79+
set_property(TARGET TBB::${_tbb_component} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
80+
endif()
81+
82+
# Add internal dependencies for imported targets: TBB::tbbmalloc_proxy -> TBB::tbbmalloc
83+
if (_tbb_component STREQUAL tbbmalloc_proxy)
84+
set_target_properties(TBB::tbbmalloc_proxy PROPERTIES INTERFACE_LINK_LIBRARIES TBB::tbbmalloc)
85+
endif()
86+
list(APPEND TBB_IMPORTED_TARGETS TBB::${_tbb_component})
87+
else()
88+
message(STATUS "Using previously found TBB::${_tbb_component}")
8289
endif()
83-
84-
list(APPEND TBB_IMPORTED_TARGETS TBB::${_tbb_component})
8590
set(TBB_${_tbb_component}_FOUND 1)
8691
elseif (TBB_FIND_REQUIRED AND TBB_FIND_REQUIRED_${_tbb_component})
87-
message(FATAL_ERROR "Missed required Intel TBB component: ${_tbb_component}")
92+
message(STATUS "Missed required Intel TBB component: ${_tbb_component}")
93+
message(STATUS " one or both of:\n ${_tbb_release_lib}\n ${_tbb_debug_lib}\n files must exist.")
94+
set(TBB_FOUND FALSE)
95+
set(TBB_${_tbb_component}_FOUND 0)
8896
endif()
8997
endforeach()
90-
91-
unset(_tbb_x32_subdir)
92-
unset(_tbb_x64_subdir)
93-
unset(_tbb_arch_subdir)
94-
unset(_tbb_compiler_subdir)
95-
unset(_tbbmalloc_proxy_ix)
96-
unset(_tbbmalloc_ix)
97-
unset(_tbb_lib_path)
9898
unset(_tbb_release_lib)
9999
unset(_tbb_debug_lib)

0 commit comments

Comments
 (0)