Skip to content

Commit 2dba207

Browse files
committed
Commit oneTBB 2021.2.0 source code
1 parent 46fb877 commit 2dba207

File tree

708 files changed

+102348
-3214
lines changed

Some content is hidden

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

708 files changed

+102348
-3214
lines changed

CMakeLists.txt

+19-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020 Intel Corporation
1+
# Copyright (c) 2020-2021 Intel Corporation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -14,9 +14,6 @@
1414

1515
cmake_minimum_required(VERSION 3.1)
1616

17-
include(CheckCXXCompilerFlag)
18-
include(GNUInstallDirs)
19-
2017
# Enable CMake policies
2118

2219
if (POLICY CMP0091)
@@ -50,16 +47,20 @@ endif()
5047
file(READ include/oneapi/tbb/version.h _tbb_version_info)
5148
string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" _tbb_ver_major "${_tbb_version_info}")
5249
string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" _tbb_ver_minor "${_tbb_version_info}")
50+
string(REGEX REPLACE ".*#define TBB_VERSION_PATCH ([0-9]+).*" "\\1" _tbb_ver_patch "${_tbb_version_info}")
5351
string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_tbb_version_info}")
5452
string(REGEX REPLACE ".*#define __TBB_BINARY_VERSION ([0-9]+).*" "\\1" TBB_BINARY_VERSION "${_tbb_version_info}")
55-
set(TBB_BINARY_MINOR_VERSION 1)
53+
set(TBB_BINARY_MINOR_VERSION ${_tbb_ver_minor})
5654
set(TBBMALLOC_BINARY_VERSION 2)
5755
set(TBBBIND_BINARY_VERSION 3)
5856

59-
project(TBB VERSION ${_tbb_ver_major}.${_tbb_ver_minor}.1 LANGUAGES CXX)
57+
project(TBB VERSION ${_tbb_ver_major}.${_tbb_ver_minor}.${_tbb_ver_patch} LANGUAGES CXX)
6058
unset(_tbb_ver_major)
6159
unset(_tbb_ver_minor)
6260

61+
include(CheckCXXCompilerFlag)
62+
include(GNUInstallDirs)
63+
6364
# ---------------------------------------------------------------------------------------------------------
6465
# Handle C++ standard version.
6566
if (NOT MSVC) # no need to cover MSVC as it uses C++14 by default.
@@ -100,6 +101,14 @@ option(TBB4PY_BUILD "Enable tbb4py build" OFF)
100101
option(TBB_CPF "Enable preview features of the library" OFF)
101102
option(TBB_FIND_PACKAGE "Enable search for external oneTBB using find_package instead of build from sources" OFF)
102103

104+
if (NOT DEFINED BUILD_SHARED_LIBS)
105+
set(BUILD_SHARED_LIBS ON)
106+
endif()
107+
108+
if (NOT BUILD_SHARED_LIBS)
109+
message(WARNING "You are building oneTBB as a static library. This is highly discouraged and such configuration is not supported. Consider building a dynamic library to avoid unforeseen issues.")
110+
endif()
111+
103112
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
104113
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Build type" FORCE)
105114
message(STATUS "CMAKE_BUILD_TYPE is not specified. Using default: ${CMAKE_BUILD_TYPE}")
@@ -163,8 +172,6 @@ set(THREADS_PREFER_PTHREAD_FLAG TRUE)
163172
find_package(Threads REQUIRED)
164173
# -------------------------------------------------------------------
165174

