Skip to content

Commit bc3abe7

Browse files
committed
Commit oneTBB source code 144b184
1 parent 8b829ac commit bc3abe7

File tree

80 files changed

+926
-318
lines changed

Some content is hidden

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

80 files changed

+926
-318
lines changed

.bazelversion

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.0.0
1+
7.0.0

.github/workflows/ci.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2021-2023 Intel Corporation
1+
# Copyright (c) 2021-2024 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.
@@ -25,6 +25,8 @@ on:
2525
- synchronize
2626
- reopened
2727

28+
permissions: read-all
29+
2830
env:
2931
BUILD_CONCURRENCY: 2
3032
MACOS_BUILD_CONCURRENCY: 3
@@ -57,7 +59,7 @@ jobs:
5759
needs: [codespell]
5860
env:
5961
BUILD_TYPE: oss
60-
runs-on: [ubuntu-20.04]
62+
runs-on: [ubuntu-22.04]
6163
timeout-minutes: 10
6264
steps:
6365
- uses: actions/checkout@v2

CMakeLists.txt

+40-35
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
cmake_minimum_required(VERSION 3.1)
15+
cmake_minimum_required(VERSION 3.5)
1616

1717
# Enable CMake policies
1818

19+
if (POLICY CMP0068)
20+
# RPATH settings do not affect install_name on macOS since CMake 3.9
21+
cmake_policy(SET CMP0068 NEW)
22+
endif()
23+
1924
if (POLICY CMP0091)
2025
# The NEW behavior for this policy is to not place MSVC runtime library flags in the default
2126
# CMAKE_<LANG>_FLAGS_<CONFIG> cache entries and use CMAKE_MSVC_RUNTIME_LIBRARY abstraction instead.
@@ -38,12 +43,6 @@ if (APPLE)
3843
endif()
3944
endif()
4045

41-
# Until CMake 3.4.0 FindThreads.cmake requires C language enabled.
42-
# Enable C language before CXX to avoid possible override of CMAKE_SIZEOF_VOID_P.
43-
if (CMAKE_VERSION VERSION_LESS 3.4)
44-
enable_language(C)
45-
endif()
46-
4746
file(READ include/oneapi/tbb/version.h _tbb_version_info)
4847
string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" _tbb_ver_major "${_tbb_version_info}")
4948
string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" _tbb_ver_minor "${_tbb_version_info}")
@@ -104,9 +103,10 @@ option(TBBMALLOC_BUILD "Enable tbbmalloc build" ON)
104103
cmake_dependent_option(TBBMALLOC_PROXY_BUILD "Enable tbbmalloc_proxy build" ON "TBBMALLOC_BUILD" OFF)
105104
option(TBB_CPF "Enable preview features of the library" OFF)
106105
option(TBB_FIND_PACKAGE "Enable search for external oneTBB using find_package instead of build from sources" OFF)
107-
option(TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH "Disable HWLOC automatic search by pkg-config tool" OFF)
106+
option(TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH "Disable HWLOC automatic search by pkg-config tool" ${CMAKE_CROSSCOMPILING})
108107
option(TBB_ENABLE_IPO "Enable Interprocedural Optimization (IPO) during the compilation" ON)
109108
option(TBB_FUZZ_TESTING "Enable fuzz testing" OFF)
109+
option(TBB_INSTALL "Enable installation" ON)
110110

111111
if (NOT DEFINED BUILD_SHARED_LIBS)
112112
set(BUILD_SHARED_LIBS ON)
@@ -250,34 +250,39 @@ else()
250250
else()
251251
add_subdirectory(src/tbbbind)
252252
endif()
253+
if (TBB_INSTALL)
254+
# -------------------------------------------------------------------
255+
# Installation instructions
256+
include(CMakePackageConfigHelpers)
257+
258+
install(DIRECTORY include/
259+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
260+
COMPONENT devel)
261+
262+
install(EXPORT ${PROJECT_NAME}Targets
263+
NAMESPACE TBB::
264+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
265+
COMPONENT devel)
266+
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
267+
"include(\${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}Targets.cmake)\n")
268+
if (NOT BUILD_SHARED_LIBS)
269+
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
270+
"include(CMakeFindDependencyMacro)\nfind_dependency(Threads)\n")
271+
endif()
272+
273+
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
274+
COMPATIBILITY AnyNewerVersion)
253275

