Skip to content

Commit

Permalink
Committing TBB 2019 Update 5 source code
Browse files Browse the repository at this point in the history
  • Loading branch information
tbbdev committed Mar 21, 2019
1 parent 2ace525 commit 112ade3
Show file tree
Hide file tree
Showing 49 changed files with 2,145 additions and 598 deletions.
36 changes: 36 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,42 @@
The list of most significant changes made over time in
Intel(R) Threading Building Blocks (Intel(R) TBB).

Intel TBB 2019 Update 5
TBB_INTERFACE_VERSION == 11005

Changes (w.r.t. Intel TBB 2019 Update 4):

- Associating a task_scheduler_observer with an implicit or explicit
task arena is now a fully supported feature.
- Added a CMake module TBBInstallConfig that allows to generate and
install CMake configuration files for TBB packages.
Inspired by Hans Johnson (https://github.com/01org/tbb/pull/119).
- Added node handles, methods merge() and unsafe_extract() to concurrent
unordered containers.
- Added constructors with Compare argument to concurrent_priority_queue
(https://github.com/01org/tbb/issues/109).
- Controlling the stack size of worker threads is now supported for
Universal Windows Platform.
- Improved tbb::zip_iterator to work with algorithms that swap values
via iterators.
- Improved support for user-specified allocators in concurrent_hash_map,
including construction of allocator-aware data types.
- For ReaderWriterMutex types, upgrades and downgrades now succeed if
the mutex is already in the requested state.
Inspired by Niadb (https://github.com/01org/tbb/pull/122).

Preview Features:

- The task_scheduler_observer::may_sleep() method has been removed.

Bugs fixed:

- Fixed the issue with a pipeline parallel filter executing serially if
it follows a thread-bound filter.
- Fixed a performance regression observed when multiple parallel
algorithms start simultaneously.

------------------------------------------------------------------------
Intel TBB 2019 Update 4
TBB_INTERFACE_VERSION == 11004

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

Threading Building Blocks (TBB) lets you easily write parallel C++ programs that take
Expand Down
193 changes: 133 additions & 60 deletions cmake/README.rst

Large diffs are not rendered by default.

98 changes: 98 additions & 0 deletions cmake/TBBInstallConfig.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Copyright (c) 2017-2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
#
#

include(CMakeParseArguments)

# Save the location of Intel TBB CMake modules here, as it will not be possible to do inside functions,
# see for details: https://cmake.org/cmake/help/latest/variable/CMAKE_CURRENT_LIST_DIR.html
set(_tbb_cmake_module_path ${CMAKE_CURRENT_LIST_DIR})

function(tbb_install_config)
set(oneValueArgs INSTALL_DIR
SYSTEM_NAME
LIB_REL_PATH INC_REL_PATH TBB_VERSION TBB_VERSION_FILE
LIB_PATH INC_PATH) # If TBB is installed on the system

cmake_parse_arguments(tbb_IC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

get_filename_component(config_install_dir ${tbb_IC_INSTALL_DIR} ABSOLUTE)
file(MAKE_DIRECTORY ${config_install_dir})

# --- TBB_LIB_REL_PATH handling ---
set(TBB_LIB_REL_PATH "../..")

if (tbb_IC_LIB_REL_PATH)
set(TBB_LIB_REL_PATH ${tbb_IC_LIB_REL_PATH})
endif()

if (tbb_IC_LIB_PATH)
get_filename_component(lib_abs_path ${tbb_IC_LIB_PATH} ABSOLUTE)
file(RELATIVE_PATH TBB_LIB_REL_PATH ${config_install_dir} ${lib_abs_path})
unset(lib_abs_path)
endif()
# ------

# --- TBB_INC_REL_PATH handling ---
set(TBB_INC_REL_PATH "../../../include")

if (tbb_IC_INC_REL_PATH)
set(TBB_INC_REL_PATH ${tbb_IC_INC_REL_PATH})
endif()

if (tbb_IC_INC_PATH)
get_filename_component(inc_abs_path ${tbb_IC_INC_PATH} ABSOLUTE)
file(RELATIVE_PATH TBB_INC_REL_PATH ${config_install_dir} ${inc_abs_path})
unset(inc_abs_path)
endif()
# ------

# --- TBB_VERSION handling ---
if (tbb_IC_TBB_VERSION)
set(TBB_VERSION ${tbb_IC_TBB_VERSION})
else()
set(tbb_version_file "${config_install_dir}/${TBB_INC_REL_PATH}/tbb/tbb_stddef.h")
if (tbb_IC_TBB_VERSION_FILE)
set(tbb_version_file ${tbb_IC_TBB_VERSION_FILE})
endif()

file(READ ${tbb_version_file} _tbb_stddef)
string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" _tbb_ver_major "${_tbb_stddef}")
string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" _tbb_ver_minor "${_tbb_stddef}")
string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" _tbb_ver_interface "${_tbb_stddef}")
set(TBB_VERSION "${_tbb_ver_major}.${_tbb_ver_minor}.${_tbb_ver_interface}")
endif()
# ------

set(tbb_system_name ${CMAKE_SYSTEM_NAME})
if (tbb_IC_SYSTEM_NAME)
set(tbb_system_name ${tbb_IC_SYSTEM_NAME})
endif()

if (tbb_system_name STREQUAL "Linux")
set(TBB_LIB_PREFIX "lib")
set(TBB_LIB_EXT "so.2")
elseif (tbb_system_name STREQUAL "Darwin")
set(TBB_LIB_PREFIX "lib")
set(TBB_LIB_EXT "dylib")
else()
message(FATAL_ERROR "Unsupported OS name: ${tbb_system_name}")
endif()

configure_file(${_tbb_cmake_module_path}/templates/TBBConfig.cmake.in ${config_install_dir}/TBBConfig.cmake @ONLY)
configure_file(${_tbb_cmake_module_path}/templates/TBBConfigVersion.cmake.in ${config_install_dir}/TBBConfigVersion.cmake @ONLY)
endfunction()
41 changes: 34 additions & 7 deletions cmake/TBBMakeConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,15 @@ if (WINDOWS_STORE)
endif()")

if (tbb_MK_CONFIG_FOR_SOURCE)
set(TBB_IMPLIB_RELEASE "\nIMPORTED_IMPLIB_RELEASE \"${tbb_MK_TBB_RELEASE_DIR}/\${_tbb_component}.lib\"")
set(TBB_IMPLIB_DEBUG "\nIMPORTED_IMPLIB_DEBUG \"${tbb_MK_TBB_DEBUG_DIR}/\${_tbb_component}_debug.lib\"")
set(TBB_IMPLIB_RELEASE "
IMPORTED_IMPLIB_RELEASE \"${tbb_MK_TBB_RELEASE_DIR}/\${_tbb_component}.lib\"")
set(TBB_IMPLIB_DEBUG "
IMPORTED_IMPLIB_DEBUG \"${tbb_MK_TBB_DEBUG_DIR}/\${_tbb_component}_debug.lib\"")
else()
set(TBB_IMPLIB_RELEASE "\nIMPORTED_IMPLIB_RELEASE \"\${_tbb_root}/lib/\${_tbb_arch_subdir}/\${_tbb_compiler_subdir}/\${_tbb_component}.lib\"")
set(TBB_IMPLIB_DEBUG "\nIMPORTED_IMPLIB_DEBUG \"\${_tbb_root}/lib/\${_tbb_arch_subdir}/\${_tbb_compiler_subdir}/\${_tbb_component}_debug.lib\"")
set(TBB_IMPLIB_RELEASE "
IMPORTED_IMPLIB_RELEASE \"\${_tbb_root}/lib/\${_tbb_arch_subdir}/\${_tbb_compiler_subdir}/\${_tbb_component}.lib\"")
set(TBB_IMPLIB_DEBUG "
IMPORTED_IMPLIB_DEBUG \"\${_tbb_root}/lib/\${_tbb_arch_subdir}/\${_tbb_compiler_subdir}/\${_tbb_component}_debug.lib\"")
endif()

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

if (tbb_MK_CONFIG_FOR_SOURCE)
set(_tbb_config_template TBBConfigForSource.cmake.in)
set(TBB_CHOOSE_ARCH_AND_COMPILER "")
set(TBB_RELEASE_LIB_PATH "${TBB_RELEASE_DIR}")
set(TBB_DEBUG_LIB_PATH "${TBB_DEBUG_DIR}")
set(TBB_UNSET_ADDITIONAL_VARIABLES "")
else()
set(_tbb_config_template TBBConfig.cmake.in)
# Note: multiline variable
set(TBB_CHOOSE_ARCH_AND_COMPILER "
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_tbb_arch_subdir ${TBB_X64_SUBDIR})
else()
set(_tbb_arch_subdir ${TBB_X32_SUBDIR})
endif()
${TBB_CHOOSE_COMPILER_SUBDIR}
get_filename_component(_tbb_lib_path \"\${_tbb_root}/${TBB_SHARED_LIB_DIR}/\${_tbb_arch_subdir}/\${_tbb_compiler_subdir}\" ABSOLUTE)
")

set(TBB_RELEASE_LIB_PATH "\${_tbb_lib_path}")
set(TBB_DEBUG_LIB_PATH "\${_tbb_lib_path}")

# Note: multiline variable
set(TBB_UNSET_ADDITIONAL_VARIABLES "
unset(_tbb_arch_subdir)
unset(_tbb_compiler_subdir)")
endif()
configure_file(${_tbb_cmake_module_path}/templates/${_tbb_config_template} ${tbb_config_dir}/TBBConfig.cmake @ONLY)

configure_file(${_tbb_cmake_module_path}/templates/TBBConfigInternal.cmake.in ${tbb_config_dir}/TBBConfig.cmake @ONLY)
configure_file(${_tbb_cmake_module_path}/templates/TBBConfigVersion.cmake.in ${tbb_config_dir}/TBBConfigVersion.cmake @ONLY)

set(${tbb_MK_CONFIG_DIR} ${tbb_config_dir} PARENT_SCOPE)
Expand Down
50 changes: 50 additions & 0 deletions cmake/tbb_config_installer.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright (c) 2017-2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
#
#

function(tbb_conf_gen_print_help)
message("Usage: cmake -DINSTALL_DIR=<config_install_dir> -DSYSTEM_NAME=Linux|Darwin <parameters> -P tbb_config_generator.cmake
Parameters:
For custom TBB package:
-DTBB_VERSION_FILE=<tbb_version_file>
-DTBB_VERSION=<major>.<minor>.<interface> (alternative to TBB_VERSION_FILE)
-DLIB_REL_PATH=<relative_path_to_tbb_binaries>
-DINC_REL_PATH=<relative_path_to_tbb_headers>
For installed TBB:
-DLIB_PATH=<path_to_installed_tbb_binaries>
-DINC_PATH=<path_to_installed_tbb_headers>
")
endfunction()

if (NOT DEFINED INSTALL_DIR)
tbb_conf_gen_print_help()
message(FATAL_ERROR "Required parameter INSTALL_DIR is not defined")
endif()

if (NOT DEFINED SYSTEM_NAME)
tbb_conf_gen_print_help()
message(FATAL_ERROR "Required parameter SYSTEM_NAME is not defined")
endif()

foreach (arg TBB_VERSION LIB_REL_PATH INC_REL_PATH TBB_VERSION_FILE LIB_PATH INC_PATH)
set(optional_args ${optional_args} ${arg} ${${arg}})
endforeach()

include(${CMAKE_CURRENT_LIST_DIR}/TBBInstallConfig.cmake)
tbb_install_config(INSTALL_DIR ${INSTALL_DIR} SYSTEM_NAME ${SYSTEM_NAME} ${optional_args})
message(STATUS "TBBConfig files were created in ${INSTALL_DIR}")
106 changes: 53 additions & 53 deletions cmake/templates/TBBConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,30 @@
#
#

# TBB_FOUND should not be set explicitly. It is defined automatically by CMake.
# Handling of TBB_VERSION is in TBBConfigVersion.cmake.
# It defines the following variables:
# TBB_tbb_FOUND
# TBB_tbbmalloc_FOUND
# TBB_tbbmalloc_proxy_FOUND
# TBB_IMPORTED_TARGETS
#
# TBBConfigVersion.cmake defines TBB_VERSION
#
# Initialize to default values
if (NOT TBB_tbb_FOUND)
set(TBB_tbb_FOUND 0)
endif()
if (NOT TBB_tbbmalloc_FOUND)
set(TBB_tbbmalloc_FOUND 0)
endif()
if (NOT TBB_tbbmalloc_proxy_FOUND)
set(TBB_tbbmalloc_proxy_FOUND 0)
endif()
if (NOT TBB_IMPORTED_TARGETS)
set(TBB_IMPORTED_TARGETS "")
endif()

if (NOT TBB_FIND_COMPONENTS)
set(TBB_FIND_COMPONENTS "@TBB_DEFAULT_COMPONENTS@")
set(TBB_FIND_COMPONENTS "tbb;tbbmalloc;tbbmalloc_proxy")
foreach (_tbb_component ${TBB_FIND_COMPONENTS})
set(TBB_FIND_REQUIRED_${_tbb_component} 1)
endforeach()
Expand All @@ -34,66 +53,47 @@ if (NOT _tbbmalloc_proxy_ix EQUAL -1)
list(APPEND TBB_FIND_COMPONENTS tbbmalloc)
set(TBB_FIND_REQUIRED_tbbmalloc ${TBB_FIND_REQUIRED_tbbmalloc_proxy})
endif()
unset(_tbbmalloc_ix)
endif()

set(TBB_INTERFACE_VERSION @TBB_INTERFACE_VERSION@)

get_filename_component(_tbb_root "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_tbb_root "${_tbb_root}" PATH)

set(_tbb_x32_subdir @TBB_X32_SUBDIR@)
set(_tbb_x64_subdir @TBB_X64_SUBDIR@)

if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_tbb_arch_subdir ${_tbb_x64_subdir})
else()
set(_tbb_arch_subdir ${_tbb_x32_subdir})
endif()

@TBB_CHOOSE_COMPILER_SUBDIR@

get_filename_component(_tbb_lib_path "${_tbb_root}/@TBB_SHARED_LIB_DIR@/${_tbb_arch_subdir}/${_tbb_compiler_subdir}" ABSOLUTE)
unset(_tbbmalloc_proxy_ix)

foreach (_tbb_component ${TBB_FIND_COMPONENTS})
set(_tbb_release_lib "${_tbb_lib_path}/@TBB_LIB_PREFIX@${_tbb_component}.@TBB_LIB_EXT@")
set(_tbb_debug_lib "${_tbb_lib_path}/@TBB_LIB_PREFIX@${_tbb_component}_debug.@TBB_LIB_EXT@")
set(_tbb_release_lib "${CMAKE_CURRENT_LIST_DIR}/@TBB_LIB_REL_PATH@/@TBB_LIB_PREFIX@${_tbb_component}.@TBB_LIB_EXT@")
set(_tbb_debug_lib "${CMAKE_CURRENT_LIST_DIR}/@TBB_LIB_REL_PATH@/@TBB_LIB_PREFIX@${_tbb_component}_debug.@TBB_LIB_EXT@")

if (EXISTS "${_tbb_release_lib}" OR EXISTS "${_tbb_debug_lib}")
add_library(TBB::${_tbb_component} SHARED IMPORTED)
set_target_properties(TBB::${_tbb_component} PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_tbb_root}/include"@TBB_COMPILE_DEFINITIONS@)


if (EXISTS "${_tbb_release_lib}")
set_target_properties(TBB::${_tbb_component} PROPERTIES
IMPORTED_LOCATION_RELEASE "${_tbb_release_lib}"@TBB_IMPLIB_RELEASE@)
set_property(TARGET TBB::${_tbb_component} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
endif()

if (EXISTS "${_tbb_debug_lib}")
if (NOT TARGET TBB::${_tbb_component})
add_library(TBB::${_tbb_component} SHARED IMPORTED)
set_target_properties(TBB::${_tbb_component} PROPERTIES
IMPORTED_LOCATION_DEBUG "${_tbb_debug_lib}"@TBB_IMPLIB_DEBUG@)
set_property(TARGET TBB::${_tbb_component} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
endif()

# Add internal dependencies for imported targets: TBB::tbbmalloc_proxy -> TBB::tbbmalloc
if (_tbb_component STREQUAL tbbmalloc_proxy)
set_target_properties(TBB::tbbmalloc_proxy PROPERTIES INTERFACE_LINK_LIBRARIES TBB::tbbmalloc)
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/@TBB_INC_REL_PATH@")

if (EXISTS "${_tbb_release_lib}")
set_target_properties(TBB::${_tbb_component} PROPERTIES
IMPORTED_LOCATION_RELEASE "${_tbb_release_lib}")
set_property(TARGET TBB::${_tbb_component} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
endif()

if (EXISTS "${_tbb_debug_lib}")
set_target_properties(TBB::${_tbb_component} PROPERTIES
IMPORTED_LOCATION_DEBUG "${_tbb_debug_lib}")
set_property(TARGET TBB::${_tbb_component} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
endif()

# Add internal dependencies for imported targets: TBB::tbbmalloc_proxy -> TBB::tbbmalloc
if (_tbb_component STREQUAL tbbmalloc_proxy)
set_target_properties(TBB::tbbmalloc_proxy PROPERTIES INTERFACE_LINK_LIBRARIES TBB::tbbmalloc)
endif()
list(APPEND TBB_IMPORTED_TARGETS TBB::${_tbb_component})
else()
message(STATUS "Using previously found TBB::${_tbb_component}")
endif()

list(APPEND TBB_IMPORTED_TARGETS TBB::${_tbb_component})
set(TBB_${_tbb_component}_FOUND 1)
elseif (TBB_FIND_REQUIRED AND TBB_FIND_REQUIRED_${_tbb_component})
message(FATAL_ERROR "Missed required Intel TBB component: ${_tbb_component}")
message(STATUS "Missed required Intel TBB component: ${_tbb_component}")
message(STATUS " one or both of:\n ${_tbb_release_lib}\n ${_tbb_debug_lib}\n files must exist.")
set(TBB_FOUND FALSE)
set(TBB_${_tbb_component}_FOUND 0)
endif()
endforeach()

unset(_tbb_x32_subdir)
unset(_tbb_x64_subdir)
unset(_tbb_arch_subdir)
unset(_tbb_compiler_subdir)
unset(_tbbmalloc_proxy_ix)
unset(_tbbmalloc_ix)
unset(_tbb_lib_path)
unset(_tbb_release_lib)
unset(_tbb_debug_lib)
Loading

0 comments on commit 112ade3

Please sign in to comment.