166-
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
167-
168175
file(GLOB FILES_WITH_EXTRA_TARGETS ${CMAKE_CURRENT_SOURCE_DIR}/cmake/*.cmake)
169176
foreach(FILE_WITH_EXTRA_TARGETS ${FILES_WITH_EXTRA_TARGETS})
170177
include(${FILE_WITH_EXTRA_TARGETS})
@@ -216,6 +223,10 @@ else()
216223
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
217224
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
218225
COMPONENT devel)
226+
227+
install(FILES "README.md"
228+
DESTINATION ${CMAKE_INSTALL_DOCDIR}
229+
COMPONENT devel)
219230
# -------------------------------------------------------------------
220231
endif()
221232

README.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,31 @@ Here are [Release Notes]( https://software.intel.com/en-us/articles/intel-oneapi
1515
## Support
1616
Please report issues and suggestions via
1717
[GitHub issues](https://github.com/oneapi-src/oneTBB/issues) or start a topic on the
18-
[TBB forum](http://software.intel.com/en-us/forums/intel-threading-building-blocks/).
18+
[oneTBB forum](https://community.intel.com/t5/Intel-oneAPI-Threading-Building/bd-p/oneapi-threading-building-blocks).
1919

2020
## How to Contribute
2121
To contribute to oneTBB, please open a GitHub pull request (preferred) or send us a patch by e-mail.
22+
23+
Please use the sign-off line at the end of the patch.
24+
Your signature certifies that you wrote the patch or
25+
otherwise have the right to pass it on as an open-source patch.
26+
The rules are pretty simple:
27+
if you can certify the https://developercertificate.org then you just add a line to every git commit message:
28+
```
29+
Signed-off-by: Name Surname <[email protected]>
30+
```
31+
Use your real name (sorry, no pseudonyms or anonymous contributions).
32+
33+
If you set your `user.name` and `user.email` git configs, you can sign your
34+
commit automatically with `git commit -s`.
35+
36+
## License
2237
oneAPI Threading Building Blocks is licensed under [Apache License, Version 2.0](LICENSE.txt).
2338
By its terms, contributions submitted to the project are also done under that license.
2439

40+
## Security
41+
To report security issues please go to https://intel.com/security.
42+
2543
## Engineering team contacts
2644
* [E-mail us.](mailto:[email protected])
2745

cmake/README.md

+28-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ TBB_SIGNTOOL_ARGS:STRING - Additional arguments for TBB_SIGNTOOL, used if TBB_SI
1212
TBB4PY_BUILD:BOOL - Enable Intel(R) oneAPI Threading Building Blocks (oneTBB) Python module build (OFF by default)
1313
TBB_CPF:BOOL - Enable preview features of the library (OFF by default)
1414
TBB_INSTALL_VARS:BOOL - Enable auto-generated vars installation(packages generated by `cpack` and `make install` will also include the vars script)(OFF by default)
15+
TBB_VALGRIND_MEMCHECK:BOOL - Enable scan for memory leaks using Valgrind (OFF by default)
1516
```
1617

1718
## Configure, build and test
@@ -39,10 +40,24 @@ Some useful options:
3940
- `-G <generator>` - specify particular project generator, see `cmake --help` for details.
4041
- `-DCMAKE_BUILD_TYPE=Debug` - specify for Debug build, it doesn't applicable for multi-config generators, e.g. for Visual Studio generator).
4142

43+
#### TBBBind library configuration
44+
45+
The TBBbind library has two versions: `tbbbind` and `tbbbind_2_0`. Each of these versions is linked with corresponding HWLOC library version: `tbbbind` links with HWLOC 1.11.x , `tbbbind_2_0` links with HWLOC 2.x.
46+
47+
To enable the TBBBind library build or special tests that performed inside the HWLOC environment, please specify the following CMake variables:
48+
49+
- `CMAKE_HWLOC_<HWLOC_VER>_LIBRARY_PATH` - path to the corresponding HWLOC version shared library on Linux or path to `.lib` file on Windows.
50+
- `CMAKE_HWLOC_<HWLOC_VER>_INCLUDE_PATH` - path to the corresponding HWLOC version includes directory.
51+
52+
Windows requires one additional variable for correct TBBBind library building:
53+
- `CMAKE_HWLOC_<HWLOC_VER>_DLL_PATH` - path to the corresponding HWLOC version `.dll` file.
54+
55+
`HWLOC_VER` variable used above can be replaced with one of the two values: `1_11` for the `tbbbind` library configuration and `2` for the `tbbbind_2_0` library configuration.
56+
4257
### Build
4358

4459
```bash
45-
cmake --build <options> .
60+
cmake --build . <options>
4661
```
4762

4863
Some useful options:
@@ -124,6 +139,18 @@ make -j
124139
ctest -V
125140
```
126141

142+
## Valgrind memcheck - configure, build and run
143+
144+
### Prerequisites
145+
* Valgrind tool executable
146+
### Example
147+
```bash
148+
mkdir build
149+
cd build
150+
cmake -DTBB_VALGRIND_MEMCHECK=ON ..
151+
make -j memcheck-<test name> # or memcheck-all to scan all tests
152+
```
153+
127154
## Test specification (Doxygen)
128155

129156
```bash

cmake/android/device_environment_cleanup.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020 Intel Corporation
1+
# Copyright (c) 2020-2021 Intel Corporation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cmake/android/environment.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020 Intel Corporation
1+
# Copyright (c) 2020-2021 Intel Corporation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cmake/android/test_launcher.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020 Intel Corporation
1+
# Copyright (c) 2020-2021 Intel Corporation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cmake/compilers/AppleClang.cmake

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020 Intel Corporation
1+
# Copyright (c) 2020-2021 Intel Corporation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -22,6 +22,11 @@ set(TBB_COMMON_COMPILE_FLAGS -D_XOPEN_SOURCE)
2222

2323
set(TBB_MMD_FLAG -MMD)
2424

25+
# Ignore -Werror set through add_compile_options() or added to CMAKE_CXX_FLAGS if TBB_STRICT is disabled.
26+
if (NOT TBB_STRICT AND COMMAND tbb_remove_compile_flag)
27+
tbb_remove_compile_flag(-Werror)
28+
endif()
29+
2530
if (NOT "${CMAKE_OSX_ARCHITECTURES}" MATCHES "^arm64$")
2631
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -mrtm)
2732
endif()

cmake/compilers/Clang.cmake

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020 Intel Corporation
1+
# Copyright (c) 2020-2021 Intel Corporation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -17,23 +17,21 @@ set(TBB_DEF_FILE_PREFIX lin${TBB_ARCH})
1717
set(TBB_MMD_FLAG -MMD)
1818
set(TBB_WARNING_LEVEL -Wall -Wextra $<$<BOOL:${TBB_STRICT}>:-Werror>)
1919
set(TBB_TEST_WARNING_FLAGS -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor)
20-
set(TBB_WARNING_SUPPRESS -Wno-parentheses -Wno-non-virtual-dtor -Wno-dangling-else)
20+
21+
# Ignore -Werror set through add_compile_options() or added to CMAKE_CXX_FLAGS if TBB_STRICT is disabled.
22+
if (NOT TBB_STRICT AND COMMAND tbb_remove_compile_flag)
23+
tbb_remove_compile_flag(-Werror)
24+
endif()
2125

2226
if (CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
2327
set(TBB_COMMON_COMPILE_FLAGS -mrtm)
2428
endif()
2529

2630
set(TBB_COMMON_LINK_LIBS dl)
2731

28-
set(TBB_WARNING_SUPPRESS -Wno-non-virtual-dtor -Wno-dangling-else)
2932
if (ANDROID_PLATFORM)
3033
set(TBB_COMMON_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-D_FORTIFY_SOURCE=2>)
3134
endif()
3235

33-
if (NOT APPLE)
34-
set(TBB_WARNING_SUPPRESS -Wno-parentheses)
35-
endif()
36-
3736
# TBB malloc settings
3837
set(TBBMALLOC_LIB_COMPILE_FLAGS -fno-rtti -fno-exceptions)
39-

cmake/compilers/GNU.cmake

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020 Intel Corporation
1+
# Copyright (c) 2020-2021 Intel Corporation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -24,20 +24,16 @@ endif()
2424

2525
set(TBB_COMMON_LINK_LIBS dl)
2626

27+
# Ignore -Werror set through add_compile_options() or added to CMAKE_CXX_FLAGS if TBB_STRICT is disabled.
28+
if (NOT TBB_STRICT AND COMMAND tbb_remove_compile_flag)
29+
tbb_remove_compile_flag(-Werror)
30+
endif()
31+
2732
if (NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL Intel)
2833
# gcc 6.0 and later have -flifetime-dse option that controls elimination of stores done outside the object lifetime
2934
set(TBB_DSE_FLAG $<$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},6.0>>:-flifetime-dse=1>)
3035
endif()
3136

32-
if (NOT APPLE)
33-
set(TBB_WARNING_SUPPRESS -Wno-parentheses)
34-
# gcc 5.0 and later have -Wno-sized-deallocation options
35-
set(TBB_WARNING_SUPPRESS ${TBB_WARNING_SUPPRESS}
36-
$<$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},5.0>>:-Wno-sized-deallocation>)
37-
else()
38-
set(TBB_WARNING_SUPPRESS -Wno-non-virtual-dtor)
39-
endif()
40-
4137
# Workaround for heavy tests
4238
if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "mips")
4339
set(TBB_TEST_COMPILE_FLAGS ${TBB_TEST_COMPILE_FLAGS} -DTBB_TEST_LOW_WORKLOAD)

cmake/compilers/Intel.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020 Intel Corporation
1+
# Copyright (c) 2020-2021 Intel Corporation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

cmake/compilers/MSVC.cmake

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020 Intel Corporation
1+
# Copyright (c) 2020-2021 Intel Corporation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -21,12 +21,23 @@ string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
2121

2222
# Warning suppression C4324: structure was padded due to alignment specifier
2323
set(TBB_WARNING_LEVEL $<$<NOT:$<CXX_COMPILER_ID:Intel>>:/W4> $<$<BOOL:${TBB_STRICT}>:/WX>)
24-
set(TBB_WARNING_SUPPRESS /wd4324 /wd4530 /wd4577)
24+
set(TBB_WARNING_SUPPRESS /wd4324)
2525
set(TBB_TEST_COMPILE_FLAGS /bigobj)
26+
if (MSVC_VERSION LESS_EQUAL 1900)
27+
# Warning suppression C4503 for VS2015 and earlier:
28+
# decorated name length exceeded, name was truncated.
29+
# More info can be found at
30+
# https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4503
31+
set(TBB_TEST_COMPILE_FLAGS ${TBB_TEST_COMPILE_FLAGS} /wd4503)
32+
endif()
2633
set(TBB_LIB_COMPILE_FLAGS -D_CRT_SECURE_NO_WARNINGS /GS)
27-
2834
set(TBB_COMMON_COMPILE_FLAGS /volatile:iso /FS)
2935

36+
# Ignore /WX set through add_compile_options() or added to CMAKE_CXX_FLAGS if TBB_STRICT is disabled.
37+
if (NOT TBB_STRICT AND COMMAND tbb_remove_compile_flag)
38+
tbb_remove_compile_flag(/WX)
39+
endif()
40+
3041
if (WINDOWS_STORE OR TBB_WINDOWS_DRIVER)
3142
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} /D_WIN32_WINNT=0x0A00)
3243
set(TBB_COMMON_LINK_FLAGS /NODEFAULTLIB:kernel32.lib /INCREMENTAL:NO)

cmake/config_generation.cmake

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020 Intel Corporation
1+
# Copyright (c) 2020-2021 Intel Corporation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -77,9 +77,9 @@ endif()
7777
# Expand TBB_LIB_REL_PATH here in IMPORTED_IMPLIB property and
7878
# redefine it with TBB_DLL_REL_PATH value to properly fill IMPORTED_LOCATION property in TBBConfig.cmake.in template.
7979
set(TBB_IMPLIB_RELEASE "
80-
IMPORTED_IMPLIB_RELEASE \"\${CMAKE_CURRENT_LIST_DIR}/${TBB_LIB_REL_PATH}/\${_tbb_subdir}/\${_tbb_component}\${_bin_version}.lib\"")
80+
IMPORTED_IMPLIB_RELEASE \"\${_tbb_root}/${TBB_LIB_REL_PATH}/\${_tbb_subdir}/\${_tbb_component}\${_bin_version}.lib\"")
8181
set(TBB_IMPLIB_DEBUG "
82-
IMPORTED_IMPLIB_DEBUG \"\${CMAKE_CURRENT_LIST_DIR}/${TBB_LIB_REL_PATH}/\${_tbb_subdir}/\${_tbb_component}\${_bin_version}_debug.lib\"")
82+
IMPORTED_IMPLIB_DEBUG \"\${_tbb_root}/${TBB_LIB_REL_PATH}/\${_tbb_subdir}/\${_tbb_component}\${_bin_version}_debug.lib\"")
8383
set(TBB_LIB_REL_PATH ${TBB_DLL_REL_PATH})
8484

8585
if (tbb_gen_cfg_HANDLE_SUBDIRS)

cmake/hwloc_detection.cmake

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright (c) 2020-2021 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+
list(APPEND HWLOC_REQUIRED_VERSIONS 1_11 2 2_4)
16+
17+
foreach(hwloc_version ${HWLOC_REQUIRED_VERSIONS})
18+
if (NOT WIN32)
19+
set(CMAKE_HWLOC_${hwloc_version}_DLL_PATH STUB)
20+
endif()
21+
set(HWLOC_TARGET_NAME HWLOC::hwloc_${hwloc_version})
22+
23+
if (NOT TARGET ${HWLOC_TARGET_NAME} AND
24+
CMAKE_HWLOC_${hwloc_version}_LIBRARY_PATH AND
25+
CMAKE_HWLOC_${hwloc_version}_DLL_PATH AND
26+
CMAKE_HWLOC_${hwloc_version}_INCLUDE_PATH
27+
)
28+
29+
add_library(${HWLOC_TARGET_NAME} SHARED IMPORTED)
30+
set_target_properties(${HWLOC_TARGET_NAME} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
31+
"${CMAKE_HWLOC_${hwloc_version}_INCLUDE_PATH}")
32+
if (WIN32)
33+
set_target_properties(${HWLOC_TARGET_NAME} PROPERTIES
34+
IMPORTED_LOCATION "${CMAKE_HWLOC_${hwloc_version}_DLL_PATH}"
35+
IMPORTED_IMPLIB "${CMAKE_HWLOC_${hwloc_version}_LIBRARY_PATH}")
36+
else()
37+
set_target_properties(${HWLOC_TARGET_NAME} PROPERTIES
38+
IMPORTED_LOCATION "${CMAKE_HWLOC_${hwloc_version}_LIBRARY_PATH}")
39+
endif()
40+
41+
endif()
42+
endforeach()

0 commit comments

Comments
 (0)