254-
# -------------------------------------------------------------------
255-
# Installation instructions
256-
include(CMakePackageConfigHelpers)
257-
258-
install(DIRECTORY include/
259-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
260-
COMPONENT devel)
261-
262-
install(EXPORT ${PROJECT_NAME}Targets
263-
NAMESPACE TBB::
264-
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
265-
COMPONENT devel)
266-
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
267-
"include(\${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}Targets.cmake)\n")
268-
269-
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
270-
COMPATIBILITY AnyNewerVersion)
271-
272-
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
273-
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
274-
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
275-
COMPONENT devel)
276-
277-
install(FILES "README.md"
278-
DESTINATION ${CMAKE_INSTALL_DOCDIR}
279-
COMPONENT devel)
280-
# -------------------------------------------------------------------
276+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
277+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
278+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
279+
COMPONENT devel)
280+
281+
install(FILES "README.md"
282+
DESTINATION ${CMAKE_INSTALL_DOCDIR}
283+
COMPONENT devel)
284+
# -------------------------------------------------------------------
285+
endif()
281286
endif()
282287

283288
if (TBB_TEST)

CONTRIBUTING.md

-5
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ The DCO is an attestation attached to every contribution made by every developer
2929

3030
As a contributor, you’ll want to be familiar with the oneTBB project and the repository layout. You should also know how to use it as explained in the [oneTBB documentation](https://oneapi-src.github.io/oneTBB/) and how to set up your build development environment to configure, build, and test oneTBB as explained in the [oneTBB Build System Description](cmake/README.md).
3131

32-
## Issues
33-
If you face a problem, first check out open [oneTBB GitHub issues](https://github.com/oneapi-src/oneTBB/issues) to see if the issue you’d like to address is already reported. You may find users that have encountered the bug you’re finding or have similar ideas for changes or additions.
34-
35-
You can use issues to report a problem, make a feature request, or add comments on an existing issue.
36-
3732
## Pull Requests
3833

3934
You can find all [open oneTBB pull requests](https://github.com/oneapi-src/oneTBB/pulls) on GitHub.

INSTALL.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ You can use the ``install`` components for partial installation.
6161
The following install components are supported:
6262
- `runtime` - oneTBB runtime package (core shared libraries and `.dll` files on Windows* OS).
6363
- `devel` - oneTBB development package (header files, CMake integration files, library symbolic links, and `.lib` files on Windows* OS).
64-
- `tbb4py` - [oneTBB Module for Python](#onetbb-python-module-support).
64+
- `tbb4py` - [oneTBB Module for Python](https://github.com/oneapi-src/oneTBB/blob/master/python/README.md).
6565

6666
If you want to install specific components after configuration and build, run:
6767

MODULE.bazel

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright (c) 2021-2024 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+
# DISCLAIMER: Bazel support is community-based. The maintainers do not
16+
# use Bazel internally. The Bazel build can have security risks or
17+
# optimization gaps.
18+
19+
module(
20+
name = "onetbb",
21+
compatibility_level = 1,
22+
)
23+
24+
bazel_dep(name = "platforms", version = "0.0.8")

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ oneTBB is a part of [oneAPI](https://oneapi.io). The current branch implements v
2323
> **_NOTE:_** Threading Building Blocks (TBB) is now called oneAPI Threading Building Blocks (oneTBB) to highlight that the tool is a part of the oneAPI ecosystem.
2424
2525
## Release Information
26-
Here are [Release Notes](RELEASE_NOTES.md) and [System Requirements](SYSTEM_REQUIREMENTS.md).
26+
27+
See [Release Notes](RELEASE_NOTES.md) and [System Requirements](SYSTEM_REQUIREMENTS.md).
2728

2829
## Documentation
2930
* [oneTBB Specification](https://spec.oneapi.com/versions/latest/elements/oneTBB/source/nested-index.html)
@@ -39,7 +40,7 @@ Here are [Release Notes](RELEASE_NOTES.md) and [System Requirements](SYSTEM_REQU
3940
See [Installation from Sources](INSTALL.md) to learn how to install oneTBB.
4041

4142
## Support
42-
Please report issues and suggestions via [GitHub issues](https://github.com/oneapi-src/oneTBB/issues). See our [documentation](./CONTRIBUTING.md##Issues) to learn how to work with them.
43+
See our [documentation](./SUPPORT.md) to learn how to request help.
4344

4445
## How to Contribute
4546
We welcome community contributions, so check our [Contributing Guidelines](CONTRIBUTING.md)
@@ -49,7 +50,6 @@ to learn more.
4950
oneAPI Threading Building Blocks is licensed under [Apache License, Version 2.0](LICENSE.txt).
5051
By its terms, contributions submitted to the project are also done under that license.
5152

52-
5353
## Engineering team contacts
5454
* [Email us.](mailto:[email protected])
5555

RELEASE_NOTES.md

+12-16
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,22 @@
1818
This document contains changes of oneTBB compared to the last release.
1919

2020
## Table of Contents <!-- omit in toc -->
21-
- [New Features](#new-features)
2221
- [Known Limitations](#known-limitations)
2322
- [Fixed Issues](#fixed-issues)
2423

25-
## :tada: New Features
26-
- Since C++17, parallel algorithms and Flow Graph nodes are allowed to accept pointers to the member functions and member objects as the user-provided callables.
27-
- Added missed member functions, such as assignment operators and swap function, to the ``concurrent_queue`` and ``concurrent_bounded_queue`` containers.
28-
2924
## :rotating_light: Known Limitations
30-
- A static assert will cause compilation failures in oneTBB headers when compiling with clang 12.0.0 or newer if using the LLVM standard library with ``-ffreestanding`` and C++11/14 compiler options.
31-
- An application using Parallel STL algorithms in libstdc++ versions 9 and 10 may fail to compile due to incompatible interface changes between earlier versions of Threading Building Blocks (TBB) and oneAPI Threading Building Blocks (oneTBB). Disable support for Parallel STL algorithms by defining ``PSTL_USE_PARALLEL_POLICIES`` (in libstdc++ 9) or ``_GLIBCXX_USE_TBB_PAR_BACKEND`` (in libstdc++ 10) macro to zero before inclusion of the first standard header file in each translation unit.
32-
- On Linux* OS, if oneAPI Threading Building Blocks (oneTBB) or Threading Building Blocks (TBB) are installed in a system folder like ``/usr/lib64``, the application may fail to link due to the order in which the linker searches for libraries. Use the ``-L`` linker option to specify the correct location of oneTBB library. This issue does not affect the program execution.
33-
- The ``oneapi::tbb::info`` namespace interfaces might unexpectedly change the process affinity mask on Windows* OS systems (see https://github.com/open-mpi/hwloc/issues/366 for details) when using hwloc* version lower than 2.5.
34-
- Using a hwloc* version other than 1.11, 2.0, or 2.5 may cause an undefined behavior on Windows* OS. See https://github.com/open-mpi/hwloc/issues/477 for details.
35-
- The NUMA* topology may be detected incorrectly on Windows* OS machines where the number of NUMA* node threads exceeds the size of 1 processor group.
36-
- On Windows* OS on ARM64*, when compiling an application using oneTBB with the Microsoft* Compiler, the compiler issues a warning C4324 that a structure was padded due to the alignment specifier. Consider suppressing the warning by specifying ``/wd4324`` to the compiler command line.
37-
- oneTBB does not support ``fork()``, to work-around the issue, consider using task_scheduler_handle to join oneTBB worker threads before using fork().
25+
- The ``oneapi::tbb::info`` namespace interfaces might unexpectedly change the process affinity mask on Windows* OS systems (see https://github.com/open-mpi/hwloc/issues/366 for details) when using hwloc version lower than 2.5.
26+
- Using a hwloc version other than 1.11, 2.0, or 2.5 may cause an undefined behavior on Windows OS. See https://github.com/open-mpi/hwloc/issues/477 for details.
27+
- The NUMA topology may be detected incorrectly on Windows* OS machines where the number of NUMA node threads exceeds the size of 1 processor group.
28+
- On Windows OS on ARM64*, when compiling an application using oneTBB with the Microsoft* Compiler, the compiler issues a warning C4324 that a structure was padded due to the alignment specifier. Consider suppressing the warning by specifying /wd4324 to the compiler command line.
3829
- C++ exception handling mechanism on Windows* OS on ARM64* might corrupt memory if an exception is thrown from any oneTBB parallel algorithm (see Windows* OS on ARM64* compiler issue: https://developercommunity.visualstudio.com/t/ARM64-incorrect-stack-unwinding-for-alig/1544293).
30+
- Using ``TBBConfig.cmake`` in 32-bit environment may cause incorrect linkage with 64-bit oneTBB library. As a workaround, set ``CMAKE_PREFIX_PATH``:
31+
- On Linux* OS: to ``TBBROOT/lib32/``
32+
- On Windows* OS: to ``TBBROOT/lib32/;TBBROOT/bin32/``
33+
34+
> **_NOTE:_** To see known limitations that impact all versions of oneTBB, refer to [oneTBB Documentation](https://oneapi-src.github.io/oneTBB/main/intro/limitations.html).
35+
3936

4037
## :hammer: Fixed Issues
41-
- Fixed the hang in the reserve method of concurrent unordered containers ([GitHub* #1056](http://github.com/oneapi-src/oneTBB/issues/1056)).
42-
- Fixed the C++20 three-way comparison feature detection ([GitHub* #1093](http://github.com/oneapi-src/oneTBB/issues/1093)).
43-
- Fixed oneTBB integration with CMake* in the Conda* environment.
38+
- Fixed ``tbb::this_task_arena()`` behavior for specific ``tbb::task_arena{1,0}``.
39+
- Restored performance on systems with a high number of CPU cores that support ``_tpause``.

SUPPORT.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!--
2+
******************************************************************************
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+
# oneTBB Support
18+
19+
We are committed to providing support and assistance to help you make the most out of oneTBB.
20+
Use the following methods if you face any challenges.
21+
22+
## Issues
23+
24+
If you have a problem, check out the [GitHub Issues](https://github.com/oneapi-src/oneTBB/issues) to see if the issue you want to address is already reported.
25+
You may find users that have encountered the same bug or have similar ideas for changes or updates.
26+
27+
You can use issues to report a problem, make a feature request, or add comments on an existing issue.
28+
29+
## Discussions
30+
31+
Visit the [GitHub Discussions](https://github.com/oneapi-src/oneTBB/discussions) to engage with the community, ask questions, or help others.
32+
33+
## Email
34+
35+
Reach out to us privately via [email](mailto:[email protected]).

WASM_Support.md

+33-6
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,43 @@
1616

1717
# WASM Support
1818

19+
oneTBB extends its capabilities by offering robust support for ``WASM``.
20+
1921
``WASM`` stands for WebAssembly, a low-level binary format for executing code in web browsers.
20-
It is designed to be a portable target for compilers and to be efficient to parse and execute.
22+
It is designed to be a portable target for compilers and efficient to parse and execute.
23+
24+
Using oneTBB with WASM, you can take full advantage of parallelism and concurrency while working on web-based applications, interactive websites, and a variety of other WASM-compatible platforms.
25+
26+
oneTBB offers WASM support through the integration with [Emscripten*](https://emscripten.org/docs/introducing_emscripten/index.html), a powerful toolchain for compiling C and C++ code into WASM-compatible runtimes.
27+
28+
## Build
29+
30+
**Prerequisites:** Download and install Emscripten*. See the [instructions](https://emscripten.org/docs/getting_started/downloads.html).
31+
32+
To build the system, run:
33+
34+
```
35+
mkdir build && cd build
36+
emcmake cmake .. -DCMAKE_CXX_COMPILER=em++ -DCMAKE_C_COMPILER=emcc -DTBB_STRICT=OFF -DCMAKE_CXX_FLAGS=-Wno-unused-command-line-argument -DTBB_DISABLE_HWLOC_AUTOMATIC_SEARCH=ON -DBUILD_SHARED_LIBS=ON -DTBB_EXAMPLES=ON -DTBB_TEST=ON
37+
cmake --build . <options>
38+
cmake --install . <options>
39+
```
40+
41+
Where:
42+
43+
* ``emcmake`` - a tool that sets up the environment for Emscripten*.
44+
* ``-DCMAKE_CXX_COMPILER=em++`` - specifies the C++ compiler as Emscripten* C++ compiler.
45+
* ``-DCMAKE_C_COMPILER=emcc`` - specifies the C compiler as Emscripten* C compiler.
46+
2147

22-
WebAssembly aims to provide a fast, efficient, and safe way to run code in web browsers without needing plugins or other software. Code written in a variety of programming languages, including C, C++, Rust and others, can be compiled into WebAssembly format for use in web pages. This allows you to write high-performance applications that run directly in the browser.
48+
> **_NOTE:_** See [CMake documentation](https://github.com/oneapi-src/oneTBB/blob/master/cmake/README.md) to learn about other options.
2349
24-
We currently have an [under development branch that provides you with WASM support](https://github.com/oneapi-src/oneTBB/tree/tbb_wasm).
2550

26-
By using WASM, you can:
27-
* Create highly performant and scalable applications that can meet the demands of modern web-based systems.
28-
* Take advantage of oneTBB features to optimize the performance of your web-based applications.
51+
## Run Test
2952

53+
To run tests, use:
3054

55+
```
56+
ctest
57+
```
3158

cmake/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ TBBMALLOC_BUILD:BOOL - Enable Intel(R) oneAPI Threading Building Blocks (oneTBB)
1414
TBBMALLOC_PROXY_BUILD:BOOL - Enable Intel(R) oneAPI Threading Building Blocks (oneTBB) memory allocator proxy build (requires TBBMALLOC_BUILD. ON by default)
1515
TBB4PY_BUILD:BOOL - Enable Intel(R) oneAPI Threading Building Blocks (oneTBB) Python module build (OFF by default)
1616
TBB_CPF:BOOL - Enable preview features of the library (OFF by default)
17+
TBB_INSTALL:BOOL - Enable installation (ON by default)
1718
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)
1819
TBB_VALGRIND_MEMCHECK:BOOL - Enable scan for memory leaks using Valgrind (OFF by default)
1920
TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH - Disable HWLOC automatic search by pkg-config tool (OFF by default)

cmake/compilers/Clang.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ if (NOT TBB_STRICT AND COMMAND tbb_remove_compile_flag)
5252
endif()
5353

5454
# Enable Intel(R) Transactional Synchronization Extensions (-mrtm) and WAITPKG instructions support (-mwaitpkg) on relevant processors
55-
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(AMD64|amd64|i.86|x86)")
55+
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(AMD64|amd64|i.86|x86)" AND NOT EMSCRIPTEN)
5656
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -mrtm $<$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},12.0>>:-mwaitpkg>)
5757
endif()
5858

0 commit comments

Comments
 (0)