Compare commits

..
Author SHA1 Message Date
tbbdev 9afd759b72 Commit oneTBB source code 627cac6d 2024-02-13 05:49:20 -06:00
tbbdev bc3abe7578 Commit oneTBB source code 144b1846 2024-01-31 10:28:52 -06:00
Olga Malysheva 8b829acc65 Update documentation for oneTBB 2021.11.0 (#1268)
Signed-off-by: Olga Malysheva <olga.malysheva@intel.com>
2023-11-17 17:23:05 +01:00
tbbdev 457fff98bd Commit oneTBB source code cb6cc0ec 2023-09-14 10:56:12 -05:00
Olga Malysheva be2fb93722 Update documentation for oneTBB 2021.10.0 (#1147)
* Update documentation for oneTBB 2021.10.0

Signed-off-by: Olga Malysheva <olga.malysheva@intel.com>
2023-07-24 18:32:00 +02:00
tbbdev 9cb1b454fa Commit oneTBB source code 95f9511 2023-05-26 14:08:52 -05:00
Olga Malysheva a00cc3b8b5 Update documentation for oneTBB 2021.9 (#1060) 2023-04-06 19:14:50 +02:00
tbbdev 3eb1ff7047 Commit oneTBB source code 3b16143 2023-03-10 08:33:18 -06:00
Olga Malysheva c949771482 Update documentation for oneTBB 2021.8 (#998)
Signed-off-by: Olga Malysheva <olga.malysheva@intel.com>
2022-12-22 16:39:46 +01:00
tbbdev bd619c54a6 Commit oneTBB source code 6bfd29b 2022-10-28 08:38:07 -05:00
Olga Malysheva 7673da272f Update documentation (#934) 2022-10-07 16:34:12 +02:00
tbbdev b2b28c5b63 Commit oneTBB 2021.7 source code 32326067 2022-08-11 14:28:08 +02:00
c8504c4ec8 Update documentation for oneTBB 2021.6 (#836)
* Update pull_request_template.md (#751)

Signed-off-by: Alexandra Epanchinzeva alexandra.epanchinzeva@intel.com
(cherry picked from commit 4eda0f93a7)

* Update CONTRIBUTING.md (#765)

(cherry picked from commit e274a9e4b3)

* Documentation update for unpreview `task_handle` and related stuff (#755)

* Unpreview task_handle and related stuff

Signed-off-by: Anton Potapov <anton.potapov@intel.com>
Co-authored-by: Alexandra <alexandra.epanchinzeva@intel.com>
(cherry picked from commit fd76f45215)

* Update conf.py (#774)

(cherry picked from commit 6666292fbf)

* Actualize documentation about proportional splitting constructor in Range (#728)

Actualize documentation about proportional splitting

Signed-off-by: Fedotov, Aleksei <aleksei.fedotov@intel.com>
(cherry picked from commit e5cbe500d2)

* Update doc structure and add new files (#791)

(cherry picked from commit ce0d258e72)

* Instruction for building the docs locally  (#778)

(cherry picked from commit e386960a77)

* Document a way to flow graph can be attached to arbitrary task_arena (#785)

* Document a way to flow graph can be attached to arbitrary task_arena

task_arena interface provides mechanisms to guide tasks execution within the arena by
setting the preferred computation units or restricting part of computation units. In some
cases, you may want to use mechanisms within a flow graph.

Signed-off-by: Serov, Vladimir <vladimir.serov@intel.com>
Co-authored-by: Aleksei Fedotov <aleksei.fedotov@intel.com>
Co-authored-by: Alexandra Epanchinzeva <alexandra.epanchinzeva@intel.com>
(cherry picked from commit a938322524)

* Add topic about "Lazy Initiliazation" pattern to Design patterns (#790)

New topic about Lazy initialization pattern and how it can be implemented using oneapi::tbb::collaborative_call_once has been added.

Signed-off-by: Ilya Isaev <ilya.isaev@intel.com>
(cherry picked from commit 1da8f0d33b)

* Update Get Started Guide (#803)

(cherry picked from commit 05023723ff)

* Update intro_gsg.rst (#808)

(cherry picked from commit 2c4f282e86)

* Update conf.py (#810)

(cherry picked from commit 0a0a5926ee)

* TBB DOC : Dev Guide: Task Scheduler Bypass and How Does Task Scheduler Works (#521)

* TBB DOC : Dev Guide: Task Scheduler Bypass and How Task Scheduler
Works

Signed-off-by: Anton Potapov <anton.potapov@intel.com>
Co-authored-by: Alexandra <alexandra.epanchinzeva@intel.com>

(cherry picked from commit ed9d4b5e9a)

* Update intro_gsg.rst (#811)

(cherry picked from commit efea9935d1)

* Update conf.py (#812)

(cherry picked from commit 3859d1111f)

* Update examples.rst (#816)

(cherry picked from commit 4aa0b0b2db)

* Update layout.html (#815)

(cherry picked from commit 3e352b4812)

* Update RELEASE_NOTES.md for oneTBB 2021.6 (#835)

(cherry picked from commit faaf43c4ab)

Co-authored-by: Alexandra <alexandra.epanchinzeva@intel.com>
Co-authored-by: Anton Potapov <potapov.slash.co@gmail.com>
Co-authored-by: Aleksei Fedotov <aleksei.fedotov@intel.com>
Co-authored-by: Vladimir Serov <vladimir.serov@intel.com>
Co-authored-by: Ilya Isaev <ilya.isaev@intel.com>
Co-authored-by: Anton Potapov <anton.potapov@intel.com>
2022-08-09 13:59:37 -05:00
tbbdev 4533e4ff0f Commit oneTBB source code e0cc5187 2022-01-25 12:24:52 +03:00
Olga Malysheva 3df08fe234 Update documentation for 2021.5 release. (#690)
Signed-off-by: Olga Malysheva <Olga.Malysheva@intel.com>
2021-12-17 16:40:54 +03:00
Ilya Isaev e109790634 vars.bat: fix issue with no TBB in PATH (#624)
Signed-off-by: Ilya Isaev <ilya.isaev@intel.com>
2021-10-19 16:34:44 +03:00
tbbdev 5a5c793a6c Restore files from 70bf10c 2021-10-13 21:02:17 +03:00
Ilya Isaev 544840c8b0 Add TBB_DLL_PATH variable (#617)
Applying 155a9af commit from master
Signed-off-by: Ilya Isaev <ilya.isaev@intel.com>
2021-10-13 15:57:28 +03:00
tbbdev ba0cc2e0f9 Commit oneTBB source code 70bf10c 2021-10-13 14:10:41 +03:00
Olga Malysheva 4e021eafc0 Complete documentation update (#599)
Signed-off-by: Olga Malysheva <Olga.Malysheva@intel.com>
2021-10-04 12:50:18 +03:00
Anton Potapov 84da9e9ad6 - Updating documentation for 2021.4 (#583)
Signed-off-by: Anton Potapov <anton.potapov@intel.com>
2021-09-27 12:07:02 +03:00
tbbdev df3096075a Commit oneTBB source code 357c9b2 2021-09-01 11:20:23 +03:00
tbbdev 261fe22630 Commit oneTBB 2021.3.0 source code 2021-06-30 11:19:55 +03:00
tbbdev 2dba207286 Commit oneTBB 2021.2.0 source code 2021-01-27 23:03:49 +03:00
tbbdev 46fb877ef1 Commit oneTBB 2021.1.1 source code 2020-12-08 14:00:57 +03:00
tbbdev 978af3d9d7 Committing oneTBB 2021.1-beta10 source code 2020-10-27 16:11:20 +03:00
tbbdev 8632c27846 Committing oneTBB 2021.1-beta09 source code 2020-09-24 16:00:30 +03:00
tbbdev 05b1dd0789 Committing oneTBB 2021.1-beta08 source code 2020-08-06 18:38:19 +03:00
tbbdev 88b4c2782a Committing oneTBB 2021.1-beta05 source code 2020-04-01 16:58:36 +03:00
684 changed files with 36368 additions and 11459 deletions
+19
View File
@@ -0,0 +1,19 @@
# Copyright (c) 2021 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.
# DISCLAIMER: Bazel support is community-based. The maintainers do not
# use Bazel internally. The Bazel build can have security risks or
# optimization gaps.
build --symlink_prefix=/ # Out of source build
+1
View File
@@ -0,0 +1 @@
7.0.0
+27
View File
@@ -0,0 +1,27 @@
# Copyright (c) 2023 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.
# PR template regexp's for issue labeler
bug fix:
- '\[(x|X)\]\sbug\sfix'
enhancement:
- '\[(x|X)\]\snew\sfeature'
tests:
- '\[(x|X)\]\stests'
infrastructure:
- '\[(x|X)\]\sinfrastructure'
documentation:
- '\[(x|X)\]\sdocumentation'
allocator:
- '\[(x|X)\]\sallocator'
+18
View File
@@ -0,0 +1,18 @@
# Copyright (c) 2023 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.
allocator:
- 'src/tbbmalloc/**/*'
- 'src/tbbmalloc_proxy/**/*'
- 'test/tbbmalloc/**/*'
+40
View File
@@ -0,0 +1,40 @@
### Description
_Add a comprehensive description of proposed changes_
Fixes # - _issue number(s) if exists_
- [ ] - git commit message contains an appropriate signed-off-by string _(see [CONTRIBUTING.md](https://github.com/oneapi-src/oneTBB/blob/master/CONTRIBUTING.md#pull-requests) for details)_
### Type of change
_Choose one or multiple, leave empty if none of the other choices apply_
_Add a respective label(s) to PR if you have permissions_
- [ ] bug fix - _change that fixes an issue_
- [ ] new feature - _change that adds functionality_
- [ ] tests - _change in tests_
- [ ] infrastructure - _change in infrastructure and CI_
- [ ] documentation - _documentation update_
### Tests
- [ ] added - _required for new features and some bug fixes_
- [ ] not needed
### Documentation
- [ ] updated in # - _add PR number_
- [ ] needs to be updated
- [ ] not needed
### Breaks backward compatibility
- [ ] Yes
- [ ] No
- [ ] Unknown
### Notify the following users
_List users with `@` to send notifications_
### Other information
+97 -20
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Intel Corporation
# Copyright (c) 2021-2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -25,6 +25,8 @@ on:
- synchronize
- reopened
permissions: read-all
env:
BUILD_CONCURRENCY: 2
MACOS_BUILD_CONCURRENCY: 3
@@ -48,12 +50,87 @@ jobs:
- uses: actions/checkout@v2
- name: Run scan
run: |
command -v clang-format-10
cp -r examples examples_formatted
find examples_formatted -regex '.*\.\(cpp\|hpp\)' -exec clang-format-9 -style=file -i {} \;
find examples_formatted -regex '.*\.\(cpp\|hpp\)' -exec clang-format-10 -style=file -i {} \;
diff -r examples examples_formatted
python_module_test_ubuntu18-04:
runs-on: [ubuntu-18.04]
documentation:
needs: [codespell]
env:
BUILD_TYPE: oss
runs-on: [ubuntu-22.04]
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Install prerequisites
run: |
pip3 install -U Jinja2
pip3 install git+https://github.com/executablebooks/sphinx-book-theme.git
pip3 install sphinx-tabs
echo GITHUB_SHA_SHORT=${GITHUB_SHA::8} >> $GITHUB_ENV
mkdir html
- name: Build documentation
run: |
export BUILD_TYPE=${BUILD_TYPE} && sphinx-build doc html
tar -czvf html.tar.gz html/
- name: Save docs
uses: actions/upload-artifact@v2.2.1
with:
name: oneTBB-html-docs-${{ env.GITHUB_SHA_SHORT }}
path: html.tar.gz
pages:
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
needs: [documentation]
steps:
- name: Checkout gh-pages
uses: actions/checkout@v2
with:
ref: gh-pages
path: gh-pages
- name: Set env
run: echo GITHUB_SHA_SHORT=${GITHUB_SHA::8} >> $GITHUB_ENV
- name: Download documetation
uses: actions/download-artifact@v2
with:
name: oneTBB-html-docs-${{ env.GITHUB_SHA_SHORT }}
- name: Publish to github pages
run: |
tar -xvf html.tar.gz
cd gh-pages
rm -rf *
touch .nojekyll # https://github.blog/2009-12-29-bypassing-jekyll-on-github-pages/
cp -r ../html/* .
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit --reset-author --amend -m "Update from GitHub Actions"
git push --force origin gh-pages
copyright_check:
if: ${{ github.ref != 'refs/heads/master' }}
runs-on: [ubuntu-20.04]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Run check
run: |
sed -i \
-e "/Copyright (c) .* Intel Corporation/s/ \([0-9]\+\)[-0-9]*/ \\1-$(date +%Y)/" \
-e "/Copyright (c) .* Intel Corporation/s/$(date +%Y)-$(date +%Y)/$(date +%Y)/" \
$(git diff --diff-filter=d --name-only ${{ github.event.pull_request.base.sha }})
git checkout -- third-party-programs.txt
git diff > years.diff
if [[ -s years.diff ]]; then
echo "Wrong copyright years"
cat years.diff
exit 1
fi
python_module_test_ubuntu_latest:
runs-on: [ubuntu-latest]
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
@@ -72,7 +149,7 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-18.04
- os: ubuntu-latest
c_compiler: gcc
cxx_compiler: g++
std: 14
@@ -110,7 +187,7 @@ jobs:
fail-fast: false
matrix:
include:
- os: macos-10.15
- os: macos-12
c_compiler: clang
cxx_compiler: clang++
std: 14
@@ -136,22 +213,22 @@ jobs:
fail-fast: false
matrix:
include:
- os: windows-2016
generator: Visual Studio 15 2017
- os: windows-2019
generator: Visual Studio 16 2019
c_compiler: cl
cxx_compiler: cl
std: 14
build_type: relwithdebinfo
preview: 'ON'
job_name: windows_cl2017_cxx14_relwithdebinfo_preview=ON
- os: windows-2019
generator: Visual Studio 16 2019
job_name: windows_cl2019_cxx14_relwithdebinfo_preview=ON
- os: windows-2022
generator: Visual Studio 17 2022
c_compiler: cl
cxx_compiler: cl
std: 17
build_type: relwithdebinfo
preview: 'OFF'
job_name: windows_cl2019_cxx17_relwithdebinfo_preview=OFF
job_name: windows_cl2022_cxx17_relwithdebinfo_preview=OFF
steps:
- uses: actions/checkout@v2
- name: Run testing
@@ -172,7 +249,7 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-18.04
- os: ubuntu-latest
c_compiler: gcc
cxx_compiler: g++
std: 14
@@ -210,7 +287,7 @@ jobs:
fail-fast: false
matrix:
include:
- os: macos-10.15
- os: macos-12
c_compiler: clang
cxx_compiler: clang++
std: 14
@@ -236,22 +313,22 @@ jobs:
fail-fast: false
matrix:
include:
- os: windows-2016
generator: Visual Studio 15 2017
- os: windows-2019
generator: Visual Studio 16 2019
c_compiler: cl
cxx_compiler: cl
std: 14
build_type: relwithdebinfo
preview: 'ON'
job_name: examples_windows_cl2017_cxx14_relwithdebinfo_preview=ON
- os: windows-2019
generator: Visual Studio 16 2019
job_name: examples_windows_cl2019_cxx14_relwithdebinfo_preview=ON
- os: windows-2022
generator: Visual Studio 17 2022
c_compiler: cl
cxx_compiler: cl
std: 17
build_type: relwithdebinfo
preview: 'OFF'
job_name: examples_windows_cl2019_cxx17_relwithdebinfo_preview=OFF
job_name: examples_windows_cl2022_cxx17_relwithdebinfo_preview=OFF
steps:
- uses: actions/checkout@v2
- name: Run testing
+35
View File
@@ -0,0 +1,35 @@
# Copyright (c) 2023 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.
name: "Issue Labeler"
on:
issues:
types: [opened, edited]
pull_request:
types: [opened, edited]
jobs:
triage:
runs-on: ubuntu-latest
permissions:
pull-requests: write
issues: write
contents: read
steps:
- uses: github/issue-labeler@v3.2 #May not be the latest version
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/issue_labeler.yml
enable-versioned-regex: 0
sync-labels: 1
+26
View File
@@ -0,0 +1,26 @@
# Copyright (c) 2023 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.
name: "Pull Request Labeler"
on:
- pull_request_target
jobs:
triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
+118
View File
@@ -0,0 +1,118 @@
# Copyright (c) 2021-2022 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.
# DISCLAIMER: Bazel support is community-based. The maintainers do not
# use Bazel internally. The Bazel build can have security risks or
# optimization gaps.
package(
default_visibility = ["//visibility:public"],
)
cc_library(
name = "tbb",
srcs = glob([
"src/tbb/*.cpp",
"src/tbb/*.h",
]) + select({
"@platforms//cpu:x86_64": glob(["src/tbb/tools_api/**/*.h"]),
"//conditions:default": [],
}),
hdrs = glob([
"include/tbb/*.h",
"include/oneapi/*.h",
"include/oneapi/tbb/*.h",
"include/oneapi/tbb/detail/*.h",
]),
copts = ["-w"] + select({
"@platforms//os:windows": [""],
"//conditions:default": ["-mwaitpkg"],
}),
defines =
select({
"@platforms//cpu:x86_64": ["__TBB_NO_IMPLICIT_LINKAGE"],
"//conditions:default": [
"USE_PTHREAD",
],
}) +
select({
"@platforms//os:osx": ["_XOPEN_SOURCE"],
"//conditions:default": [],
}),
includes = [
"include",
],
linkopts =
select({
"@platforms//os:windows": [],
"@platforms//os:linux": [
"-ldl",
"-pthread",
"-lrt",
],
"//conditions:default": ["-pthread"],
}),
local_defines = select({
"@platforms//cpu:x86_64": [
"__TBB_USE_ITT_NOTIFY",
],
"//conditions:default": [],
}) + [
"__TBB_BUILD",
],
textual_hdrs = select({
"@platforms//cpu:x86_64": [
"src/tbb/tools_api/ittnotify_static.c",
],
"//conditions:default": [],
}),
)
cc_library(
name = "tbbmalloc",
srcs =
glob([
"src/tbbmalloc/*.h",
"src/tbb/*.h",
"src/tbbmalloc_proxy/*.h",
]) + [
"src/tbbmalloc/backend.cpp",
"src/tbbmalloc/backref.cpp",
"src/tbbmalloc/frontend.cpp",
"src/tbbmalloc/large_objects.cpp",
"src/tbbmalloc/tbbmalloc.cpp",
],
hdrs = glob([
"include/tbb/*.h",
"include/oneapi/tbb/detail/*.h",
"include/oneapi/tbb/*.h",
]),
includes = [
"include",
],
local_defines = [
"__TBBMALLOC_BUILD",
],
)
cc_library(
name = "tbbmalloc_proxy",
srcs = [
"src/tbbmalloc_proxy/function_replacement.cpp",
"src/tbbmalloc_proxy/proxy.cpp",
],
deps = [
":tbbmalloc",
],
)
+96
View File
@@ -0,0 +1,96 @@
# Bazel* build support
The main build system of oneTBB is CMake*.
[Bazel*](https://bazel.build/) support is community-based.
The Bazel configuration may not include recommended compiler and/or linker flags used in the official CMake configuration.
---
**NOTE**
Bazel is not recommended for use by oneTBB maintainers. Thus, it is not used internally.
---
The Bazel oneTBB build is currently only intended for a subset of oneTBB that suffices restricted use cases.
Pull requests to improve the Bazel build experience are welcome.
The standard Bazel approach to handling third-party libraries is static linking. It is the best practice within the Bazel ecosystem.
## Using oneTBB as a dependency
This example demonstrates how to use oneTBB as a dependency within a Bazel project.
The following file structure is assumed:
```
example
├── .bazelrc
├── BUILD.bazel
├── main.cpp
└── WORKSPACE.bazel
```
_WORKSPACE.bazel_:
```python
load("@platforms//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
name = "oneTBB",
branch = "master",
remote = "https://github.com/oneapi-src/oneTBB/",
)
```
In the *WORKSPACE* file, the oneTBB GitHub* repository is fetched.
_BUILD.bazel_:
```python
cc_binary(
name = "Demo",
srcs = ["main.cpp"],
deps = ["@oneTBB//:tbb"],
)
```
The *BUILD* file defines a binary named `Demo` that has a dependency to oneTBB.
_main.cpp_:
```c++
#include "oneapi/tbb/version.h"
#include <iostream>
int main() {
std::cout << "Hello from oneTBB "
<< TBB_VERSION_MAJOR << "."
<< TBB_VERSION_MINOR << "."
<< TBB_VERSION_PATCH
<< "!" << std::endl;
return 0;
}
```
The expected output of this program is the current version of oneTBB.
Switch to the folder with the files created earlier and run the binary with `bazel run //:Demo`.
## Build oneTBB using Bazel
Run ```bazel build //...``` in the oneTBB root directory.
## Compiler support
The Bazel build uses the compiler flag `-mwaitpkg` in non-Windows* builds.
This flag is supported by the GNU* Compiler Collection (GCC) version 9.3, Clang* 12, and newer versions of those tools.
---
**NOTE**
To use the Bazel build with earlier versions of GCC, remove `-mwaitpkg` flag as it leads to errors during compilation.
---
+115 -43
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2021 Intel Corporation
# Copyright (c) 2020-2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,10 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.5)
# Enable CMake policies
if (POLICY CMP0068)
# RPATH settings do not affect install_name on macOS since CMake 3.9
cmake_policy(SET CMP0068 NEW)
endif()
if (POLICY CMP0091)
# The NEW behavior for this policy is to not place MSVC runtime library flags in the default
# CMAKE_<LANG>_FLAGS_<CONFIG> cache entries and use CMAKE_MSVC_RUNTIME_LIBRARY abstraction instead.
@@ -38,12 +43,6 @@ if (APPLE)
endif()
endif()
# Until CMake 3.4.0 FindThreads.cmake requires C language enabled.
# Enable C language before CXX to avoid possible override of CMAKE_SIZEOF_VOID_P.
if (CMAKE_VERSION VERSION_LESS 3.4)
enable_language(C)
endif()
file(READ include/oneapi/tbb/version.h _tbb_version_info)
string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" _tbb_ver_major "${_tbb_version_info}")
string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" _tbb_ver_minor "${_tbb_version_info}")
@@ -60,6 +59,7 @@ unset(_tbb_ver_minor)
include(CheckCXXCompilerFlag)
include(GNUInstallDirs)
include(CMakeDependentOption)
# ---------------------------------------------------------------------------------------------------------
# Handle C++ standard version.
@@ -98,14 +98,24 @@ option(TBB_STRICT "Treat compiler warnings as errors" ON)
option(TBB_WINDOWS_DRIVER "Build as Universal Windows Driver (UWD)" OFF)
option(TBB_NO_APPCONTAINER "Apply /APPCONTAINER:NO (for testing binaries for Windows Store)" OFF)
option(TBB4PY_BUILD "Enable tbb4py build" OFF)
option(TBB_BUILD "Enable tbb build" ON)
option(TBBMALLOC_BUILD "Enable tbbmalloc build" ON)
cmake_dependent_option(TBBMALLOC_PROXY_BUILD "Enable tbbmalloc_proxy build" ON "TBBMALLOC_BUILD" OFF)
option(TBB_CPF "Enable preview features of the library" OFF)
option(TBB_FIND_PACKAGE "Enable search for external oneTBB using find_package instead of build from sources" OFF)
option(TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH "Disable HWLOC automatic search by pkg-config tool" ${CMAKE_CROSSCOMPILING})
option(TBB_ENABLE_IPO "Enable Interprocedural Optimization (IPO) during the compilation" ON)
option(TBB_FUZZ_TESTING "Enable fuzz testing" OFF)
option(TBB_INSTALL "Enable installation" ON)
if (NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
endif()
if (NOT BUILD_SHARED_LIBS)
if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
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.")
endif()
@@ -116,6 +126,14 @@ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
if (CMAKE_BUILD_TYPE)
string(TOLOWER ${CMAKE_BUILD_TYPE} _tbb_build_type)
if (_tbb_build_type STREQUAL "debug")
set(TBB_ENABLE_IPO OFF)
endif()
unset(_tbb_build_type)
endif()
# -------------------------------------------------------------------
# Files and folders naming
set(CMAKE_DEBUG_POSTFIX _debug)
@@ -164,10 +182,22 @@ foreach(output_type LIBRARY ARCHIVE PDB RUNTIME)
endif()
endforeach()
if (CMAKE_CONFIGURATION_TYPES)
# We can't use generator expressions in a cmake variable name.
set(TBB_TEST_WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${TBB_OUTPUT_DIR_BASE}_$<LOWER_CASE:$<CONFIG>>)
else()
set(TBB_TEST_WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif()
# -------------------------------------------------------------------
# -------------------------------------------------------------------
# Common dependencies
#force -pthread during compilation for Emscripten
if (EMSCRIPTEN AND NOT EMSCRIPTEN_WITHOUT_PTHREAD)
set(THREADS_HAVE_PTHREAD_ARG TRUE)
endif()
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
# -------------------------------------------------------------------
@@ -177,6 +207,22 @@ foreach(FILE_WITH_EXTRA_TARGETS ${FILES_WITH_EXTRA_TARGETS})
include(${FILE_WITH_EXTRA_TARGETS})
endforeach()
# - Enabling LTO on Android causes the NDK bug.
# NDK throws the warning: "argument unused during compilation: '-Wa,--noexecstack'"
# - For some reason GCC does not instrument code with Thread Sanitizer when lto is enabled and C linker is used.
if (TBB_ENABLE_IPO AND BUILD_SHARED_LIBS AND NOT ANDROID_PLATFORM AND NOT TBB_SANITIZE MATCHES "thread")
if (NOT CMAKE_VERSION VERSION_LESS 3.9)
cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported)
check_ipo_supported(RESULT TBB_IPO_PROPERTY)
else()
set(TBB_IPO_FLAGS TRUE)
endif()
if (TBB_IPO_PROPERTY OR TBB_IPO_FLAGS)
message(STATUS "IPO enabled")
endif()
endif()
set(TBB_COMPILER_SETTINGS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compilers/${CMAKE_CXX_COMPILER_ID}.cmake)
if (EXISTS ${TBB_COMPILER_SETTINGS_FILE})
include(${TBB_COMPILER_SETTINGS_FILE})
@@ -190,44 +236,53 @@ if (TBB_FIND_PACKAGE OR TBB_DIR)
message(STATUS "Using external TBB for testing")
find_package(TBB REQUIRED)
else()
add_subdirectory(src/tbb)
if (NOT "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "mips")
if (TBB_BUILD)
add_subdirectory(src/tbb)
endif()
if (TBBMALLOC_BUILD)
add_subdirectory(src/tbbmalloc)
add_subdirectory(src/tbbmalloc_proxy)
if (APPLE)
message(STATUS "TBBBind build target is disabled due to unsupported environment")
else()
add_subdirectory(src/tbbbind)
if(TBBMALLOC_PROXY_BUILD AND NOT "${MSVC_CXX_ARCHITECTURE_ID}" MATCHES "ARM64")
add_subdirectory(src/tbbmalloc_proxy)
endif()
endif()
if (NOT BUILD_SHARED_LIBS)
message(STATUS "TBBBind build targets are disabled due to unsupported environment")
else()
add_subdirectory(src/tbbbind)
endif()
if (TBB_INSTALL)
# -------------------------------------------------------------------
# Installation instructions
include(CMakePackageConfigHelpers)
# -------------------------------------------------------------------
# Installation instructions
include(CMakePackageConfigHelpers)
install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT devel)
install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT devel)
install(EXPORT ${PROJECT_NAME}Targets
NAMESPACE TBB::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
COMPONENT devel)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
"include(\${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}Targets.cmake)\n")
if (NOT BUILD_SHARED_LIBS)
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
"include(CMakeFindDependencyMacro)\nfind_dependency(Threads)\n")
endif()
install(EXPORT ${PROJECT_NAME}Targets
NAMESPACE TBB::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
COMPONENT devel)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
"include(\${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}Targets.cmake)\n")
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
COMPATIBILITY AnyNewerVersion)
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
COMPATIBILITY AnyNewerVersion)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
COMPONENT devel)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
COMPONENT devel)
install(FILES "README.md"
DESTINATION ${CMAKE_INSTALL_DOCDIR}
COMPONENT devel)
# -------------------------------------------------------------------
install(FILES "README.md"
DESTINATION ${CMAKE_INSTALL_DOCDIR}
COMPONENT devel)
# -------------------------------------------------------------------
endif()
endif()
if (TBB_TEST)
@@ -249,11 +304,28 @@ if (TBB_BENCH)
endif()
if (ANDROID_PLATFORM)
if (${ANDROID_STL} STREQUAL "c++_shared")
configure_file(
"${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_ABI}/libc++_shared.so"
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libc++_shared.so"
COPYONLY)
if ("${ANDROID_STL}" STREQUAL "c++_shared")
if (${ANDROID_NDK_MAJOR} GREATER_EQUAL "25")
if(ANDROID_ABI STREQUAL "arm64-v8a")
set(ANDROID_TOOLCHAIN_NAME "aarch64-linux-android")
elseif(ANDROID_ABI STREQUAL "x86_64")
set(ANDROID_TOOLCHAIN_NAME "x86_64-linux-android")
elseif(ANDROID_ABI STREQUAL "armeabi-v7a")
set(ANDROID_TOOLCHAIN_NAME "arm-linux-androideabi")
elseif(ANDROID_ABI STREQUAL "x86")
set(ANDROID_TOOLCHAIN_NAME "i686-linux-android")
endif()
configure_file(
"${ANDROID_TOOLCHAIN_ROOT}/sysroot/usr/lib/${ANDROID_TOOLCHAIN_NAME}/libc++_shared.so"
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libc++_shared.so"
COPYONLY)
else()
configure_file(
"${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_ABI}/libc++_shared.so"
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libc++_shared.so"
COPYONLY)
endif()
endif()
# This custom target may be implemented without separate CMake script, but it requires
# ADB(Android Debug Bridge) executable file availability, so to incapsulate this requirement
+53
View File
@@ -0,0 +1,53 @@
<!--
******************************************************************************
* 
* 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.
*******************************************************************************/-->
# How to Contribute
As an open source project, we welcome community contributions to oneAPI Threading Building Blocks (oneTBB). This document explains how to participate in project conversations, log bugs and enhancement requests, and submit code patches to the project.
## Licensing
Licensing is very important to open source projects. It helps ensure the software continues to be available under the terms that the author desired. The oneTBB project uses the [Apache 2.0 License](https://github.com/oneapi-src/oneTBB/blob/master/LICENSE.txt), a permissive open source license that allows you to freely use, modify, and distribute your own products that include Apache 2.0 licensed software. By contributing to the oneTBB project, you agree to the license and copyright terms therein and release your own contributions under these terms.
Some imported or reused components within oneTBB use other licenses, as described in [third-party-programs.txt](https://github.com/oneapi-src/oneTBB/blob/master/third-party-programs.txt). By carefully reviewing potential contributions and enforcing a [Developer Certification of Origin (DCO)](https://developercertificate.org/) for contributed code, we can ensure that the community can develop products with oneTBB without concerns over patent or copyright issues.
The DCO is an attestation attached to every contribution made by every developer. In the commit message of the contribution, (described later), the developer simply adds a Signed-off-by statement and thereby agrees to the DCO.
## Prerequisites
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).
## Pull Requests
You can find all [open oneTBB pull requests](https://github.com/oneapi-src/oneTBB/pulls) on GitHub.
No anonymous contributions are accepted. The name in the commit message Signed-off-by line and your email must match the change authorship information. Make sure your .gitconfig is set up correctly so you can use `git commit -s` for signing your patches:
`git config --global user.name "Taylor Developer"`
`git config --global user.email taylor.developer@company.com`
### Before contributing changes directly to the oneTBB repository
* Make sure you can build the product and run all the tests with your patch.
* For a larger feature, provide a relevant test.
* Document your code. The oneTBB project uses reStructuredText for documentation.
* Update the copyright year in the first line of the changing file(s).
For example, if you commit your changes in 2022:
* the copyright year should be `2005-2022` for existing files
* the copyright year should be `2022` for new files
* Submit a pull request into the master branch. You can submit changes with a pull request (preferred) or by sending an email patch.
Continuous Integration (CI) testing is enabled for the repository. Your pull request must pass all checks before it can be merged. We will review your contribution and may provide feedback to guide you if any additional fixes or modifications are necessary. When reviewed and accepted, your pull request will be merged into our GitHub repository.
+135
View File
@@ -0,0 +1,135 @@
# Installation from Sources
## Prerequisites
- Make sure you have installed CMake version 3.1 (or newer) on your system. oneTBB uses CMake build configuration.
- Configure and build oneTBB. To work with build configurations, see [Build System Description](cmake/README.md).
## Configure oneTBB
At the command prompt, type:
```
cmake <options> <repo_root>
```
You may want to use some additional options for configuration:
| Option | Purpose | Description |
| ------ |------ | ------ |
| `-G <generator>` | Specify project generator | For more information, run cmake `–help`. |
|`-DCMAKE_BUILD_TYPE=Debug` | Specify for Debug build | Not applicable for multi-configuration generators such as Visual Studio generator. |
## Build oneTBB
To build the system, run:
```
cmake --build . <options>
```
Some useful build options:
- `--target <target>` - specific target, "all" is default.
- `--config <Release|Debug>` - build configuration, applicable only for multi-config generators such as Visual Studio generator.
## Install and Pack oneTBB
---
**NOTE**
Be careful about installing prefix. It defaults to `/usr/local` on UNIX* and `c:/Program Files/${PROJECT_NAME}` on Windows* OS.
You can define custom `CMAKE_INSTALL_PREFIX` during configuration:
```
cmake -DCMAKE_INSTALL_PREFIX=/my/install/prefix ..
```
---
Installation can also be done using:
```
cmake --install <project-binary-dir>
```
Special ``--install`` target can alternatively be used for installation, e.g. ``make install``.
You can use the ``install`` components for partial installation.
The following install components are supported:
- `runtime` - oneTBB runtime package (core shared libraries and `.dll` files on Windows* OS).
- `devel` - oneTBB development package (header files, CMake integration files, library symbolic links, and `.lib` files on Windows* OS).
- `tbb4py` - [oneTBB Module for Python](https://github.com/oneapi-src/oneTBB/blob/master/python/README.md).
If you want to install specific components after configuration and build, run:
```bash
cmake -DCOMPONENT=<component> [-DBUILD_TYPE=<build-type>] -P cmake_install.cmake
```
Simple packaging using CPack is supported.
The following commands allow you to create a simple portable package that includes header files, libraries, and integration files for CMake:
```bash
cmake <options> ..
cpack
```
## Installation from vcpkg
You can download and install oneTBB using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
```sh
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh #.\bootstrap-vcpkg.bat(for Windows)
./vcpkg integrate install
./vcpkg install tbb
```
The oneTBB port in vcpkg is kept up to date by Microsoft* team members and community contributors. If the version is out of date, create an issue or pull request on the [vcpkg repository](https://github.com/Microsoft/vcpkg).
## Example of Installation
### Single-configuration generators
The following example demonstrates how to install oneTBB for single-configuration generators (e.g. GNU Make, Ninja, etc.).
```bash
# Do our experiments in /tmp
cd /tmp
# Clone oneTBB repository
git clone https://github.com/oneapi-src/oneTBB.git
cd oneTBB
# Create binary directory for out-of-source build
mkdir build && cd build
# Configure: customize CMAKE_INSTALL_PREFIX and disable TBB_TEST to avoid tests build
cmake -DCMAKE_INSTALL_PREFIX=/tmp/my_installed_onetbb -DTBB_TEST=OFF ..
# Build
cmake --build .
# Install
cmake --install .
# Well done! Your installed oneTBB is in /tmp/my_installed_onetbb
```
### Multi-configuration generators
The following example demonstrates how to install oneTBB for multi-configuration generators such as Visual Studio*.
Choose the configuration during the build and install steps:
```batch
REM Do our experiments in %TMP%
cd %TMP%
REM Clone oneTBB repository
git clone https://github.com/oneapi-src/oneTBB.git
cd oneTBB
REM Create binary directory for out-of-source build
mkdir build && cd build
REM Configure: customize CMAKE_INSTALL_PREFIX and disable TBB_TEST to avoid tests build
cmake -DCMAKE_INSTALL_PREFIX=%TMP%\my_installed_onetbb -DTBB_TEST=OFF ..
REM Build "release with debug information" configuration
cmake --build . --config relwithdebinfo
REM Install "release with debug information" configuration
cmake --install . --config relwithdebinfo
REM Well done! Your installed oneTBB is in %TMP%\my_installed_onetbb
```
+24
View File
@@ -0,0 +1,24 @@
# Copyright (c) 2021-2024 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.
# DISCLAIMER: Bazel support is community-based. The maintainers do not
# use Bazel internally. The Bazel build can have security risks or
# optimization gaps.
module(
name = "onetbb",
compatibility_level = 1,
)
bazel_dep(name = "platforms", version = "0.0.8")
+37 -31
View File
@@ -1,51 +1,57 @@
# oneAPI Threading Building Blocks
[![Apache License Version 2.0](https://img.shields.io/badge/license-Apache_2.0-green.svg)](LICENSE.txt) [![oneTBB CI](https://github.com/oneapi-src/oneTBB/actions/workflows/ci.yml/badge.svg)](https://github.com/oneapi-src/oneTBB/actions/workflows/ci.yml?query=branch%3Amaster)
oneAPI Threading Building Blocks (oneTBB) lets you easily write parallel C++ programs that take
full advantage of multicore performance, that are portable, composable and have future-proof scalability.
oneTBB is a flexible C++ library that simplifies the work of adding parallelism
to complex applications, even if you are not a threading expert.
The library lets you easily write parallel programs that take full advantage of the multi-core performance. Such programs are portable,
composable and have a future-proof scalability. oneTBB provides you with functions, interfaces, and classes to parallelize and scale the code.
All you have to do is to use the templates.
The library differs from typical threading packages in the following ways:
* oneTBB enables you to specify logical parallelism instead of threads.
* oneTBB targets threading for performance.
* oneTBB is compatible with other threading packages.
* oneTBB emphasizes scalable, data parallel programming.
* oneTBB relies on generic programming.
Refer to oneTBB [examples](examples) and [samples](https://github.com/oneapi-src/oneAPI-samples/tree/master/Libraries/oneTBB) to see how you can use the library.
oneTBB is a part of [oneAPI](https://oneapi.io). The current branch implements version 1.1 of oneAPI Specification.
> **_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.
## Release Information
Here are [Release Notes]( https://software.intel.com/en-us/articles/intel-oneapi-threading-building-blocks-release-notes) and
[System Requirements](https://software.intel.com/en-us/articles/intel-oneapi-threading-building-blocks-system-requirements).
See [Release Notes](RELEASE_NOTES.md) and [System Requirements](SYSTEM_REQUIREMENTS.md).
## Documentation
* [oneTBB Specification](https://spec.oneapi.com/versions/latest/elements/oneTBB/source/nested-index.html)
* [oneTBB Developer Guide and Reference](https://software.intel.com/en-us/oneapi-tbb-documentation)
* [Migrating from TBB to oneTBB](https://software.intel.com/content/www/us/en/develop/documentation/onetbb-documentation/top/onetbb-developer-guide/migrating-from-threading-building-blocks-tbb.html)
* README for build system: [cmake/README.md](cmake/README.md)
* [oneTBB Developer Guide and Reference](https://oneapi-src.github.io/oneTBB)
* [Migrating from TBB to oneTBB](https://oneapi-src.github.io/oneTBB/main/tbb_userguide/Migration_Guide.html)
* [README for the CMake build system](cmake/README.md)
* [oneTBB Testing Approach](https://oneapi-src.github.io/oneTBB/main/intro/testing_approach.html)
* [Basic support for the Bazel build system](Bazel.md)
* [oneTBB Discussions](https://github.com/oneapi-src/oneTBB/discussions)
* [WASM Support](WASM_Support.md)
## Installation
See [Installation from Sources](INSTALL.md) to learn how to install oneTBB.
## Support
Please report issues and suggestions via
[GitHub issues](https://github.com/oneapi-src/oneTBB/issues) or start a topic on the
[oneTBB forum](https://community.intel.com/t5/Intel-oneAPI-Threading-Building/bd-p/oneapi-threading-building-blocks).
See our [documentation](./SUPPORT.md) to learn how to request help.
## How to Contribute
To contribute to oneTBB, please open a GitHub pull request (preferred) or send us a patch by e-mail.
Please use the sign-off line at the end of the patch.
Your signature certifies that you wrote the patch or
otherwise have the right to pass it on as an open-source patch.
The rules are pretty simple:
if you can certify the https://developercertificate.org then you just add a line to every git commit message:
```
Signed-off-by: Name Surname <user@email.com>
```
Use your real name (sorry, no pseudonyms or anonymous contributions).
If you set your `user.name` and `user.email` git configs, you can sign your
commit automatically with `git commit -s`.
We welcome community contributions, so check our [Contributing Guidelines](CONTRIBUTING.md)
to learn more.
## License
oneAPI Threading Building Blocks is licensed under [Apache License, Version 2.0](LICENSE.txt).
By its terms, contributions submitted to the project are also done under that license.
## Security
To report security issues please go to https://intel.com/security.
## Engineering team contacts
* [E-mail us.](mailto:inteltbbdevelopers@intel.com)
* [Email us.](mailto:inteltbbdevelopers@intel.com)
------------------------------------------------------------------------
Intel and the Intel logo are trademarks of Intel Corporation or its subsidiaries in the U.S. and/or other countries.
\* Other names and brands may be claimed as the property of others.
\* All names and brands may be claimed as the property of others.
+39
View File
@@ -0,0 +1,39 @@
<!--
******************************************************************************
* 
* 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.
*******************************************************************************/-->
# Release Notes <!-- omit in toc -->
This document contains changes of oneTBB compared to the last release.
## Table of Contents <!-- omit in toc -->
- [Known Limitations](#known-limitations)
- [Fixed Issues](#fixed-issues)
## :rotating_light: Known Limitations
- 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.
- 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.
- 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.
- 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.
- 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).
- Using ``TBBConfig.cmake`` in 32-bit environment may cause incorrect linkage with 64-bit oneTBB library. As a workaround, set ``CMAKE_PREFIX_PATH``:
- On Linux* OS: to ``TBBROOT/lib32/``
- On Windows* OS: to ``TBBROOT/lib32/;TBBROOT/bin32/``
> **_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).
## :hammer: Fixed Issues
- Fixed ``tbb::this_task_arena()`` behavior for specific ``tbb::task_arena{1,0}``.
- Restored performance on systems with a high number of CPU cores that support ``_tpause``.
+7
View File
@@ -0,0 +1,7 @@
# Security Policy
Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution,
impact, severity and mitigation.
## Reporting a Vulnerability
Please report any security vulnerabilities in this project
[utilizing the guidelines here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html).
+35
View File
@@ -0,0 +1,35 @@
<!--
******************************************************************************
* 
* 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.
*******************************************************************************/-->
# oneTBB Support
We are committed to providing support and assistance to help you make the most out of oneTBB.
Use the following methods if you face any challenges.
## Issues
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.
You may find users that have encountered the same bug or have similar ideas for changes or updates.
You can use issues to report a problem, make a feature request, or add comments on an existing issue.
## Discussions
Visit the [GitHub Discussions](https://github.com/oneapi-src/oneTBB/discussions) to engage with the community, ask questions, or help others.
## Email
Reach out to us privately via [email](mailto:inteltbbdevelopers@intel.com).
+86
View File
@@ -0,0 +1,86 @@
<!--
******************************************************************************
* 
* 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.
*******************************************************************************/-->
# System Requirements <!-- omit in toc -->
This document provides details about hardware, operating system, and software prerequisites for the oneAPI Threading Building Blocks (oneTBB).
## Table of Contents <!-- omit in toc -->
- [Supported Hardware](#supported-hardware)
- [Software](#software)
- [Supported Operating Systems](#supported-operating-systems)
- [Community-Supported Platforms](#community-supported-platforms)
- [Supported Compilers](#supported-compilers)
- [Limitations](#limitations)
## Supported Hardware
- Intel(R) Celeron(R) processor family
- Intel(R) Core* processor family
- Intel(R) Xeon(R) processor family
- Intel(R) Atom* processor family
- Non-Intel(R) processors compatible with the processors listed above
## Software
### Supported Operating Systems
- Systems with Microsoft* Windows* operating systems:
- Microsoft* Windows* 10
- Microsoft* Windows* 11
- Microsoft* Windows* Server 2019
- Microsoft* Windows* Server 2022
- Systems with Linux* operating systems:
- Oracle Linux* 8
- Amazon* Linux 2, 2022
- Debian* 9, 10, 11
- Fedora* 36, 37, 38
- Rocky* Linux* 8, 9
- Red Hat* Enterprise Linux* 8, 9
- SuSE* Linux* Enterprise Server 15
- Ubuntu* 20.04, 22.04
- Systems with macOS* operating systems:
- macOS* 12.x, 13.x
- Systems with Android* operating systems:
- Android* 9
### Community-Supported Platforms
- MinGW*
- FreeBSD*
- Microsoft* Windows* on ARM*/ARM64*
- macOS* on ARM64*
### Supported Compilers
- Intel* oneAPI DPC++/C++ Compiler
- Intel® C++ Compiler Classic 2021.1 - 2021.9
- Microsoft* Visual C++ 14.2 (Microsoft* Visual Studio* 2019, Windows* OS only)
- Microsoft* Visual C++ 14.3 (Microsoft* Visual Studio* 2022, Windows* OS only)
- For each supported Linux* operating system, the standard gcc version provided with that operating system is supported:
- GNU Compilers (gcc) 8.x – 12.x
- GNU C Library (glibc) version 2.28 – 2.36
- Clang* 6.0.0 - 13.0.0
## Limitations
There are some cases where we cannot provide support for your platforms. It includes:
1. The platform is out of official support (met end of life). When you use an unsupported platform, you can face a security risk that can be difficult to resolve.
2. We do not have the infrastructure to test a platform. Therefore we cannot guarantee that oneTBB works correctly on that platform.
3. Changes affect more code than just platform-specific macros.
4. The platform is incompatible with oneTBB. Some platforms may have limitations that prevent oneTBB from working correctly. We cannot provide support in these cases as the issue is beyond our control.
5. The platform is modified or customized. If you made significant updates to your platform, it might be hard for us to find the root cause of the issue. Therefore, we may not be able to provide support as the modification could affect the oneTBB functionality.
We understand that these limitations can be frustrating. Thus, we suggest creating a branch specifically for the unsupported platform, allowing other users to contribute to or use your implementation.
+60
View File
@@ -0,0 +1,60 @@
<!--
******************************************************************************
* 
* 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.
*******************************************************************************/-->
# WASM Support
oneTBB extends its capabilities by offering robust support for ``WASM``.
``WASM`` stands for WebAssembly, a low-level binary format for executing code in web browsers.
It is designed to be a portable target for compilers and efficient to parse and execute.
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.
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.
## Build
**Prerequisites:** Download and install Emscripten*. See the [instructions](https://emscripten.org/docs/getting_started/downloads.html).
To build the system, run:
```
mkdir build && cd build
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
```
To compile oneTBB without ``pthreads``, set the flag ``-DEMSCRIPTEN_WITHOUT_PTHREAD=true`` in the command above. By default, oneTBB uses the ``pthreads``.
```
cmake --build . <options>
cmake --install . <options>
```
Where:
* ``emcmake`` - a tool that sets up the environment for Emscripten*.
* ``-DCMAKE_CXX_COMPILER=em++`` - specifies the C++ compiler as Emscripten* C++ compiler.
* ``-DCMAKE_C_COMPILER=emcc`` - specifies the C compiler as Emscripten* C compiler.
> **_NOTE:_** See [CMake documentation](https://github.com/oneapi-src/oneTBB/blob/master/cmake/README.md) to learn about other options.
## Run Test
To run tests, use:
```
ctest
```
+19
View File
@@ -0,0 +1,19 @@
# Copyright (c) 2021 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.
# DISCLAIMER: Bazel support is community-based. The maintainers do not
# use Bazel internally. The Bazel build can have security risks or
# optimization gaps.
workspace(name = "oneTBB")
+129 -90
View File
@@ -1,29 +1,31 @@
# Build system description
# Build System Description
The project uses CMake build configuration.
The project uses CMake* build configuration.
The following controls are available during the configure stage:
```
TBB_TEST:BOOL - Enable testing (ON by default)
TBB_STRICT:BOOL - Treat compiler warnings as errors (ON by default)
TBB_SANITIZE:STRING - Sanitizer parameter, passed to compiler/linker
TBB_SIGNTOOL:FILEPATH - Tool for digital signing, used in post install step for libraries if provided.
TBB_SIGNTOOL:FILEPATH - Tool for digital signing, used in post-install step for libraries if provided.
TBB_SIGNTOOL_ARGS:STRING - Additional arguments for TBB_SIGNTOOL, used if TBB_SIGNTOOL is set.
TBB4PY_BUILD:BOOL - Enable Intel(R) oneAPI Threading Building Blocks (oneTBB) Python module build (OFF by default)
TBB_BUILD:BOOL - Enable Intel(R) oneAPI Threading Building Blocks (oneTBB) build (ON by default)
TBBMALLOC_BUILD:BOOL - Enable Intel(R) oneAPI Threading Building Blocks (oneTBB) memory allocator build (ON by default)
TBBMALLOC_PROXY_BUILD:BOOL - Enable Intel(R) oneAPI Threading Building Blocks (oneTBB) memory allocator proxy build (requires TBBMALLOC_BUILD. ON by default)
TBB4PY_BUILD:BOOL - Enable Intel(R) oneAPI Threading Building Blocks (oneTBB) Python module build (OFF by default)
TBB_CPF:BOOL - Enable preview features of the library (OFF by default)
TBB_INSTALL:BOOL - Enable installation (ON by default)
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)
TBB_VALGRIND_MEMCHECK:BOOL - Enable scan for memory leaks using Valgrind (OFF by default)
TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH - Disable HWLOC automatic search by pkg-config tool (OFF by default)
TBB_ENABLE_IPO - Enable Interprocedural Optimization (IPO) during the compilation (ON by default)
```
## Configure, build and test
### Prerequisites
* CMake >= 3.1
## Configure, Build, and Test
### Preparation
In order to perform out-of-source build you have to create a build directory and go there:
To perform an out-of-source build, create a build directory and go there:
```bash
mkdir /tmp/my-build
@@ -37,22 +39,47 @@ cmake <options> <repo_root>
```
Some useful options:
- `-G <generator>` - specify particular project generator, see `cmake --help` for details.
- `-DCMAKE_BUILD_TYPE=Debug` - specify for Debug build, it isn't applicable for multi-config generators, e.g. for Visual Studio generator).
- `-G <generator>` - specify particular project generator. See `cmake --help` for details.
- `-DCMAKE_BUILD_TYPE=Debug` - specify for Debug build. It is not applicable for multi-config generators, e.g., Microsoft* Visual Studio* generator.
#### TBBBind library configuration
#### TBBBind Library Configuration
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.
> **_TIP:_** It is recommended to install the HWLOC* library. See [oneTBB documentation](https://oneapi-src.github.io/oneTBB/GSG/next_steps.html#hybrid-cpu-and-numa-support) for details.
To enable the TBBBind library build or special tests that performed inside the HWLOC environment, please specify the following CMake variables:
The TBBbind library has three versions: `tbbbind`, `tbbbind_2_0`, and `tbbbind_2_5`. Each of these versions is linked with the corresponding HWLOC* library version:
- `tbbbind` links with `HWLOC 1.11.x`
- `tbbbind_2_0` links with `HWLOC 2.1–2.4`
- `tbbbind_2_5` links with `HWLOC 2.5` and later
- `CMAKE_HWLOC_<HWLOC_VER>_LIBRARY_PATH` - path to the corresponding HWLOC version shared library on Linux or path to `.lib` file on Windows.
- `CMAKE_HWLOC_<HWLOC_VER>_INCLUDE_PATH` - path to the corresponding HWLOC version includes directory.
The search for a suitable version of the HWLOC library is enabled by default. If you want to use a specific version of the library, you can specify the path to it manually using the following CMake variables:
Windows requires one additional variable for correct TBBBind library building:
- `CMAKE_HWLOC_<HWLOC_VER>_LIBRARY_PATH` - path to the corresponding HWLOC version shared library on Linux* OS or path to `.lib` file on Windows* OS
- `CMAKE_HWLOC_<HWLOC_VER>_INCLUDE_PATH` - path to the corresponding HWLOC version including directory
---
**NOTE:** Automatic HWLOC searching requires CMake version 3.6 or higher.
---
Windows* OS requires an additional variable for correct TBBBind library building:
- `CMAKE_HWLOC_<HWLOC_VER>_DLL_PATH` - path to the corresponding HWLOC version `.dll` file.
`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.
The `HWLOC_VER` substring used earlier can be replaced with one of the three values:
- `1_11` for the `tbbbind` library configuration
- `2` for the `tbbbind_2_0` library configuration
- `2_5` for the `tbbbind_2_5` library configuration
If you specify variables for several TBBBind versions, the building process for all of these versions is performed during a single build session.
---
**TIP**
Specify the `TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH` to turn off the HWLOC library's automatic search.
---
### Build
@@ -61,21 +88,28 @@ cmake --build . <options>
```
Some useful options:
- `--target <target>` - specific target, "all" is default.
- `--config <Release|Debug>` - build configuration, applicable only for multi-config generators, e.g. Visual Studio generator.
- `--target <target>` - specific target, "all" is the default.
- `--config <Release|Debug>` - build configuration, applicable only for multi-config generators, e.g., Visual Studio* generator.
Binaries are placed to `./<compiler-id>_<compiler-ver>_cxx<stdver>_<build-type>` (for example, `./gnu_4.8_cxx11_release`)
The binaries are placed to `./<compiler-id>_<compiler-ver>_cxx<stdver>_<build-type>`. For example, `./gnu_4.8_cxx11_release`.
#### Build for 32-bit
#### Build For 32-bit
* Intel Compiler: just source Intel(R) C++ Compiler with `ia32` and build as usual.
* MSVC: use switch for [generator](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html) (e.g. `-A Win32` for [VS2019](https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2016%202019.html)) during the configuration stage and then build as usual.
* GCC/Clang: specify `-m32` during the configuration: `CXXFLAGS=-m32 cmake ..` or `cmake -DCMAKE_CXX_FLAGS=-m32 ..`
* Any other compiler which builds for 64-bit by default: specify 32-bit compiler key during the configuration as above.
* **Intel(R) Compiler**. Source Intel(R) C++ Compiler with `ia32` and build as usual.
* **MSVC**. Use switch for [generator](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html) (e.g., `-A Win32` for [VS2019](https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2016%202019.html)) during the configuration stage and then build as usual.
* **GCC/Clang**. Specify `-m32` during the configuration. It can be `CXXFLAGS=-m32 cmake ..` or `cmake -DCMAKE_CXX_FLAGS=-m32 ..`
* For any other compiler, which builds for 64-bit by default, specify a 32-bit compiler key during the configuration as above.
#### Windows specific builds (CMake 3.15 or newer is required)
#### Windows* OS-Specific Builds
* Dynamic linkage with CRT: default behavior, can be explicitly specified by setting `CMAKE_MSVC_RUNTIME_LIBRARY` to `MultiThreadedDLL` or `MultiThreadedDebugDLL`.
---
**NOTE**
The following builds require CMake version 3.15 or higher.
---
* **Dynamic linkage with C Runtime Library (CRT)**. The default behavior can be explicitly specified by setting `CMAKE_MSVC_RUNTIME_LIBRARY` to `MultiThreadedDLL` or `MultiThreadedDebugDLL`.
```bash
cmake .. # dynamic linkage is used by default
```
@@ -85,51 +119,76 @@ cmake -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL ..
```bash
cmake -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL -DCMAKE_BUILD_TYPE=Debug ..
```
* Static linkage with CRT: set `CMAKE_MSVC_RUNTIME_LIBRARY` to `MultiThreaded` or `MultiThreadedDebug`.
* **Static linkage with CRT**. Set `CMAKE_MSVC_RUNTIME_LIBRARY` to `MultiThreaded` or `MultiThreadedDebug`.
```bash
cmake -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded ..
```
```bash
cmake -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug -DCMAKE_BUILD_TYPE=Debug ..
```
* Windows 10 Universal Windows application build: set `CMAKE_SYSTEM_NAME` to `WindowsStore` and `CMAKE_SYSTEM_VERSION` to `10.0`.
* **Windows OS 10 Universal Windows application build**. Set `CMAKE_SYSTEM_NAME` to `WindowsStore` and `CMAKE_SYSTEM_VERSION` to `10.0`.
---
**NOTE**
Set `TBB_NO_APPCONTAINER` to `ON` to apply the `/APPCONTAINER:NO` option during the compilation (used for testing).
---
_Note: set `TBB_NO_APPCONTAINER` to `ON` in order to apply `/APPCONTAINER:NO` option during the compilation (used for testing)._
```bash
cmake -DCMAKE_SYSTEM_NAME:STRING=WindowsStore -DCMAKE_SYSTEM_VERSION:STRING=10.0 ..
```
* Universal Windows Driver build: set `TBB_WINDOWS_DRIVER` to `ON` and use static linkage with CRT (see above).
* **Universal Windows OS Driver build**. Set `TBB_WINDOWS_DRIVER` to `ON` and use static linkage with CRT.
```bash
cmake -DTBB_WINDOWS_DRIVER=ON -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded ..
```
#### Example
```bash
cmake -DCMAKE_CXX_COMPILER=icpc -DCMAKE_C_COMPILER=icc -DTBB_TEST=off -DCMAKE_HWLOC_1_11_LIBRARY_PATH=<path_to_hwloc_library_file>/libhwloc.so.15
-DCMAKE_HWLOC_1_11_INCLUDE_PATH=<path_to_hwloc_header_directory> -DCMAKE_INSTALL_PREFIX=<path_to_install_oneTBB>/oneTBB_install ..
make -j8 && make install
```
---
**NOTE**
The library path points to a file, while the include path points to a directory and not to ``hwloc.h``.
---
### Test
#### Build test
Using default ('all') target:
To build a test, use the default target ``all``:
```
cmake --build .
```
or using specific test target:
Or use a specific test target:
```
cmake --build . --target <test> # e.g. test_version
```
#### Run test
#### Run Test
Using CTest:
You can run a test by using CTest:
```bash
ctest
```
or using 'test' target:
Or by using the ``test`` target:
```bash
cmake --build . --target test # currently doesn't work on Windows
cmake --build . --target test # currently does not work on Windows* OS
```
## Sanitizers - сonfigure, build and run
## Installation
See [Installation from Sources](../INSTALL.md) to learn how to install oneTBB.
## Sanitizers - Configure, Build, and Run
```bash
mkdir build
@@ -139,7 +198,7 @@ make -j
ctest -V
```
## Valgrind memcheck - configure, build and run
## Valgrind Memcheck - Configure, Build, and Run
### Prerequisites
* Valgrind tool executable
@@ -151,7 +210,9 @@ cmake -DTBB_VALGRIND_MEMCHECK=ON ..
make -j memcheck-<test name> # or memcheck-all to scan all tests
```
## Test specification (Doxygen)
## Test Specification
Use Doxygen* to generate oneTBB test specification:
```bash
mkdir build
@@ -160,35 +221,12 @@ cmake -DTBB_TEST_SPEC=ON ..
make test_spec
```
## Intallation and packaging
## TBBConfig - Integration of Binary Packages
**NOTE: be careful about installation: avoid commands like `make install` unless you fully understand the consequences.**
It is a configuration module that is used for the integration of prebuilt oneTBB. It consists of two files (``TBBConfig.cmake`` and ``TBBConfigVersion.cmake``) and can be used via the [find_package](https://cmake.org/cmake/help/latest/command/find_package.html) function.
The following install components are supported:
- `runtime` - oneTBB runtime package (core shared libraries and `.dll` files on Windows).
- `devel` - oneTBB development package (header files, CMake integration files, library symbolic links and `.lib` files on Windows).
- `tbb4py` - [oneTBB Module for Python](#onetbb-python-module-support).
How to install specific components after configuration and build:
```bash
cmake -DCOMPONENT=<component> [-DBUILD_TYPE=<build-type>] -P cmake_install.cmake
```
Simple packaging using CPack is supported.
The following commands allow to create a simple portable package which includes header files, libraries and integration files for CMake:
```bash
cmake <options> ..
cpack
```
## TBBConfig - integration of binary packages
It is a configuration module that is used for integration of prebuilt oneTBB. It consists of two files (TBBConfig.cmake and TBBConfigVersion.cmake) and can be used via [find_package](https://cmake.org/cmake/help/latest/command/find_package.html) function.
How to use this module in your CMake project:
1. Let CMake know where to search for TBBConfig, e.g. specify location of TBBConfig.cmake in `TBB_DIR` (for more details about search paths see [find_package](https://cmake.org/cmake/help/latest/command/find_package.html)).
To use this module in your CMake project:
1. Let CMake know where to search for TBBConfig, e.g. specify the location of ``TBBConfig.cmake`` in `TBB_DIR` (for more details about search paths, see [find_package](https://cmake.org/cmake/help/latest/command/find_package.html)).
2. Use [find_package](https://cmake.org/cmake/help/latest/command/find_package.html) to find oneTBB.
3. Use provided variables and/or imported targets (described below) to work with the found oneTBB.
@@ -203,14 +241,14 @@ target_link_libraries(foo TBB::tbb)
oneTBB components can be passed to [find_package](https://cmake.org/cmake/help/latest/command/find_package.html) after keyword ``COMPONENTS`` or ``REQUIRED``.
Use basic names of components (`tbb`, `tbbmalloc`, etc.).
If components are not specified then the default set is used: `tbb`, `tbbmalloc` and ``tbbmalloc_proxy``.
If components are not specified, then the default set is used: `tbb`, `tbbmalloc`, and ``tbbmalloc_proxy``.
If `tbbmalloc_proxy` is requested, `tbbmalloc` component will also be added and set as dependency for `tbbmalloc_proxy`.
If `tbbmalloc_proxy` is requested, the `tbbmalloc` component is also added and set as a dependency for `tbbmalloc_proxy`.
TBBConfig creates [imported targets](https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#imported-targets>) as
shared libraries using the following format: `TBB::<component>` (for example, `TBB::tbb`, `TBB::tbbmalloc`).
shared libraries using the following format: `TBB::<component>`. For example, `TBB::tbb` or `TBB::tbbmalloc`.
Set `TBB_FIND_RELEASE_ONLY` to `TRUE` before calling `find_package` in order to search only for release oneTBB version. This variable helps to avoid simultaneous linkage of release and debug oneTBB versions when CMake configuration is `Debug` but a third-party component depends on release oneTBB version.
To search only for release oneTBB version, set `TBB_FIND_RELEASE_ONLY` to `TRUE` before calling `find_package`. This variable helps to avoid simultaneous linkage of release and debug oneTBB versions when CMake configuration is `Debug,` but a third-party component depends on the release oneTBB version.
Variables set during TBB configuration:
@@ -221,14 +259,14 @@ Variable | Description
`TBB_VERSION` | oneTBB version (format: `<major>.<minor>.<patch>.<tweak>`)
`TBB_IMPORTED_TARGETS` | All created oneTBB imported targets (not supported for builds from source code)
Starting from [oneTBB 2021.1](https://github.com/oneapi-src/oneTBB/releases/tag/v2021.1) GitHub release TBBConfig files in the binary packages are located under `<tbb-root>/lib/cmake/TBB`.
Starting from [oneTBB 2021.1](https://github.com/oneapi-src/oneTBB/releases/tag/v2021.1), GitHub* release TBBConfig files in the binary packages are located under `<tbb-root>/lib/cmake/TBB`.
For example, `TBB_DIR` should be set to `<tbb-root>/lib/cmake/TBB`.
TBBConfig files are automatically created during the build from source code and can be installed together with the library.
Also oneTBB provides a helper function that creates TBBConfig files from predefined templates: see `tbb_generate_config` in `cmake/config_generation.cmake`.
Also, oneTBB provides a helper function that creates TBBConfig files from predefined templates. See `tbb_generate_config` in `cmake/config_generation.cmake`.
## oneTBB Python Module support
`TBB4PY_BUILD` Cmake option provides ability to build Python module for oneTBB.
## oneTBB Python Module Support
The `TBB4PY_BUILD` Cmake option provides the ability to build a Python module for oneTBB.
### Targets:
- `irml` - build IPC RML server
@@ -238,30 +276,30 @@ Also oneTBB provides a helper function that creates TBBConfig files from predefi
- Python version 3.5 or newer
- SWIG version 3.0.6 or newer
## CMake files
## CMake Files
### Compile/link options
### Compile and Link Options
Compile and link options may be specific for certain compilers. This part is handled in `cmake/compilers/*` files.
Options in TBB CMake are handled via variables in two ways for convenience:
* by options group
* by specific option
* by the specific option
#### Options group
#### Options Group
Naming convention is the following: `TBB_<SCOPE>_<STAGE>_<CATEGORY>`, where
Naming convention is the following: `TBB_<SCOPE>_<STAGE>_<CATEGORY>`, where:
* `<SCOPE>` could be
* `<SCOPE>` can be:
* `LIB` - options applied during libraries build.
* `TEST` - options applied during test build.
* `BENCH` - options applied during benchmarks build.
* `COMMON` - options applied during all (libraries, test, benchmarks) builds.
* `<STAGE>` could be
* `<STAGE>` can be:
* `COMPILE` - options applied during the compilation.
* `LINK` - options applied during the linkage.
* `<CATEGORY>` could be
* `<CATEGORY>` can be:
* `FLAGS` - list of flags
* `LIBS` - list of libraries
@@ -269,16 +307,17 @@ Naming convention is the following: `TBB_<SCOPE>_<STAGE>_<CATEGORY>`, where
Variable | Description
--- | ---
`TBB_COMMON_COMPILE_FLAGS` | Applied to libraries, tests and benchmarks as compile options
`TBB_COMMON_COMPILE_FLAGS` | Applied to libraries, tests, and benchmarks as compile options
`TBB_LIB_LINK_FLAGS` | Applied to libraries as link options
`TBB_LIB_LINK_LIBS ` | Applied to libraries as link libraries
`TBB_TEST_COMPILE_FLAGS` | Applied to tests as compile options
Specify the `LINK` options prefixed with a dash(-) for MSVC(Visual Studio) compiler with CMake < 3.13 to avoid issues caused by `target_link_libraries` CMake command usage.
#### Specific options
#### Specific Options
If the option used only in part of the places (library, tests, benchmarks) as well as adding this option to the group of other options is not possible,
If the option is used only in part of the places (library, tests, benchmarks) and adding this option to the group of other options is not possible,
then the option must be named using common sense.
Warnings supperssions should be added into `TBB_WARNING_SUPPRESS` variable which is applied during the compilation of libraries, tests and benchmarks.
Additional warnings should be added into `TBB_WARNING_TEST_FLAGS` variable which is applied during the compilation of tests.
Warning suppressions should be added to the `TBB_WARNING_SUPPRESS` variable, which is applied during the compilation of libraries, tests, and benchmarks.
Additional warnings should be added to the `TBB_WARNING_TEST_FLAGS` variable, which is applied during the compilation of tests.
+10 -4
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2021 Intel Corporation
# Copyright (c) 2020-2022 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -31,10 +31,16 @@ if (NOT TBB_STRICT AND COMMAND tbb_remove_compile_flag)
tbb_remove_compile_flag(-Werror)
endif()
# Enable Intel(R) Transactional Synchronization Extensions (-mrtm) on relevant processors
if (NOT "${CMAKE_OSX_ARCHITECTURES}" MATCHES "^arm64$" AND CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|AMD64)") # OSX systems are 64-bit only
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -mrtm)
# Enable Intel(R) Transactional Synchronization Extensions (-mrtm) and WAITPKG instructions support (-mwaitpkg) on relevant processors
if (CMAKE_OSX_ARCHITECTURES)
set(_tbb_target_architectures "${CMAKE_OSX_ARCHITECTURES}")
else()
set(_tbb_target_architectures "${CMAKE_SYSTEM_PROCESSOR}")
endif()
if ("${_tbb_target_architectures}" MATCHES "(x86_64|amd64|AMD64)") # OSX systems are 64-bit only
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -mrtm $<$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},12.0>>:-mwaitpkg>)
endif()
unset(_tbb_target_architectures)
# TBB malloc settings
set(TBBMALLOC_LIB_COMPILE_FLAGS -fno-rtti -fno-exceptions)
+33 -11
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2021 Intel Corporation
# Copyright (c) 2020-2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,15 +12,31 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if (APPLE)
if (EMSCRIPTEN)
set(TBB_EMSCRIPTEN 1)
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -fexceptions)
set(TBB_TEST_LINK_FLAGS ${TBB_COMMON_LINK_FLAGS} -fexceptions -sINITIAL_MEMORY=65536000 -sALLOW_MEMORY_GROWTH=1 -sEXIT_RUNTIME=1)
if (NOT EMSCRIPTEN_WITHOUT_PTHREAD)
set_property(TARGET Threads::Threads PROPERTY INTERFACE_LINK_LIBRARIES "-pthread")
endif()
endif()
if (MINGW)
set(TBB_LINK_DEF_FILE_FLAG "")
set(TBB_DEF_FILE_PREFIX "")
elseif (APPLE)
set(TBB_LINK_DEF_FILE_FLAG -Wl,-exported_symbols_list,)
set(TBB_DEF_FILE_PREFIX mac${TBB_ARCH})
# For correct ucontext.h structures layout
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -D_XOPEN_SOURCE)
elseif (MSVC)
include(${CMAKE_CURRENT_LIST_DIR}/MSVC.cmake)
return()
else()
set(TBB_LINK_DEF_FILE_FLAG -Wl,--version-script=)
set(TBB_DEF_FILE_PREFIX lin${TBB_ARCH})
set(TBB_TEST_COMPILE_FLAGS ${TBB_TEST_COMPILE_FLAGS} $<$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},10.0>>:-ffp-model=precise>)
endif()
# Depfile options (e.g. -MD) are inserted automatically in some cases.
@@ -38,22 +54,28 @@ if (NOT TBB_STRICT AND COMMAND tbb_remove_compile_flag)
endif()
# Enable Intel(R) Transactional Synchronization Extensions (-mrtm) and WAITPKG instructions support (-mwaitpkg) on relevant processors
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86|AMD64)")
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(AMD64|amd64|i.86|x86)" AND NOT EMSCRIPTEN)
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -mrtm $<$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},12.0>>:-mwaitpkg>)
endif()
set(TBB_COMMON_LINK_LIBS dl)
# Clang flags to prevent compiler from optimizing out security checks
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -Wformat -Wformat-security -Werror=format-security -fPIC $<$<NOT:$<BOOL:${EMSCRIPTEN}>>:-fstack-protector-strong>)
if (ANDROID_PLATFORM)
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} $<$<NOT:$<CONFIG:Debug>>:-D_FORTIFY_SOURCE=2>)
# -z switch is not supported on MacOS
if (NOT APPLE)
set(TBB_LIB_LINK_FLAGS ${TBB_LIB_LINK_FLAGS} -Wl,-z,relro,-z,now)
endif()
# Enabling LTO on Android causes the NDK bug.
# NDK throws the warning: "argument unused during compilation: '-Wa,--noexecstack'"
if (NOT ANDROID_PLATFORM)
set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
set(TBB_COMMON_LINK_LIBS ${CMAKE_DL_LIBS})
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} $<$<NOT:$<CONFIG:Debug>>:-D_FORTIFY_SOURCE=2>)
if (MINGW)
list(APPEND TBB_COMMON_COMPILE_FLAGS -U__STRICT_ANSI__)
endif()
set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
# TBB malloc settings
set(TBBMALLOC_LIB_COMPILE_FLAGS -fno-rtti -fno-exceptions)
+26 -5
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2021 Intel Corporation
# Copyright (c) 2020-2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,7 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if (APPLE)
if (MINGW)
set(TBB_LINK_DEF_FILE_FLAG "")
set(TBB_DEF_FILE_PREFIX "")
elseif (APPLE)
set(TBB_LINK_DEF_FILE_FLAG -Wl,-exported_symbols_list,)
set(TBB_DEF_FILE_PREFIX mac${TBB_ARCH})
@@ -33,11 +36,11 @@ if (NOT CMAKE_GENERATOR MATCHES "Ninja" AND NOT CMAKE_CXX_DEPENDS_USE_COMPILER)
endif()
# Enable Intel(R) Transactional Synchronization Extensions (-mrtm) and WAITPKG instructions support (-mwaitpkg) on relevant processors
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86|AMD64)")
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(AMD64|amd64|i.86|x86)")
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -mrtm $<$<AND:$<NOT:$<CXX_COMPILER_ID:Intel>>,$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},11.0>>>:-mwaitpkg>)
endif()
set(TBB_COMMON_LINK_LIBS dl)
set(TBB_COMMON_LINK_LIBS ${CMAKE_DL_LIBS})
# Ignore -Werror set through add_compile_options() or added to CMAKE_CXX_FLAGS if TBB_STRICT is disabled.
if (NOT TBB_STRICT AND COMMAND tbb_remove_compile_flag)
@@ -47,16 +50,34 @@ endif()
if (NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL Intel)
# gcc 6.0 and later have -flifetime-dse option that controls elimination of stores done outside the object lifetime
set(TBB_DSE_FLAG $<$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},6.0>>:-flifetime-dse=1>)
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} $<$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},8.0>>:-fstack-clash-protection>)
endif()
# Workaround for heavy tests and too many symbols in debug (rellocation truncated to fit: R_MIPS_CALL16)
if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "mips")
set(TBB_TEST_COMPILE_FLAGS ${TBB_TEST_COMPILE_FLAGS} -DTBB_TEST_LOW_WORKLOAD $<$<CONFIG:DEBUG>:-mxgot>)
set(TBB_TEST_COMPILE_FLAGS ${TBB_TEST_COMPILE_FLAGS} -DTBB_TEST_LOW_WORKLOAD $<$<CONFIG:DEBUG>:-fPIE -mxgot>)
set(TBB_TEST_LINK_FLAGS ${TBB_TEST_LINK_FLAGS} $<$<CONFIG:DEBUG>:-pie>)
endif()
set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
if (MINGW AND CMAKE_SYSTEM_PROCESSOR MATCHES "i.86")
list (APPEND TBB_COMMON_COMPILE_FLAGS -msse2)
endif ()
# Gnu flags to prevent compiler from optimizing out security checks
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -fno-strict-overflow -fno-delete-null-pointer-checks -fwrapv)
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -Wformat -Wformat-security -Werror=format-security
-fstack-protector-strong )
# -z switch is not supported on MacOS and MinGW
if (NOT APPLE AND NOT MINGW)
set(TBB_LIB_LINK_FLAGS ${TBB_LIB_LINK_FLAGS} -Wl,-z,relro,-z,now,-z,noexecstack)
endif()
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} $<$<NOT:$<CONFIG:Debug>>:-D_FORTIFY_SOURCE=2> )
# TBB malloc settings
set(TBBMALLOC_LIB_COMPILE_FLAGS -fno-rtti -fno-exceptions)
set(TBB_OPENMP_FLAG -fopenmp)
+3 -5
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2021 Intel Corporation
# Copyright (c) 2020-2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -26,10 +26,8 @@ elseif (APPLE)
set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-ipo>)
else()
include(${CMAKE_CURRENT_LIST_DIR}/GNU.cmake)
set(TBB_LIB_LINK_FLAGS ${TBB_LIB_LINK_FLAGS} -static-intel -Wl,-z,relro,-z,now,)
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -fstack-protector -Wformat -Wformat-security
$<$<NOT:$<CONFIG:Debug>>:-qno-opt-report-embed -D_FORTIFY_SOURCE=2>
$<$<EQUAL:${TBB_ARCH},32>:-falign-stack=maintain-16-byte>)
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} $<$<EQUAL:${TBB_ARCH},32>:-falign-stack=maintain-16-byte>)
set(TBB_LIB_LINK_FLAGS ${TBB_LIB_LINK_FLAGS} -static-intel)
set(TBB_OPENMP_FLAG -qopenmp)
set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-ipo>)
endif()
+3 -5
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2021 Intel Corporation
# Copyright (c) 2020-2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,14 +14,12 @@
if (WIN32)
include(${CMAKE_CURRENT_LIST_DIR}/MSVC.cmake)
set(TBB_OPENMP_FLAG /Qopenmp)
set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:/Qipo>)
set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:/INCREMENTAL:NO>)
else()
include(${CMAKE_CURRENT_LIST_DIR}/Clang.cmake)
set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-ipo>)
set(TBB_OPENMP_FLAG -qopenmp)
endif()
set(TBB_IPO_LINK_FLAGS ${TBB_IPO_LINK_FLAGS} ${TBB_IPO_COMPILE_FLAGS})
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86|AMD64)")
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -mrtm -mwaitpkg)
endif()
+25 -8
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2021 Intel Corporation
# Copyright (c) 2020-2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,10 +19,12 @@ set(TBB_DEF_FILE_PREFIX win${TBB_ARCH})
# TODO: consider use of CMP0092 CMake policy.
string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
# Warning suppression C4324: structure was padded due to alignment specifier
set(TBB_WARNING_LEVEL $<$<NOT:$<CXX_COMPILER_ID:Intel>>:/W4> $<$<BOOL:${TBB_STRICT}>:/WX>)
# Warning suppression C4324: structure was padded due to alignment specifier
set(TBB_WARNING_SUPPRESS /wd4324)
set(TBB_TEST_COMPILE_FLAGS /bigobj)
set(TBB_TEST_COMPILE_FLAGS ${TBB_TEST_COMPILE_FLAGS} /bigobj)
if (MSVC_VERSION LESS_EQUAL 1900)
# Warning suppression C4503 for VS2015 and earlier:
# decorated name length exceeded, name was truncated.
@@ -31,7 +33,13 @@ if (MSVC_VERSION LESS_EQUAL 1900)
set(TBB_TEST_COMPILE_FLAGS ${TBB_TEST_COMPILE_FLAGS} /wd4503)
endif()
set(TBB_LIB_COMPILE_FLAGS -D_CRT_SECURE_NO_WARNINGS /GS)
set(TBB_COMMON_COMPILE_FLAGS /volatile:iso /FS)
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} /volatile:iso /FS /EHsc)
set(TBB_LIB_LINK_FLAGS ${TBB_LIB_LINK_FLAGS} /DYNAMICBASE /NXCOMPAT)
if (TBB_ARCH EQUAL 32)
set(TBB_LIB_LINK_FLAGS ${TBB_LIB_LINK_FLAGS} /SAFESEH )
endif()
# Ignore /WX set through add_compile_options() or added to CMAKE_CXX_FLAGS if TBB_STRICT is disabled.
if (NOT TBB_STRICT AND COMMAND tbb_remove_compile_flag)
@@ -40,7 +48,7 @@ endif()
if (WINDOWS_STORE OR TBB_WINDOWS_DRIVER)
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} /D_WIN32_WINNT=0x0A00)
set(TBB_COMMON_LINK_FLAGS /NODEFAULTLIB:kernel32.lib /INCREMENTAL:NO)
set(TBB_COMMON_LINK_FLAGS -NODEFAULTLIB:kernel32.lib -INCREMENTAL:NO)
set(TBB_COMMON_LINK_LIBS OneCore.lib)
endif()
@@ -55,7 +63,7 @@ if (WINDOWS_STORE)
string(REGEX REPLACE "WindowsApp.lib" "" CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES}")
if (TBB_NO_APPCONTAINER)
set(TBB_LIB_LINK_FLAGS ${TBB_LIB_LINK_FLAGS} /APPCONTAINER:NO)
set(TBB_LIB_LINK_FLAGS ${TBB_LIB_LINK_FLAGS} -APPCONTAINER:NO)
endif()
endif()
@@ -69,7 +77,16 @@ if (TBB_WINDOWS_DRIVER)
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} /D _UNICODE /DUNICODE /DWINAPI_FAMILY=WINAPI_FAMILY_APP /D__WRL_NO_DEFAULT_LIB__)
endif()
set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:/GL>)
set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:/LTCG /INCREMENTAL:NO>)
if (CMAKE_CXX_COMPILER_ID MATCHES "(Clang|IntelLLVM)")
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86|AMD64|i.86)")
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -mrtm -mwaitpkg)
endif()
set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
else()
set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:/GL>)
set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:-LTCG> $<$<NOT:$<CONFIG:Debug>>:-INCREMENTAL:NO>)
endif()
set(TBB_OPENMP_FLAG /openmp)
set(TBB_OPENMP_NO_LINK_FLAG TRUE) # TBB_OPENMP_FLAG will be used only on compilation but not on linkage
+18
View File
@@ -0,0 +1,18 @@
# Copyright (c) 2021 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(${CMAKE_CURRENT_SOURCE_DIR}/cmake/compilers/GNU.cmake)
# Remove dl library not present in QNX systems
unset(TBB_COMMON_LINK_LIBS)
+60 -30
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2021 Intel Corporation
# Copyright (c) 2020-2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ function(tbb_generate_config)
set(options HANDLE_SUBDIRS)
set(oneValueArgs INSTALL_DIR
SYSTEM_NAME
LIB_REL_PATH INC_REL_PATH DLL_REL_PATH
LIB_REL_PATH INC_REL_PATH
VERSION
TBB_BINARY_VERSION
TBBMALLOC_BINARY_VERSION
@@ -35,11 +35,14 @@ function(tbb_generate_config)
file(MAKE_DIRECTORY ${config_install_dir})
file(TO_CMAKE_PATH "${tbb_gen_cfg_LIB_REL_PATH}" TBB_LIB_REL_PATH)
file(TO_CMAKE_PATH "${tbb_gen_cfg_DLL_REL_PATH}" TBB_DLL_REL_PATH)
file(TO_CMAKE_PATH "${tbb_gen_cfg_INC_REL_PATH}" TBB_INC_REL_PATH)
set(TBB_VERSION ${tbb_gen_cfg_VERSION})
set(_tbb_pc_lib_name tbb)
set(_prefix_for_pc_file "\${pcfiledir}/../../")
set(_includedir_for_pc_file "\${prefix}/include")
set(TBB_COMPONENTS_BIN_VERSION "
set(_tbb_bin_version ${tbb_gen_cfg_TBB_BINARY_VERSION})
set(_tbbmalloc_bin_version ${tbb_gen_cfg_TBBMALLOC_BINARY_VERSION})
@@ -50,37 +53,61 @@ set(_tbbbind_bin_version ${tbb_gen_cfg_TBBBIND_BINARY_VERSION})
if (tbb_gen_cfg_SYSTEM_NAME STREQUAL "Linux")
set(TBB_LIB_PREFIX "lib")
set(TBB_LIB_EXT "so.\${_\${_tbb_component}_bin_version}")
set(TBB_IMPLIB_RELEASE "")
set(TBB_IMPLIB_DEBUG "")
if (tbb_gen_cfg_HANDLE_SUBDIRS)
set(TBB_HANDLE_SUBDIRS "
if (CMAKE_SIZEOF_VOID_P STREQUAL \"8\")
set(_tbb_subdir intel64/gcc4.8)
else ()
set(_tbb_subdir ia32/gcc4.8)
endif()
set (TBB_HANDLE_IMPLIB "
set (_tbb_release_dll \${_tbb_release_lib})
set (_tbb_debug_dll \${_tbb_debug_lib})
")
if (tbb_gen_cfg_HANDLE_SUBDIRS)
set(TBB_HANDLE_SUBDIRS "set(_tbb_subdir gcc4.8)")
set(_libdir_for_pc_file "\${prefix}/lib/intel64/gcc4.8")
set(_tbb_pc_extra_libdir "-L\${prefix}/lib")
configure_file(${_tbb_gen_cfg_path}/../integration/pkg-config/tbb.pc.in ${config_install_dir}/tbb.pc @ONLY)
set(_libdir_for_pc_file "\${prefix}/lib/ia32/gcc4.8")
set(_tbb_pc_extra_libdir "-L\${prefix}/lib32")
configure_file(${_tbb_gen_cfg_path}/../integration/pkg-config/tbb.pc.in ${config_install_dir}/tbb32.pc @ONLY)
endif()
elseif (tbb_gen_cfg_SYSTEM_NAME STREQUAL "Darwin")
set(TBB_LIB_PREFIX "lib")
set(TBB_LIB_EXT "\${_\${_tbb_component}_bin_version}.dylib")
set(TBB_IMPLIB_RELEASE "")
set(TBB_IMPLIB_DEBUG "")
set (TBB_HANDLE_IMPLIB "
set (_tbb_release_dll \${_tbb_release_lib})
set (_tbb_debug_dll \${_tbb_debug_lib})
")
set(_libdir_for_pc_file "\${prefix}/lib")
configure_file(${_tbb_gen_cfg_path}/../integration/pkg-config/tbb.pc.in ${config_install_dir}/tbb.pc @ONLY)
elseif (tbb_gen_cfg_SYSTEM_NAME STREQUAL "Windows")
set(TBB_LIB_PREFIX "")
set(TBB_LIB_EXT "dll")
set(TBB_LIB_EXT "lib")
set(TBB_COMPILE_DEFINITIONS "
INTERFACE_COMPILE_DEFINITIONS \"__TBB_NO_IMPLICIT_LINKAGE=1\"")
# .lib - installed to TBB_LIB_REL_PATH (e.g. <prefix>/lib) and are passed as IMPORTED_IMPLIB_<CONFIG> property to target
# .dll - installed to <prefix>/bin or <prefix>/redist and are passed as IMPORTED_LOCATION_<CONFIG> property to target
set (TBB_HANDLE_IMPLIB "
find_file(_tbb_release_dll
NAMES \${_tbb_component}\${_bin_version}.dll
PATHS \${_tbb_root}
PATH_SUFFIXES \"redist/\${_tbb_intel_arch}/\${_tbb_subdir}\" \"bin\${_tbb_arch_suffix}/\${_tbb_subdir}\" \"bin\${_tbb_arch_suffix}/\" \"bin\"
NO_DEFAULT_PATH
)
# .lib files installed to TBB_LIB_REL_PATH (e.g. <prefix>/lib);
# .dll files installed to TBB_DLL_REL_PATH (e.g. <prefix>/bin);
# Expand TBB_LIB_REL_PATH here in IMPORTED_IMPLIB property and
# redefine it with TBB_DLL_REL_PATH value to properly fill IMPORTED_LOCATION property in TBBConfig.cmake.in template.
set(TBB_IMPLIB_RELEASE "
IMPORTED_IMPLIB_RELEASE \"\${_tbb_root}/${TBB_LIB_REL_PATH}/\${_tbb_subdir}/\${_tbb_component}\${_bin_version}.lib\"")
set(TBB_IMPLIB_DEBUG "
IMPORTED_IMPLIB_DEBUG \"\${_tbb_root}/${TBB_LIB_REL_PATH}/\${_tbb_subdir}/\${_tbb_component}\${_bin_version}_debug.lib\"")
set(TBB_LIB_REL_PATH ${TBB_DLL_REL_PATH})
if (EXISTS \"\${_tbb_debug_lib}\")
find_file(_tbb_debug_dll
NAMES \${_tbb_component}\${_bin_version}_debug.dll
PATHS \${_tbb_root}
PATH_SUFFIXES \"redist/\${_tbb_intel_arch}/\${_tbb_subdir}\" \"bin\${_tbb_arch_suffix}/\${_tbb_subdir}\" \"bin\${_tbb_arch_suffix}/\" \"bin\"
NO_DEFAULT_PATH
)
endif()
")
set(TBB_IMPLIB_RELEASE "
IMPORTED_IMPLIB_RELEASE \"\${_tbb_release_lib}\"")
set(TBB_IMPLIB_DEBUG "
IMPORTED_IMPLIB_DEBUG \"\${_tbb_debug_lib}\"")
if (tbb_gen_cfg_HANDLE_SUBDIRS)
set(TBB_HANDLE_SUBDIRS "
@@ -88,13 +115,16 @@ set(_tbb_subdir vc14)
if (WINDOWS_STORE)
set(_tbb_subdir \${_tbb_subdir}_uwp)
endif()
if (CMAKE_SIZEOF_VOID_P STREQUAL \"8\")
set(_tbb_subdir intel64/\${_tbb_subdir})
else ()
set(_tbb_subdir ia32/\${_tbb_subdir})
endif()
")
set(_tbb_pc_lib_name ${_tbb_pc_lib_name}${TBB_BINARY_VERSION})
set(_libdir_for_pc_file "\${prefix}/lib/intel64/vc14")
set(_tbb_pc_extra_libdir "-L\${prefix}/lib")
configure_file(${_tbb_gen_cfg_path}/../integration/pkg-config/tbb.pc.in ${config_install_dir}/tbb.pc @ONLY)
set(_libdir_for_pc_file "\${prefix}/lib/ia32/vc14")
set(_tbb_pc_extra_libdir "-L\${prefix}/lib32")
configure_file(${_tbb_gen_cfg_path}/../integration/pkg-config/tbb.pc.in ${config_install_dir}/tbb32.pc @ONLY)
endif()
set(TBB_HANDLE_BIN_VERSION "
+8 -10
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2021 Intel Corporation
# Copyright (c) 2020-2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
list(APPEND HWLOC_REQUIRED_VERSIONS 1_11 2 2_4)
list(APPEND HWLOC_REQUIRED_VERSIONS 1_11 2 2_5)
foreach(hwloc_version ${HWLOC_REQUIRED_VERSIONS})
if (NOT WIN32)
@@ -46,21 +46,19 @@ endforeach()
unset(HWLOC_TARGET_NAME)
if (NOT HWLOC_TARGET_EXPLICITLY_DEFINED AND
# No hwloc auto detection for cross compilation
NOT CMAKE_CROSSCOMPILING
NOT TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH
)
find_package(PkgConfig QUIET)
if (PKG_CONFIG_FOUND)
pkg_search_module(HWLOC hwloc)
if (HWLOC_FOUND)
if (PKG_CONFIG_FOUND AND NOT CMAKE_VERSION VERSION_LESS 3.6)
pkg_search_module(HWLOC hwloc IMPORTED_TARGET)
if (TARGET PkgConfig::HWLOC)
if (HWLOC_VERSION VERSION_LESS 2)
set(TBBBIND_LIBRARY_NAME tbbbind)
elseif(HWLOC_VERSION VERSION_LESS 2.4)
elseif(HWLOC_VERSION VERSION_LESS 2.5)
set(TBBBIND_LIBRARY_NAME tbbbind_2_0)
else()
set(TBBBIND_LIBRARY_NAME tbbbind_2_4)
set(TBBBIND_LIBRARY_NAME tbbbind_2_5)
endif()
endif()
endif()
endif()
+11 -3
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2021 Intel Corporation
# Copyright (c) 2020-2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -31,10 +31,18 @@ endif()
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/memcheck)
function(_tbb_run_memcheck test_target)
function(_tbb_run_memcheck test_target subdir)
set(target_name memcheck-${test_target})
if(${subdir} STREQUAL "tbbmalloc")
# Valgring intercepts all allocation symbols with its own by default,
# so it disables using tbbmalloc. In case of tbbmalloc tests
# intercept allocation symbols only in the default system libraries,
# but not in any other shared library or the executable
# defining public malloc or operator new related functions.
set(option "--soname-synonyms=somalloc=nouserintercepts")
endif()
add_custom_target(${target_name}
COMMAND ${VALGRIND_EXE} --leak-check=full --show-leak-kinds=all --log-file=${CMAKE_BINARY_DIR}/memcheck/${target_name}.log -v $<TARGET_FILE:${test_target}>)
COMMAND ${VALGRIND_EXE} ${option} --leak-check=full --show-leak-kinds=all --log-file=${CMAKE_BINARY_DIR}/memcheck/${target_name}.log -v $<TARGET_FILE:${test_target}>)
add_dependencies(memcheck-all ${target_name})
endfunction()
+5 -2
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2021 Intel Corporation
# Copyright (c) 2020-2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,4 +18,7 @@ set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_VERSION "${TBB_VERSION}")
string(TOLOWER ${CPACK_PACKAGE_NAME}-${PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}_${TBB_OUTPUT_DIR_BASE}_${CMAKE_BUILD_TYPE} CPACK_PACKAGE_FILE_NAME)
set(CPACK_GENERATOR ZIP)
include(CPack)
# Note: this is an internal non-documented variable set by CPack
if (NOT CPack_CMake_INCLUDED)
include(CPack)
endif()
+1
View File
@@ -14,6 +14,7 @@
# Add code signing as post-install step.
if (DEFINED TBB_SIGNTOOL)
file(TO_CMAKE_PATH "${TBB_SIGNTOOL}" TBB_SIGNTOOL)
install(CODE "
file(GLOB_RECURSE FILES_TO_SIGN \${CMAKE_INSTALL_PREFIX}/*${CMAKE_SHARED_LIBRARY_SUFFIX})
execute_process(COMMAND ${TBB_SIGNTOOL} \${FILES_TO_SIGN} ${TBB_SIGNTOOL_ARGS})
+31
View File
@@ -0,0 +1,31 @@
# Copyright (c) 2023 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(CheckSymbolExists)
if (UNIX)
set(CMAKE_REQUIRED_FLAGS -Wno-deprecated-declarations)
if (APPLE)
set(CMAKE_REQUIRED_DEFINITIONS -D_XOPEN_SOURCE)
endif()
check_symbol_exists("getcontext" "ucontext.h" _tbb_have_ucontext)
if (NOT _tbb_have_ucontext)
set(TBB_RESUMABLE_TASKS_USE_THREADS "__TBB_RESUMABLE_TASKS_USE_THREADS=1")
endif()
unset(_tbb_have_ucontext)
unset(CMAKE_REQUIRED_DEFINITIONS)
unset(CMAKE_REQUIRED_FLAGS)
endif()
+6 -1
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2021 Intel Corporation
# Copyright (c) 2020-2022 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -34,5 +34,10 @@ if (NOT ${FLAG_DISPLAY_NAME})
"please try another compiler or omit TBB_SANITIZE variable")
endif()
set(TBB_TESTS_ENVIRONMENT ${TBB_TESTS_ENVIRONMENT}
"TSAN_OPTIONS=suppressions=${CMAKE_CURRENT_SOURCE_DIR}/cmake/suppressions/tsan.suppressions"
"LSAN_OPTIONS=suppressions=${CMAKE_CURRENT_SOURCE_DIR}/cmake/suppressions/lsan.suppressions")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TBB_SANITIZE_OPTION}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TBB_SANITIZE_OPTION}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${TBB_SANITIZE_OPTION}")
+3 -4
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2021 Intel Corporation
# Copyright (c) 2020-2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@ set(TBB_ROOT_REL_PATH "../../..")
# Paths relative to TBB root directory
set(INC_REL_PATH "include")
set(LIB_REL_PATH "lib")
set(DLL_REL_PATH "redist")
# Parse version info
file(READ ${CMAKE_CURRENT_LIST_DIR}/../../include/oneapi/tbb/version.h _tbb_version_info)
@@ -45,6 +44,6 @@ set(COMMON_ARGS
)
tbb_generate_config(INSTALL_DIR ${INSTALL_DIR}/linux SYSTEM_NAME Linux HANDLE_SUBDIRS ${COMMON_ARGS})
tbb_generate_config(INSTALL_DIR ${INSTALL_DIR}/windows SYSTEM_NAME Windows HANDLE_SUBDIRS DLL_REL_PATH ${DLL_REL_PATH} ${COMMON_ARGS})
tbb_generate_config(INSTALL_DIR ${INSTALL_DIR}/darwin SYSTEM_NAME Darwin ${COMMON_ARGS})
tbb_generate_config(INSTALL_DIR ${INSTALL_DIR}/windows SYSTEM_NAME Windows HANDLE_SUBDIRS ${COMMON_ARGS})
tbb_generate_config(INSTALL_DIR ${INSTALL_DIR}/darwin SYSTEM_NAME Darwin ${COMMON_ARGS})
message(STATUS "TBBConfig files were created in ${INSTALL_DIR}")
+2
View File
@@ -0,0 +1,2 @@
# LSAN suppression for ltdl library known issue.
leak:libltdl.so
+4
View File
@@ -0,0 +1,4 @@
# TSAN suppression for known issues.
# Possible data race during ittnotify initialization. Low impact.
race:__itt_nullify_all_pointers
race:__itt_init_ittlib
+37 -7
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2017-2021 Intel Corporation
# Copyright (c) 2017-2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -43,14 +43,38 @@ if (NOT _tbbmalloc_proxy_ix EQUAL -1)
set(TBB_FIND_REQUIRED_tbbmalloc ${TBB_FIND_REQUIRED_tbbmalloc_proxy})
endif()
unset(_tbbmalloc_proxy_ix)
if (CMAKE_SIZEOF_VOID_P STREQUAL "8")
set(_tbb_intel_arch intel64)
else ()
set(_tbb_intel_arch ia32)
set(_tbb_arch_suffix 32)
endif()
@TBB_HANDLE_SUBDIRS@
foreach (_tbb_component ${TBB_FIND_COMPONENTS})
unset(_tbb_release_dll CACHE)
unset(_tbb_debug_dll CACHE)
unset(_tbb_release_lib CACHE)
unset(_tbb_debug_lib CACHE)
set(TBB_${_tbb_component}_FOUND 0)
@TBB_HANDLE_BIN_VERSION@
get_filename_component(_tbb_release_lib "${_tbb_root}/@TBB_LIB_REL_PATH@/${_tbb_subdir}/@TBB_LIB_PREFIX@${_tbb_component}${_bin_version}.@TBB_LIB_EXT@" ABSOLUTE)
find_library(_tbb_release_lib
NAMES @TBB_LIB_PREFIX@${_tbb_component}${_bin_version}.@TBB_LIB_EXT@
PATHS ${_tbb_root}
PATH_SUFFIXES "@TBB_LIB_REL_PATH@/${_tbb_intel_arch}/${_tbb_subdir}" "@TBB_LIB_REL_PATH@${_tbb_arch_suffix}/${_tbb_subdir}" "@TBB_LIB_REL_PATH@${_tbb_arch_suffix}" "@TBB_LIB_REL_PATH@"
NO_DEFAULT_PATH
)
if (NOT TBB_FIND_RELEASE_ONLY)
get_filename_component(_tbb_debug_lib "${_tbb_root}/@TBB_LIB_REL_PATH@/${_tbb_subdir}/@TBB_LIB_PREFIX@${_tbb_component}${_bin_version}_debug.@TBB_LIB_EXT@" ABSOLUTE)
find_library(_tbb_debug_lib
NAMES @TBB_LIB_PREFIX@${_tbb_component}${_bin_version}_debug.@TBB_LIB_EXT@
PATHS ${_tbb_root}
PATH_SUFFIXES "@TBB_LIB_REL_PATH@/${_tbb_intel_arch}/${_tbb_subdir}" "@TBB_LIB_REL_PATH@${_tbb_arch_suffix}/${_tbb_subdir}" "@TBB_LIB_REL_PATH@${_tbb_arch_suffix}" "@TBB_LIB_REL_PATH@"
NO_DEFAULT_PATH
)
endif()
if (EXISTS "${_tbb_release_lib}" OR EXISTS "${_tbb_debug_lib}")
@@ -63,15 +87,17 @@ foreach (_tbb_component ${TBB_FIND_COMPONENTS})
unset(_tbb_current_realpath)
unset(_tbb_include_dir)
if (EXISTS "${_tbb_release_lib}")
@TBB_HANDLE_IMPLIB@
if (EXISTS "${_tbb_release_dll}")
set_target_properties(TBB::${_tbb_component} PROPERTIES
IMPORTED_LOCATION_RELEASE "${_tbb_release_lib}"@TBB_IMPLIB_RELEASE@)
IMPORTED_LOCATION_RELEASE "${_tbb_release_dll}"@TBB_IMPLIB_RELEASE@)
set_property(TARGET TBB::${_tbb_component} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
endif()
if (EXISTS "${_tbb_debug_lib}")
if (EXISTS "${_tbb_debug_dll}")
set_target_properties(TBB::${_tbb_component} PROPERTIES
IMPORTED_LOCATION_DEBUG "${_tbb_debug_lib}"@TBB_IMPLIB_DEBUG@)
IMPORTED_LOCATION_DEBUG "${_tbb_debug_dll}"@TBB_IMPLIB_DEBUG@)
set_property(TARGET TBB::${_tbb_component} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
endif()
@@ -93,6 +119,10 @@ foreach (_tbb_component ${TBB_FIND_COMPONENTS})
endif()
endforeach()
list(REMOVE_DUPLICATES TBB_IMPORTED_TARGETS)
unset(_tbb_release_dll)
unset(_tbb_debug_dll)
unset(_tbb_release_lib)
unset(_tbb_debug_lib)
unset(_tbb_root)
unset(_tbb_intel_arch)
unset(_tbb_arch_suffix)
+34
View File
@@ -0,0 +1,34 @@
# Copyright (c) 2023 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.
# Prevent double invocation.
if (RISCV_TOOLCHAIN_INCLUDED)
return()
endif()
set(RISCV_TOOLCHAIN_INCLUDED TRUE)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR riscv)
# User can use -DCMAKE_FIND_ROOT_PATH to specific toolchain path
set(CMAKE_C_COMPILER ${CMAKE_FIND_ROOT_PATH}/bin/riscv64-unknown-linux-gnu-clang)
set(CMAKE_CXX_COMPILER ${CMAKE_FIND_ROOT_PATH}/bin/riscv64-unknown-linux-gnu-clang++)
set(CMAKE_LINKER ${CMAKE_FIND_ROOT_PATH}/bin/riscv64-unknown-linux-gnu-ld)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# Most linux on riscv64 support rv64imafd_zba_zbb extensions
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=rv64imafd_zba_zbb -mabi=lp64d " CACHE INTERNAL "")
+45 -19
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2021 Intel Corporation
# Copyright (c) 2020-2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,27 +18,53 @@ macro(tbb_remove_compile_flag flag)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY COMPILE_OPTIONS ${_tbb_compile_options})
unset(_tbb_compile_options)
if (CMAKE_CXX_FLAGS)
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
string(REGEX REPLACE "(^|[ \t\r\n]+)${flag}($|[ \t\r\n]+)" " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
endif()
endmacro()
macro(tbb_install_target target)
install(TARGETS ${target}
EXPORT TBBTargets
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
NAMELINK_SKIP
COMPONENT runtime
RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT runtime
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT devel)
if (TBB_INSTALL)
install(TARGETS ${target}
EXPORT TBBTargets
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
NAMELINK_SKIP
COMPONENT runtime
RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT runtime
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT devel)
install(TARGETS ${target}
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
NAMELINK_ONLY
COMPONENT devel)
if (BUILD_SHARED_LIBS)
install(TARGETS ${target}
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
NAMELINK_ONLY
COMPONENT devel)
endif()
if (MSVC AND BUILD_SHARED_LIBS)
install(FILES $<TARGET_PDB_FILE:${target}>
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT devel
OPTIONAL)
endif()
endif()
endmacro()
macro(tbb_handle_ipo target)
if (TBB_IPO_PROPERTY)
set_target_properties(${target} PROPERTIES
INTERPROCEDURAL_OPTIMIZATION TRUE
INTERPROCEDURAL_OPTIMIZATION_DEBUG FALSE
)
elseif (TBB_IPO_FLAGS)
target_compile_options(${target} PRIVATE ${TBB_IPO_COMPILE_FLAGS})
if (COMMAND target_link_options)
target_link_options(${target} PRIVATE ${TBB_IPO_LINK_FLAGS})
else()
target_link_libraries(${target} PRIVATE ${TBB_IPO_LINK_FLAGS})
endif()
endif()
endmacro()
Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

+37
View File
@@ -0,0 +1,37 @@
window.MathJax = {
TeX: {
Macros: {
src: '\\operatorname{src}',
srclayer: '\\operatorname{src\\_layer}',
srciter: '\\operatorname{src\\_iter}',
srciterc: '\\operatorname{src\\_iter\\_c}',
weights: '\\operatorname{weights}',
weightslayer: '\\operatorname{weights\\_layer}',
weightsiter: '\\operatorname{weights\\_iter}',
weightspeephole: '\\operatorname{weights\\_peephole}',
weightsprojection: '\\operatorname{weights\\_projection}',
bias: '\\operatorname{bias}',
dst: '\\operatorname{dst}',
dstlayer: '\\operatorname{dst\\_layer}',
dstiter: '\\operatorname{dst\\_iter}',
dstiterc: '\\operatorname{dst\\_iter\\_c}',
diffsrc: '\\operatorname{diff\\_src}',
diffsrclayer: '\\operatorname{diff\\_src\\_layer}',
diffsrciter: '\\operatorname{diff\\_src\\_iter}',
diffsrciterc: '\\operatorname{diff\\_src\\_iter\\_c}',
diffweights: '\\operatorname{diff\\_weights}',
diffweightslayer: '\\operatorname{diff\\_weights\\_layer}',
diffweightsiter: '\\operatorname{diff\\_weights\\_iter}',
diffweightspeephole: '\\operatorname{diff\\_weights\\_peephole}',
diffweightsprojection: '\\operatorname{diff\\_weights\\_projection}',
diffbias: '\\operatorname{diff\\_bias}',
diffdst: '\\operatorname{diff\\_dst}',
diffdstlayer: '\\operatorname{diff\\_dst\\_layer}',
diffdstiter: '\\operatorname{diff\\_dst\\_iter}',
diffdstiterc: '\\operatorname{diff\\_dst\\_iter\\_c}',
diffgamma: '\\operatorname{diff\\_\\gamma}',
diffbeta: '\\operatorname{diff\\_\\beta}',
workspace: '\\operatorname{workspace}'
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

+13
View File
@@ -0,0 +1,13 @@
/* override table width restrictions */
@media screen and (min-width: 767px) {
.wy-table-responsive table td {
/* !important prevents the common CSS stylesheets from overriding
this as on RTD they are loaded after this stylesheet */
white-space: normal !important;
}
.wy-table-responsive {
overflow: visible !important;
}
}
+48
View File
@@ -0,0 +1,48 @@
.. _Before_You_Begin:
Before You Begin
****************
After installing |short_name|, you need to set the environment variables:
#. Go to the oneTBB installation directory (``<install_dir>``). By default, ``<install_dir>`` is the following:
* On Linux* OS:
* For superusers (root): ``/opt/intel/oneapi``
* For ordinary users (non-root): ``$HOME/intel/oneapi``
* On Windows* OS:
* ``<Program Files>\Intel\oneAPI``
#. Set the environment variables, using the script in <install_dir>, by running
* On Linux* OS:
``vars.{sh|csh} in <install_dir>/tbb/latest/env``
* On Windows* OS:
``vars.bat in <install_dir>/tbb/latest/env``
Example
*******
Below you can find a typical example for a |short_name| algorithm.
The sample calculates a sum of all integer numbers from 1 to 100.
.. code:: cpp
int sum = oneapi::tbb::parallel_reduce(oneapi::tbb::blocked_range<int>(1,101), 0,
[](oneapi::tbb::blocked_range<int> const& r, int init) -> int {
for (int v = r.begin(); v != r.end(); v++ ) {
init += v;
}
return init;
},
[](int lhs, int rhs) -> int {
return lhs + rhs;
}
);
+299
View File
@@ -0,0 +1,299 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
SOURCE_DIR = os.path.dirname(__file__)
LATEX_DIR = os.path.join(SOURCE_DIR, '_latex')
PREAMBLE_FILE = os.path.join(LATEX_DIR, 'preamble.tex')
TITLE_PAGE_FILE = os.path.join(LATEX_DIR, 'title_page.tex')
BUILD_TYPE = os.getenv("BUILD_TYPE")
# -- Project information -----------------------------------------------------
if BUILD_TYPE == 'oneapi' or BUILD_TYPE == 'dita':
project = u'Intel® oneAPI Threading Building Blocks (oneTBB)'
else:
project = u'oneAPI Threading Building Blocks (oneTBB)'
copyright = u'2021, Intel Corporation'
author = u'Intel'
# The short X.Y version
version = u''
# The full version, including alpha/beta/rc tags
release = u''
# -- General configuration ---------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.imgmath',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
#master_doc = 'main/title_main'
master_doc = 'index'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = None
# Syntax highlighting for the :: directive
highlight_language = 'cpp'
if BUILD_TYPE == 'oneapi' or BUILD_TYPE == 'dita':
rst_prolog = """
.. |full_name| replace:: Intel\ |reg|\ oneAPI Threading Building Blocks (oneTBB)
.. |short_name| replace:: oneTBB
.. |product| replace:: oneTBB
.. |reg| unicode:: U+000AE
.. |copy| unicode:: U+000A9
.. |base_tk| replace:: Intel\ |reg|\ oneAPI Base Toolkit
.. |dpcpp| replace:: Intel\ |reg|\ oneAPI DPC++/C++ Compiler
"""
else:
rst_prolog = """
.. |full_name| replace:: oneAPI Threading Building Blocks (oneTBB)
.. |short_name| replace:: oneTBB
.. |product| replace:: oneTBB
.. |reg| unicode:: U+000AE
.. |copy| unicode:: U+000A9
.. |base_tk| replace:: Intel\ |reg|\ oneAPI Base Toolkit
.. |dpcpp| replace:: Intel\ |reg|\ oneAPI DPC++/C++ Compiler
"""
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
if BUILD_TYPE == 'oneapi' or BUILD_TYPE == 'dita':
html_theme = 'sphinx_rtd_theme'
else:
html_theme = 'sphinx_book_theme'
html_theme_options = {
'repository_url': 'https://github.com/oneapi-src/oneTBB',
'path_to_docs': 'doc/main',
'use_issues_button': True,
'use_edit_page_button': True,
'repository_branch': 'master',
'extra_footer': '<p align="right"><a href="https://www.intel.com/content/www/us/en/privacy/intel-cookie-notice.html">Cookies</a></p>'
}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
if BUILD_TYPE == 'oneapi' or BUILD_TYPE == 'dita':
html_context = {
'css_files': [
'_static/theme_overrides.css', # override wide tables in RTD theme
],
}
else:
html_js_files = ['custom.js']
html_logo = '_static/oneAPI-rgb-rev-100.png'
html_favicon = '_static/favicons.png'
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}
# -- Options for HTMLHelp output ---------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'sphinx-infodevdoc'
# -- Options for LaTeX output ------------------------------------------------
#latex_engine = 'xelatex'
#PDF_TITLE = 'Information Development Template'
#
#with open(PREAMBLE_FILE, 'r', encoding='utf-8') as f:
# PREAMBLE = f.read()
#
#with open(TITLE_PAGE_FILE, 'r', encoding='utf-8') as f:
# TITLE_PAGE = f.read().replace('<PDF_TITLE>', PDF_TITLE)
#
#
#latex_elements = {
# # The paper size ('letterpaper' or 'a4paper').
# #
# 'extraclassoptions': 'openany,oneside',
# 'babel' : '\\usepackage[english]{babel}',
# 'papersize': 'a4paper',
# 'releasename':" ",
# # Sonny, Lenny, Glenn, Conny, Rejne, Bjarne and Bjornstrup
# # 'fncychap': '\\usepackage[Lenny]{fncychap}',
# 'fncychap': '',
# #'fontpkg': '\\usepackage{amsmath,amsfonts,amssymb,amsthm}',
#
# 'figure_align':'htbp',
# # The font size ('10pt', '11pt' or '12pt').
# #
# 'pointsize': '12pt',
#
# # Additional stuff for the LaTeX preamble.
# #
# 'preamble': PREAMBLE,
#
# 'maketitle': TITLE_PAGE,
# # Latex figure (float) alignment
# #
# # 'figure_align': 'htbp',
# 'sphinxsetup': \
# 'hmargin={0.7in,0.7in}, vmargin={1in,1in}, \
# verbatimwithframe=true, \
# TitleColor={rgb}{0,0.686,0.941}, \
# HeaderFamily=\\rmfamily\\bfseries, \
# InnerLinkColor={rgb}{0,0.686,0.941}, \
# OuterLinkColor={rgb}{0,0.686,0.941}',
#
# 'tableofcontents':' '
#}
#
#latex_logo = '_latex/intel_logo.png'
## Grouping the document tree into LaTeX files. List of tuples
## (source start file, target name, title,
## author, documentclass [howto, manual, or own class]).
#latex_documents = [
# (master_doc, 'sphinx-infodev.tex', u'sphinx-infodev Documentation',
# u'Intel', 'manual'),
#]
#breathe_projects = { #todd-mod
# project: "../doxygen/xml"
#}
#breathe_default_project = project
# Setup the exhale extension
#exhale_args = { #todd-mod
# # These arguments are required
# "containmentFolder": "./api",
# "rootFileName": "library_root.rst",
# "rootFileTitle": "Library API",
# "doxygenStripFromPath": "..",
# "fullApiSubSectionTitle": 'Full API'
#}
# -- Options for manual page output ------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'sphinx-infodev', u'sphinx-infodev Documentation',
[author], 1)
]
# -- Options for Texinfo output ----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'sphinx-infodev', u'sphinx-infodev Documentation',
author, 'sphinx-infodev', 'One line description of project.',
'Miscellaneous'),
]
# -- Options for Epub output -------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = project
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#
# epub_identifier = ''
# A unique identification for the text.
#
# epub_uid = ''
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
# -- Extension configuration -------------------------------------------------
# -- Options for intersphinx extension ---------------------------------------
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
# -- Options for todo extension ----------------------------------------------
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
+45
View File
@@ -0,0 +1,45 @@
.. _examples:
oneTBB Samples
==============
Refer to the following examples to see how |short_name| works.
* **Containers**
* `concurrent_hash_map <https://github.com/oneapi-src/oneTBB/tree/master/examples/concurrent_hash_map>`_
* `concurrent_priority_queue <https://github.com/oneapi-src/oneTBB/tree/master/examples/concurrent_priority_queue>`_
* `Flow Graph <https://github.com/oneapi-src/oneTBB/tree/master/examples/graph>`_
* `A solution to the binpacking problem using a queue_node, a buffer_node, and function_node. <https://github.com/oneapi-src/oneTBB/tree/master/examples/graph/binpack>`_
* `Cholesky Factorization algorithm <https://github.com/oneapi-src/oneTBB/tree/master/examples/graph/cholesky>`_
* `An implementation of dining philosophers in graph using the reserving join_node <https://github.com/oneapi-src/oneTBB/tree/master/examples/graph/dining_philosophers>`_
* `A parallel implementation of bzip2 block-sorting file compressor <https://github.com/oneapi-src/oneTBB/tree/master/examples/graph/fgbzip2>`_
* `An example of a collection of digital logic gates that can be easily composed into larger circuits <https://github.com/oneapi-src/oneTBB/tree/master/examples/graph/logic_sim>`_
* `An example of a Kohonen Self-Organizing Map using cancellation <https://github.com/oneapi-src/oneTBB/tree/master/examples/graph/som>`_
* `Split computational kernel for execution between CPU and GPU <https://github.com/oneapi-src/oneAPI-samples/tree/master/Libraries/oneTBB/tbb-async-sycl>`_
* **Algorithms**
* `parallel_for <https://github.com/oneapi-src/oneTBB/tree/master/examples/parallel_for>`_
* `Game of life overlay <https://github.com/oneapi-src/oneTBB/tree/master/examples/parallel_for/game_of_life>`_
* `Polygon overlay <https://github.com/oneapi-src/oneTBB/tree/master/examples/parallel_for/polygon_overlay>`_
* `Parallel seismic wave simulation <https://github.com/oneapi-src/oneTBB/tree/master/examples/parallel_for/seismic>`_
* `Parallel 2-D raytracer/renderer <https://github.com/oneapi-src/oneTBB/tree/master/examples/parallel_for/tachyon>`_
* `Find largest matching substrings <https://github.com/oneapi-src/oneTBB/tree/master/examples/getting_started>`_
* `Resumable task: Split computational kernel for execution between CPU and GPU <https://github.com/oneapi-src/oneAPI-samples/tree/master/Libraries/oneTBB/tbb-resumable-tasks-sycl>`_
* `parallel_for_each <https://github.com/oneapi-src/oneTBB/tree/master/examples/parallel_for_each>`_
* `parallel_pipeline <https://github.com/oneapi-src/oneTBB/tree/master/examples/parallel_pipeline>`_
* `parallel_reduce <https://github.com/oneapi-src/oneTBB/tree/master/examples/parallel_reduce>`_
* **Task Scheduler**
* `task_arena <https://github.com/oneapi-src/oneTBB/tree/master/examples/task_arena>`_
* `task_group <https://github.com/oneapi-src/oneTBB/tree/master/examples/task_group>`_
* `Execute similar computational kernels, with one task executing the SYCL* code and the other task executing the oneTBB code <https://github.com/oneapi-src/oneAPI-samples/tree/master/Libraries/oneTBB/tbb-task-sycl>`_
* **Other**
* `Compute Fibonacci numbers in different ways <https://github.com/oneapi-src/oneTBB/tree/master/examples/test_all>`_
+24
View File
@@ -0,0 +1,24 @@
.. _Get_Started_Guide:
Get Started with |full_name|
=============================
|short_name| Get Started Guide provides the information you need to begin working with oneTBB.
It is helpful for new users of parallel programming and experienced developers that want to improve code performance.
It is recommended for you to have a basic knowledge of C++ programming and some experience with parallel programming concepts.
To start using oneTBB, follow the next steps:
*********************************************
#. Learn what :ref:`oneTBB is<intro>` and see the :ref:`System Requirements<system_requirements>`.
#. :ref:`Install oneTBB<installation>`.
#. Run your program using oneTBB following the :ref:`Next Steps <next_steps>`.
#. Learn how to :ref:`Integrate oneTBB into your project <integrate>` using CMake* and pkg-config tool.
#. See :ref:`oneTBB Samples <samples>`.
+40
View File
@@ -0,0 +1,40 @@
.. _hybrid_cpu_support:
Hybrid CPU and NUMA Support
***************************
If you need NUMA/Hybrid CPU support in oneTBB, you need to make sure that HWLOC* is installed on your system.
HWLOC* (Hardware Locality) is a library that provides a portable abstraction of the hierarchical topology of modern architectures (NUMA, hybrid CPU systems, etc).
oneTBB relies on HWLOC* to identify the underlying topology of the system to optimize thread scheduling and memory allocation.
Without HWLOC*, oneTBB may not take advantage of NUMA/Hybrid CPU support. Therefore, it's important to make sure that HWLOC* is installed before using oneTBB on such systems.
Check HWLOC* on the System
^^^^^^^^^^^^^^^^^^^^^^^^^^
To check if HWLOC* is already installed on your system, run `hwloc-ls`:
* For Linux* OS, in the command line.
* For Windows* OS, in the command prompt.
If HWLOC* is installed, the command displays information about the hardware topology of your system.
If it is not installed, you receive an error message saying that the command ``hwloc-ls`` could not be found.
.. note:: For Hybrid CPU support, make sure that HWLOC* is version 2.5 or higher.
For NUMA support, install HWLOC* version 1.11 or higher.
Install HWLOC*
^^^^^^^^^^^^^^
To install HWLOC*, visit the official Portable Hardware Locality website (https://www-lb.open-mpi.org/projects/hwloc/).
* For Windows* OS, binaries are available for download.
* For Linux* OS, only the source code is provided and binaries should be built.
On Linux* OS, HWLOC* can be also installed with package managers, such as APT*, YUM*, etc.
To do so, run: ``sudo apt install hwloc``.
.. note:: For Hybrid CPU support, make sure that HWLOC* is version 2.5 or higher.
For NUMA support, install HWLOC* version 1.11 or higher.
+121
View File
@@ -0,0 +1,121 @@
.. _Get_Started_Guide
Get Started with |full_name|
============================
|full_name| enables you to simplify parallel programming by breaking
computation into parallel running tasks. oneTBB is available as a stand-alone
product and as part of the |base_tk|.
|short_name| is a runtime-based parallel programming model for C++ code that uses threads.
It consists of a template-based runtime library to help you harness the latent performance
of multi-core processors. Use |short_name| to write scalable applications that:
- Specify logical parallel structure instead of threads
- Emphasize data parallel programming
- Take advantage of concurrent collections and parallel algorithms
System Requirements
*******************
Refer to the `oneTBB System Requirements <https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-threading-building-blocks-system-requirements.html>`_.
Before You Begin
****************
Download |short_name| as a `stand-alone product <https://software.intel.com/content/www/us/en/develop/articles/oneapi-standalone-components.html#onetbb>`_
or as a part of the `Intel(R) oneAPI Base Toolkit <https://software.intel.com/content/www/us/en/develop/tools/oneapi/base-toolkit/download.html>`_.
After installing |short_name|, you need to set the environment variables:
#. Go to the oneTBB installation directory (``<install_dir>``). By default, ``<install_dir>`` is the following:
* On Linux* OS:
* For superusers (root): ``/opt/intel/oneapi``
* For ordinary users (non-root): ``$HOME/intel/oneapi``
* On Windows* OS:
* ``<Program Files>\Intel\oneAPI``
#. Set the environment variables, using the script in <install_dir>, by running
* On Linux* OS:
``vars.{sh|csh} in <install_dir>/tbb/latest/env``
* On Windows* OS:
``vars.bat in <install_dir>/tbb/latest/env``
Example
*******
Below you can find a typical example for a |short_name| algorithm.
The sample calculates a sum of all integer numbers from 1 to 100.
.. code:: cpp
int sum = oneapi::tbb::parallel_reduce(oneapi::tbb::blocked_range<int>(1,101), 0,
[](oneapi::tbb::blocked_range<int> const& r, int init) -> int {
for (int v = r.begin(); v != r.end(); v++ ) {
init += v;
}
return init;
},
[](int lhs, int rhs) -> int {
return lhs + rhs;
}
);
Find more
*********
.. list-table::
:widths: 40 60
:header-rows: 0
* -
- `oneTBB Community Forum <https://community.intel.com/>`_
- `Product FAQs <https://software.intel.com/content/www/us/en/develop/support/faq-product.html>`_
- `Support requests <https://software.intel.com/content/www/us/en/develop/articles/how-to-create-a-support-request-at-online-service-center.html>`_
- Use these resources if you need support with oneTBB.
* - `Release Notes <https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-threading-building-blocks-release-notes.html>`_
- Find up-to-date information about the product, including detailed notes, known issues, and changes.
* - `Documentation <https://software.intel.com/content/www/us/en/develop/documentation/onetbb-documentation/top.html>`_: `Developer Guide <https://software.intel.com/content/www/us/en/develop/documentation/onetbb-documentation/top/onetbb-developer-guide.html>`_ and `API Reference <https://software.intel.com/content/www/us/en/develop/documentation/onetbb-documentation/top/onetbb-api-reference.html>`_
- Learn to use oneTBB.
* - `GitHub* <https://github.com/oneapi-src/oneTBB>`_
- Find oneTBB implementation in open source.
Notices and Disclaimers
***********************
Intel technologies may require enabled hardware, software or service activation.
No product or component can be absolutely secure.
Your costs and results may vary.
© Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks
of Intel Corporation or its subsidiaries. Other names and brands may be claimed
as the property of others.
No license (express or implied, by estoppel or otherwise) to any intellectual
property rights is granted by this document.
The products described may contain design defects or errors known as errata which
ay cause the product to deviate from published specifications. Current
characterized errata are available on request.
Intel disclaims all express and implied warranties, including without limitation,
the implied warranties of merchantability, fitness for a particular purpose,
and non-infringement, as well as any warranty arising from course of performance,
course of dealing, or usage in trade.
+7
View File
@@ -0,0 +1,7 @@
.. _installation:
Installation
============
See the `installation instructions <https://github.com/oneapi-src/oneTBB/blob/master/INSTALL.md>`_
that will help you to install |short_name| successfully.
+68
View File
@@ -0,0 +1,68 @@
.. _integrate:
Integrate oneTBB
================
If you want to improve the performance and scalability of your application, you can integrate oneTBB into your project.
For example, you may want to integrate oneTBB if your application needs to process large amounts of data in parallel.
To integrate oneTBB, you need to:
* Link oneTBB with the project's source code.
* Provide the necessary compiler and linker flags.
However, you can use CMake* and the pkg-config tool to simplify the process of integrating oneTBB into your project and handling its dependencies.
See the instructions below to learn how to use the tools.
CMake*
*******
CMake* is a cross-platform build tool that helps you manage dependencies and build systems.
Integrating oneTBB into your project using CMake*:
* Simplifies the process of building and linking against the library.
* Ensures that your project can be built and run on multiple platforms.
* Lets you manage oneTBB dependencies.
To add oneTBB to another project using CMake*, add the following commands to your ``CMakeLists.txt`` file:
.. code-block::
`find_package(TBB REQUIRED)`
`target_link_libraries(my_executable TBB::tbb)`
After that, configure your project with CMake* as usual.
Compile a Program Using pkg-config
***********************************
The pkg-config tool is used to simplify the compilation line by retrieving information about packages
from special metadata files. It helps avoid large hard-coded paths and makes compilation more portable.
To compile a test program ``test.cpp`` with oneTBB on Linux* OS,
provide the full path to search for included files and libraries, or provide a line as the following:
.. code-block::
g++ -o test test.cpp $(pkg-config --libs --cflags tbb)
Where:
``--cflags`` provides oneTBB library include path:
.. code-block::
$ pkg-config --cflags tbb
-I<path-to>/tbb/latest/lib/pkgconfig/../..//include
``--libs`` provides the Intel(R) oneTBB library name and the search path to find it:
.. code-block::
$ pkg-config –libs tbb
-L<path to>tbb/latest/lib/pkgconfig/../..//lib/intel64/gcc4.8 -ltbb
.. note::
For Windows* OS, additionally, use the ``--msvc-syntax`` option flag that converts the compiling and linking flags in an appropriate mode.
+29
View File
@@ -0,0 +1,29 @@
.. _intro:
What oneTBB Is
==============
|full_name| is a runtime-based parallel programming model for C++ code that uses threads.
The template-based runtime library can help you harness the latent performance of multi-core processors.
oneTBB enables you to simplify parallel programming by breaking computation into parallel running tasks. Within a single process,
parallelism is carried out through threads, an operating system mechanism that allows the same or different sets of instructions
to be executed simultaneously. Using threads can make your program work faster and more efficiently.
Here you can see one of the possible executions of tasks by threads.
.. figure:: Images/how-oneTBB-works.png
:scale: 70%
:align: center
Use oneTBB to write scalable applications that:
* Specify logical parallel structure instead of threads.
* Emphasize data-parallel programming.
* Take advantage of concurrent collections and parallel algorithms.
oneTBB supports nested parallelism and load balancing. It means that you can use the library without worrying about oversubscribing a system, which happens when more tasks are assigned to a system than it can handle efficiently.
oneTBB is used in different areas, such as scientific simulations, gaming, data analysis, etc.
It is available as a stand-alone product and as part of the |base_tk|.
+23
View File
@@ -0,0 +1,23 @@
.. _Intro_gsg:
|full_name| is a runtime-based parallel programming model for C++ code that uses threads.
It consists of a template-based runtime library to help you harness the latent performance of multi-core processors.
oneTBB enables you to simplify parallel programming by breaking computation into parallel running tasks. Within a single process,
parallelism is carried out through threads, an operating system mechanism that allows the same or different sets of instructions
to be executed simultaneously.
Here you can see one of the possible executions of tasks by threads.
.. figure:: /GSG/Images/how-oneTBB-works.png
:scale: 70%
:align: center
Use oneTBB to write scalable applications that:
* Specify logical parallel structure instead of threads
* Emphasize data-parallel programming
* Take advantage of concurrent collections and parallel algorithms
oneTBB supports nested parallelism and load balancing. It means that you can use the library without being worried about oversubscribing a system.
+157
View File
@@ -0,0 +1,157 @@
.. _next_steps:
Next Steps
===========
After installing oneTBB, complete the following steps to start working with the library.
Set the Environment Variables
*****************************
After installing |short_name|, set the environment variables:
#. Go to the oneTBB installation directory.
#. Set the environment variables using the script in ``<install_dir>`` by running:
* On Linux* OS: ``vars.{sh|csh} in <install_dir>/tbb/latest/env``
* On Windows* OS: ``vars.bat in <install_dir>/tbb/latest/env``
.. tip::
oneTBB can coordinate with Intel(R) OpenMP on CPU resources usage
to avoid excessive oversubscription when both runtimes are used within a process.
To enable this feature set up ``TCM_ENABLE`` environment variable to ``1``.
Build and Run a Sample
**********************
.. tabs::
.. group-tab:: Windows* OS
#. Create a new C++ project using your IDE. In this example, Microsoft* Visual Studio* Code is used.
#. Create an ``example.cpp`` file in the project.
#. Copy and paste the code below. It is a typical example of a |short_name| algorithm. The sample calculates a sum of all integer numbers from 1 to 100.
.. code::
#include <oneapi/tbb.h>
int main (){
int sum = oneapi::tbb::parallel_reduce(
oneapi::tbb::blocked_range<int>(1,101), 0,
[](oneapi::tbb::blocked_range<int> const& r, int init) -> int {
for (int v = r.begin(); v != r.end(); v++) {
init += v;
}
return init;
},
[](int lhs, int rhs) -> int {
return lhs + rhs;
}
);
printf("Sum: %d\n", sum);
return 0;
}
#. Open the ``tasks.json`` file in the ``.vscode`` directory and paste the following lines to the args array:
* ``-Ipath/to/oneTBB/include`` to add oneTBB include directory.
* ``path/to/oneTBB/`` to add oneTBB.
For example:
.. code-block::
{
"tasks": [
{
"label": "build & run",
"type": "cppbuild",
"group": {
"args": [
"/IC:\\Program Files (x86)\\Intel\\oneAPI\\tbb\\2021.9.0\\include",
"C:\\Program Files (x86)\\Intel\\oneAPI\\tbb\\2021.9.0\\lib\\ia32\\vc14\\tbb12.lib"
#. Build the project.
#. Run the example.
#. If oneTBB is configured correctly, the output displays ``Sum: 5050``.
.. group-tab:: Linux* OS
#. Create an ``example.cpp`` file in the project.
#. Copy and paste the code below. It is a typical example of a |short_name| algorithm. The sample calculates a sum of all integer numbers from 1 to 100.
.. code::
#include <oneapi/tbb.h>
int main(){
int sum = oneapi::tbb::parallel_reduce(
oneapi::tbb::blocked_range<int>(1,101), 0,
[](oneapi::tbb::blocked_range<int> const& r, int init) -> int {
for (int v = r.begin(); v != r.end(); v++) {
init += v;
}
return init;
},
[](int lhs, int rhs) -> int {
return lhs + rhs;
}
);
printf("Sum: %d\n", sum);
return 0;
}
#. Compile the code using oneTBB. For example,
.. code-block::
g++ -std=c++11 example.cpp -o example -ltbb
#. Run the executable:
.. code-block::
./example
#. If oneTBB is configured correctly, the output displays ``Sum: 5050``.
Hybrid CPU and NUMA Support
****************************
If you need NUMA/Hybrid CPU support in oneTBB, you need to make sure that HWLOC* is installed on your system.
HWLOC* (Hardware Locality) is a library that provides a portable abstraction of the hierarchical topology of modern architectures (NUMA, hybrid CPU systems, etc). oneTBB relies on HWLOC* to identify the underlying topology of the system to optimize thread scheduling and memory allocation.
Without HWLOC*, oneTBB may not take advantage of NUMA/Hybrid CPU support. Therefore, it's important to make sure that HWLOC* is installed before using oneTBB on such systems.
Check HWLOC* on the System
^^^^^^^^^^^^^^^^^^^^^^^^^^^
To check if HWLOC* is already installed on your system, run ``hwloc-ls``:
* For Linux* OS, in the command line.
* For Windows* OS, in the command prompt.
If HWLOC* is installed, the command displays information about the hardware topology of your system. If it is not installed, you receive an error message saying that the command ``hwloc-ls`` could not be found.
.. note:: For Hybrid CPU support, make sure that HWLOC* is version 2.5 or higher. For NUMA support, install HWLOC* version 1.11 or higher.
Install HWLOC*
^^^^^^^^^^^^^^
To install HWLOC*, visit the official Portable Hardware Locality website (https://www-lb.open-mpi.org/projects/hwloc/).
* For Windows* OS, binaries are available for download.
* For Linux* OS, only the source code is provided and binaries should be built.
On Linux* OS, HWLOC* can be also installed with package managers, such as APT*, YUM*, etc. To do so, run: sudo apt install hwloc.
.. note:: For Hybrid CPU support, make sure that HWLOC* is version 2.5 or higher. For NUMA support, install HWLOC* version 1.11 or higher.
+49
View File
@@ -0,0 +1,49 @@
.. _samples:
oneTBB Samples
==============
To become an expert in using oneTBB, explore its samples and examples to learn how
to properly utilize the features and functionality of oneTBB and avoid common mistakes that may impede your performance.
The following samples are available:
* **Containers**
* `concurrent_hash_map <https://github.com/oneapi-src/oneTBB/tree/master/examples/concurrent_hash_map>`_
* `concurrent_priority_queue <https://github.com/oneapi-src/oneTBB/tree/master/examples/concurrent_priority_queue>`_
* `Flow Graph <https://github.com/oneapi-src/oneTBB/tree/master/examples/graph>`_
* `A solution to the binpacking problem using a queue_node, a buffer_node, and function_node. <https://github.com/oneapi-src/oneTBB/tree/master/examples/graph/binpack>`_
* `Cholesky Factorization algorithm <https://github.com/oneapi-src/oneTBB/tree/master/examples/graph/cholesky>`_
* `An implementation of dining philosophers in graph using the reserving join_node <https://github.com/oneapi-src/oneTBB/tree/master/examples/graph/dining_philosophers>`_
* `A parallel implementation of bzip2 block-sorting file compressor <https://github.com/oneapi-src/oneTBB/tree/master/examples/graph/fgbzip2>`_
* `An example of a collection of digital logic gates that can be easily composed into larger circuits <https://github.com/oneapi-src/oneTBB/tree/master/examples/graph/logic_sim>`_
* `An example of a Kohonen Self-Organizing Map using cancellation <https://github.com/oneapi-src/oneTBB/tree/master/examples/graph/som>`_
* `Split computational kernel for execution between CPU and GPU <https://github.com/oneapi-src/oneAPI-samples/tree/master/Libraries/oneTBB/tbb-async-sycl>`_
* **Algorithms**
* `parallel_for <https://github.com/oneapi-src/oneTBB/tree/master/examples/parallel_for>`_
* `Game of life overlay <https://github.com/oneapi-src/oneTBB/tree/master/examples/parallel_for/game_of_life>`_
* `Polygon overlay <https://github.com/oneapi-src/oneTBB/tree/master/examples/parallel_for/polygon_overlay>`_
* `Parallel seismic wave simulation <https://github.com/oneapi-src/oneTBB/tree/master/examples/parallel_for/seismic>`_
* `Parallel 2-D raytracer/renderer <https://github.com/oneapi-src/oneTBB/tree/master/examples/parallel_for/tachyon>`_
* `Find largest matching substrings <https://github.com/oneapi-src/oneTBB/tree/master/examples/getting_started>`_
* `Resumable task: Split computational kernel for execution between CPU and GPU <https://github.com/oneapi-src/oneAPI-samples/tree/master/Libraries/oneTBB/tbb-resumable-tasks-sycl>`_
* `parallel_for_each <https://github.com/oneapi-src/oneTBB/tree/master/examples/parallel_for_each>`_
* `parallel_pipeline <https://github.com/oneapi-src/oneTBB/tree/master/examples/parallel_pipeline>`_
* `parallel_reduce <https://github.com/oneapi-src/oneTBB/tree/master/examples/parallel_reduce>`_
* **Task Scheduler**
* `task_arena <https://github.com/oneapi-src/oneTBB/tree/master/examples/task_arena>`_
* `task_group <https://github.com/oneapi-src/oneTBB/tree/master/examples/task_group>`_
* `Execute similar computational kernels, with one task executing the SYCL* code and the other task executing the oneTBB code <https://github.com/oneapi-src/oneAPI-samples/tree/master/Libraries/oneTBB/tbb-task-sycl>`_
* **Other**
* `Compute Fibonacci numbers in different ways <https://github.com/oneapi-src/oneTBB/tree/master/examples/test_all>`_
.. note:: You can also refer to the `oneAPI Samples <https://oneapi-src.github.io/oneAPI-samples/>`_ to learn more about the ecosystem.
+6
View File
@@ -0,0 +1,6 @@
.. _System_Requirements:
System Requirements
*******************
Refer to the `oneTBB System Requirements <https://github.com/oneapi-src/oneTBB/blob/master/SYSTEM_REQUIREMENTS.md>`_.
+36
View File
@@ -0,0 +1,36 @@
#===============================================================================
# Copyright (C) 2022 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.
#===============================================================================
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = doc
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+34
View File
@@ -0,0 +1,34 @@
# How to build oneTBB documentation
Our documentation is written in restructured text markup (.rst) and built using [Sphinx](http://www.sphinx-doc.org/en/master/).
This document explains how to build oneTBB documentation locally.
## Prerequisites
- Python 3.7.0 or higher
- Sphinx
## Build documentation
Do the following to generate HTML output of the documentation:
1. Clone oneTBB repository:
```
git clone https://github.com/oneapi-src/oneTBB.git
```
2. Go to the `doc` folder:
```
cd oneTBB/doc
```
3. Run in the command line:
```
make html
```
That's it! Your built documentation is located in the ``build/html`` folder.
+37
View File
@@ -0,0 +1,37 @@
window.MathJax = {
TeX: {
Macros: {
src: '\\operatorname{src}',
srclayer: '\\operatorname{src\\_layer}',
srciter: '\\operatorname{src\\_iter}',
srciterc: '\\operatorname{src\\_iter\\_c}',
weights: '\\operatorname{weights}',
weightslayer: '\\operatorname{weights\\_layer}',
weightsiter: '\\operatorname{weights\\_iter}',
weightspeephole: '\\operatorname{weights\\_peephole}',
weightsprojection: '\\operatorname{weights\\_projection}',
bias: '\\operatorname{bias}',
dst: '\\operatorname{dst}',
dstlayer: '\\operatorname{dst\\_layer}',
dstiter: '\\operatorname{dst\\_iter}',
dstiterc: '\\operatorname{dst\\_iter\\_c}',
diffsrc: '\\operatorname{diff\\_src}',
diffsrclayer: '\\operatorname{diff\\_src\\_layer}',
diffsrciter: '\\operatorname{diff\\_src\\_iter}',
diffsrciterc: '\\operatorname{diff\\_src\\_iter\\_c}',
diffweights: '\\operatorname{diff\\_weights}',
diffweightslayer: '\\operatorname{diff\\_weights\\_layer}',
diffweightsiter: '\\operatorname{diff\\_weights\\_iter}',
diffweightspeephole: '\\operatorname{diff\\_weights\\_peephole}',
diffweightsprojection: '\\operatorname{diff\\_weights\\_projection}',
diffbias: '\\operatorname{diff\\_bias}',
diffdst: '\\operatorname{diff\\_dst}',
diffdstlayer: '\\operatorname{diff\\_dst\\_layer}',
diffdstiter: '\\operatorname{diff\\_dst\\_iter}',
diffdstiterc: '\\operatorname{diff\\_dst\\_iter\\_c}',
diffgamma: '\\operatorname{diff\\_\\gamma}',
diffbeta: '\\operatorname{diff\\_\\beta}',
workspace: '\\operatorname{workspace}'
}
}
}
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

+13
View File
@@ -0,0 +1,13 @@
/* override table width restrictions */
@media screen and (min-width: 767px) {
.wy-table-responsive table td {
/* !important prevents the common CSS stylesheets from overriding
this as on RTD they are loaded after this stylesheet */
white-space: normal !important;
}
.wy-table-responsive {
overflow: visible !important;
}
}
+312
View File
@@ -0,0 +1,312 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
SOURCE_DIR = os.path.dirname(__file__)
LATEX_DIR = os.path.join(SOURCE_DIR, '_latex')
PREAMBLE_FILE = os.path.join(LATEX_DIR, 'preamble.tex')
TITLE_PAGE_FILE = os.path.join(LATEX_DIR, 'title_page.tex')
BUILD_TYPE = os.getenv("BUILD_TYPE")
# -- Project information -----------------------------------------------------
if BUILD_TYPE == 'oneapi' or BUILD_TYPE == 'dita':
project = u'Intel® oneAPI Threading Building Blocks (oneTBB)'
else:
project = u'oneTBB'
copyright = u'2023, Intel Corporation'
author = u'Intel'
# The short X.Y version
version = u''
# The full version, including alpha/beta/rc tags
release = u''
# -- General configuration ---------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.imgmath',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'sphinx_tabs.tabs'
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['main/_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
#master_doc = 'main/title_main'
master_doc = 'index'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = None
# Syntax highlighting for the :: directive
highlight_language = 'cpp'
if BUILD_TYPE == 'oneapi' or BUILD_TYPE == 'dita':
rst_prolog = """
.. |full_name| replace:: Intel\ |reg|\ oneAPI Threading Building Blocks (oneTBB)
.. |short_name| replace:: oneTBB
.. |product| replace:: oneTBB
.. |reg| unicode:: U+000AE
.. |copy| unicode:: U+000A9
.. |base_tk| replace:: Intel\ |reg|\ oneAPI Base Toolkit
.. |dpcpp| replace:: Intel\ |reg|\ oneAPI DPC++/C++ Compiler
"""
else:
rst_prolog = """
.. |full_name| replace:: oneAPI Threading Building Blocks (oneTBB)
.. |short_name| replace:: oneTBB
.. |product| replace:: oneTBB
.. |reg| unicode:: U+000AE
.. |copy| unicode:: U+000A9
.. |base_tk| replace:: Intel\ |reg|\ oneAPI Base Toolkit
.. |dpcpp| replace:: Intel\ |reg|\ oneAPI DPC++/C++ Compiler
"""
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
html_theme = 'sphinx_book_theme'
if BUILD_TYPE == 'dita':
html_theme_options = {
'repository_url': 'https://github.com/oneapi-src/oneTBB',
'path_to_docs': 'doc',
'repository_branch': 'master'
}
else:
html_theme_options = {
'repository_url': 'https://github.com/oneapi-src/oneTBB',
'path_to_docs': 'doc',
'use_issues_button': True,
'use_edit_page_button': True,
'repository_branch': 'master',
}
if BUILD_TYPE != 'oneapi' and BUILD_TYPE != 'dita':
html_theme_options = {
"extra_footer": "<div><a href='https://www.intel.com/content/www/us/en/privacy/intel-cookie-notice.html' data-cookie-notice='true'>Cookies</a> <a href='https://www.intel.com/content/www/us/en/privacy/intel-privacy-notice.html'>| Privacy</a> <a data-wap_ref='dns' id='wap_dns' href='https://www.intel.com/content/www/us/en/privacy/intel-cookie- notice.html'>| Do Not Share My Personal Information</a> </div><div>&copy; Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries. Other names and brands may be claimed as the property of others. No license (express or implied, by estoppel or otherwise) to any intellectual property rights is granted by this document, with the sole exception that code included in this document is licensed subject to the Zero-Clause BSD open source license (OBSD), <a href='http://opensource.org/licenses/0BSD'>http://opensource.org/licenses/0BSD</a>. </div><br><div>oneTBB is licensed under Apache License Version 2.0. Refer to the <a href='https://github.com/oneapi-src/oneTBB/blob/master/LICENSE.txt'>LICENSE </a> file for the full license text and copyright notice.</div>"
}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
if BUILD_TYPE == 'oneapi' or BUILD_TYPE == 'dita':
html_context = {
'css_files': [
'_static/theme_overrides.css', # override wide tables in RTD theme
],
}
else:
html_js_files = ['custom.js']
html_theme_options = {
"logo": {
"text": "oneTBB Documentation",
}
}
html_logo = '_static/oneAPI-rgb-rev-100.png'
html_favicon = '_static/favicons.png'
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}
# -- Options for HTMLHelp output ---------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'sphinx-infodevdoc'
# -- Options for LaTeX output ------------------------------------------------
#latex_engine = 'xelatex'
#PDF_TITLE = 'Information Development Template'
#
#with open(PREAMBLE_FILE, 'r', encoding='utf-8') as f:
# PREAMBLE = f.read()
#
#with open(TITLE_PAGE_FILE, 'r', encoding='utf-8') as f:
# TITLE_PAGE = f.read().replace('<PDF_TITLE>', PDF_TITLE)
#
#
#latex_elements = {
# # The paper size ('letterpaper' or 'a4paper').
# #
# 'extraclassoptions': 'openany,oneside',
# 'babel' : '\\usepackage[english]{babel}',
# 'papersize': 'a4paper',
# 'releasename':" ",
# # Sonny, Lenny, Glenn, Conny, Rejne, Bjarne and Bjornstrup
# # 'fncychap': '\\usepackage[Lenny]{fncychap}',
# 'fncychap': '',
# #'fontpkg': '\\usepackage{amsmath,amsfonts,amssymb,amsthm}',
#
# 'figure_align':'htbp',
# # The font size ('10pt', '11pt' or '12pt').
# #
# 'pointsize': '12pt',
#
# # Additional stuff for the LaTeX preamble.
# #
# 'preamble': PREAMBLE,
#
# 'maketitle': TITLE_PAGE,
# # Latex figure (float) alignment
# #
# # 'figure_align': 'htbp',
# 'sphinxsetup': \
# 'hmargin={0.7in,0.7in}, vmargin={1in,1in}, \
# verbatimwithframe=true, \
# TitleColor={rgb}{0,0.686,0.941}, \
# HeaderFamily=\\rmfamily\\bfseries, \
# InnerLinkColor={rgb}{0,0.686,0.941}, \
# OuterLinkColor={rgb}{0,0.686,0.941}',
#
# 'tableofcontents':' '
#}
#
#latex_logo = '_latex/intel_logo.png'
## Grouping the document tree into LaTeX files. List of tuples
## (source start file, target name, title,
## author, documentclass [howto, manual, or own class]).
#latex_documents = [
# (master_doc, 'sphinx-infodev.tex', u'sphinx-infodev Documentation',
# u'Intel', 'manual'),
#]
#breathe_projects = { #todd-mod
# project: "../doxygen/xml"
#}
#breathe_default_project = project
# Setup the exhale extension
#exhale_args = { #todd-mod
# # These arguments are required
# "containmentFolder": "./api",
# "rootFileName": "library_root.rst",
# "rootFileTitle": "Library API",
# "doxygenStripFromPath": "..",
# "fullApiSubSectionTitle": 'Full API'
#}
# -- Options for manual page output ------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'sphinx-infodev', u'sphinx-infodev Documentation',
[author], 1)
]
# -- Options for Texinfo output ----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'sphinx-infodev', u'sphinx-infodev Documentation',
author, 'sphinx-infodev', 'One line description of project.',
'Miscellaneous'),
]
# -- Options for Epub output -------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = project
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#
# epub_identifier = ''
# A unique identification for the text.
#
# epub_uid = ''
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
# -- Extension configuration -------------------------------------------------
# -- Options for intersphinx extension ---------------------------------------
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
# -- Options for todo extension ----------------------------------------------
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
+15
View File
@@ -0,0 +1,15 @@
|full_name|
===========
.. include:: index/index_intro.rst
The following are some important topics for the ``novice user``:
* :ref:`Get_Started_Guide` gives you a brief explanation of what oneTBB is.
* :ref:`Benefits` describes how |short_name| differs from typical threading packages.
* :ref:`Package_Contents` describes dynamic library files and header files for Windows*, Linux*, and macOS* operating systems used in |short_name|.
.. include:: index/useful_topics.rst
.. include:: index/toctree.rst
+5
View File
@@ -0,0 +1,5 @@
.. _index_intro:
This document contains information about |short_name|.
It is a flexible performance library that let you break computation into parallel running tasks.
+39
View File
@@ -0,0 +1,39 @@
.. _toctree:
.. toctree::
:caption: About
:maxdepth: 1
/main/intro/help_support
/main/intro/notation
/main/intro/intro_os
/main/intro/Benefits
/main/intro/testing_approach
/main/intro/limitations.rst
.. toctree::
:caption: Get Started
:maxdepth: 2
/GSG/get_started
/GSG/intro
/GSG/system_requirements
/GSG/installation
/GSG/next_steps
/GSG/integrate
/GSG/samples
.. toctree::
:maxdepth: 3
:caption: Developer Guide
/main/tbb_userguide/title
.. toctree::
:maxdepth: 3
:caption: Developer Reference
/main/reference/reference
+5
View File
@@ -0,0 +1,5 @@
.. _Usefull_Topics:
The following is an important topic for the ``experienced user``:
:ref:`Migration_Guide` describes how to migrate from TBB to oneTBB.
+37
View File
@@ -0,0 +1,37 @@
window.MathJax = {
TeX: {
Macros: {
src: '\\operatorname{src}',
srclayer: '\\operatorname{src\\_layer}',
srciter: '\\operatorname{src\\_iter}',
srciterc: '\\operatorname{src\\_iter\\_c}',
weights: '\\operatorname{weights}',
weightslayer: '\\operatorname{weights\\_layer}',
weightsiter: '\\operatorname{weights\\_iter}',
weightspeephole: '\\operatorname{weights\\_peephole}',
weightsprojection: '\\operatorname{weights\\_projection}',
bias: '\\operatorname{bias}',
dst: '\\operatorname{dst}',
dstlayer: '\\operatorname{dst\\_layer}',
dstiter: '\\operatorname{dst\\_iter}',
dstiterc: '\\operatorname{dst\\_iter\\_c}',
diffsrc: '\\operatorname{diff\\_src}',
diffsrclayer: '\\operatorname{diff\\_src\\_layer}',
diffsrciter: '\\operatorname{diff\\_src\\_iter}',
diffsrciterc: '\\operatorname{diff\\_src\\_iter\\_c}',
diffweights: '\\operatorname{diff\\_weights}',
diffweightslayer: '\\operatorname{diff\\_weights\\_layer}',
diffweightsiter: '\\operatorname{diff\\_weights\\_iter}',
diffweightspeephole: '\\operatorname{diff\\_weights\\_peephole}',
diffweightsprojection: '\\operatorname{diff\\_weights\\_projection}',
diffbias: '\\operatorname{diff\\_bias}',
diffdst: '\\operatorname{diff\\_dst}',
diffdstlayer: '\\operatorname{diff\\_dst\\_layer}',
diffdstiter: '\\operatorname{diff\\_dst\\_iter}',
diffdstiterc: '\\operatorname{diff\\_dst\\_iter\\_c}',
diffgamma: '\\operatorname{diff\\_\\gamma}',
diffbeta: '\\operatorname{diff\\_\\beta}',
workspace: '\\operatorname{workspace}'
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

+13
View File
@@ -0,0 +1,13 @@
/* override table width restrictions */
@media screen and (min-width: 767px) {
.wy-table-responsive table td {
/* !important prevents the common CSS stylesheets from overriding
this as on RTD they are loaded after this stylesheet */
white-space: normal !important;
}
.wy-table-responsive {
overflow: visible !important;
}
}
+15
View File
@@ -0,0 +1,15 @@
{% extends "!layout.html" %}
{% block extrahead %}
<script defer type="text/javascript" src="https://www.intel.com/content/dam/www/global/wap/performance-config.js" ></script>
<script type="text/javascript">
// Configure TMS settings
var wapLocalCode = 'us-en'; // Dynamically set per localized site, see mapping table for values
var wapSection = "oneapi-tbb"; // WAP team will give you a unique section for your site
// Load TMS
(function () {
var url = 'https://www.intel.com/content/dam/www/global/wap/tms-loader.js'; // WAP file URL
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = url;
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
{% endblock %}
+295
View File
@@ -0,0 +1,295 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
SOURCE_DIR = os.path.dirname(__file__)
LATEX_DIR = os.path.join(SOURCE_DIR, '_latex')
PREAMBLE_FILE = os.path.join(LATEX_DIR, 'preamble.tex')
TITLE_PAGE_FILE = os.path.join(LATEX_DIR, 'title_page.tex')
BUILD_TYPE = os.getenv("BUILD_TYPE")
# -- Project information -----------------------------------------------------
if BUILD_TYPE == 'oneapi' or BUILD_TYPE == 'dita':
project = u'Intel® oneAPI Threading Building Blocks (oneTBB)'
else:
project = u'oneAPI Threading Building Blocks (oneTBB)'
copyright = u'2021, Intel Corporation'
author = u'Intel'
# The short X.Y version
version = u''
# The full version, including alpha/beta/rc tags
release = u''
# -- General configuration ---------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.imgmath',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages'
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
#master_doc = 'main/title_main'
master_doc = 'index'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = None
# Syntax highlighting for the :: directive
highlight_language = 'cpp'
if BUILD_TYPE == 'oneapi' or BUILD_TYPE == 'dita':
rst_prolog = """
.. |full_name| replace:: Intel\ |reg|\ oneAPI Threading Building Blocks (oneTBB)
.. |short_name| replace:: oneTBB
.. |product| replace:: oneTBB
.. |reg| unicode:: U+000AE
.. |copy| unicode:: U+000A9
.. |base_tk| replace:: Intel\ |reg|\ oneAPI Base Toolkit
.. |dpcpp| replace:: Intel\ |reg|\ oneAPI DPC++/C++ Compiler
"""
else:
rst_prolog = """
.. |full_name| replace:: oneAPI Threading Building Blocks (oneTBB)
.. |short_name| replace:: oneTBB
.. |product| replace:: oneTBB
.. |reg| unicode:: U+000AE
.. |copy| unicode:: U+000A9
.. |base_tk| replace:: Intel\ |reg|\ oneAPI Base Toolkit
.. |dpcpp| replace:: Intel\ |reg|\ oneAPI DPC++/C++ Compiler
"""
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
if BUILD_TYPE == 'oneapi' or BUILD_TYPE == 'dita':
html_theme = 'sphinx_rtd_theme'
else:
html_theme = 'sphinx_book_theme'
html_theme_options = {
'repository_url': 'https://github.com/oneapi-src/oneTBB',
'path_to_docs': 'doc/main',
'use_issues_button': True,
'use_edit_page_button': True,
'repository_branch': 'master',
'extra_footer': '<p align="right"><a href="https://www.intel.com/content/www/us/en/privacy/intel-cookie-notice.html">Cookies</a></p>'
}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
if BUILD_TYPE == 'oneapi' or BUILD_TYPE == 'dita':
html_context = {
'css_files': [
'_static/theme_overrides.css', # override wide tables in RTD theme
],
}
else:
html_js_files = ['custom.js']
html_logo = '_static/oneAPI-rgb-rev-100.png'
html_favicon = '_static/favicons.png'
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}
# -- Options for HTMLHelp output ---------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'sphinx-infodevdoc'
# -- Options for LaTeX output ------------------------------------------------
#latex_engine = 'xelatex'
#PDF_TITLE = 'Information Development Template'
#
#with open(PREAMBLE_FILE, 'r', encoding='utf-8') as f:
# PREAMBLE = f.read()
#
#with open(TITLE_PAGE_FILE, 'r', encoding='utf-8') as f:
# TITLE_PAGE = f.read().replace('<PDF_TITLE>', PDF_TITLE)
#
#
#latex_elements = {
# # The paper size ('letterpaper' or 'a4paper').
# #
# 'extraclassoptions': 'openany,oneside',
# 'babel' : '\\usepackage[english]{babel}',
# 'papersize': 'a4paper',
# 'releasename':" ",
# # Sonny, Lenny, Glenn, Conny, Rejne, Bjarne and Bjornstrup
# # 'fncychap': '\\usepackage[Lenny]{fncychap}',
# 'fncychap': '',
# #'fontpkg': '\\usepackage{amsmath,amsfonts,amssymb,amsthm}',
#
# 'figure_align':'htbp',
# # The font size ('10pt', '11pt' or '12pt').
# #
# 'pointsize': '12pt',
#
# # Additional stuff for the LaTeX preamble.
# #
# 'preamble': PREAMBLE,
#
# 'maketitle': TITLE_PAGE,
# # Latex figure (float) alignment
# #
# # 'figure_align': 'htbp',
# 'sphinxsetup': \
# 'hmargin={0.7in,0.7in}, vmargin={1in,1in}, \
# verbatimwithframe=true, \
# TitleColor={rgb}{0,0.686,0.941}, \
# HeaderFamily=\\rmfamily\\bfseries, \
# InnerLinkColor={rgb}{0,0.686,0.941}, \
# OuterLinkColor={rgb}{0,0.686,0.941}',
#
# 'tableofcontents':' '
#}
#
#latex_logo = '_latex/intel_logo.png'
## Grouping the document tree into LaTeX files. List of tuples
## (source start file, target name, title,
## author, documentclass [howto, manual, or own class]).
#latex_documents = [
# (master_doc, 'sphinx-infodev.tex', u'sphinx-infodev Documentation',
# u'Intel', 'manual'),
#]
#breathe_projects = { #todd-mod
# project: "../doxygen/xml"
#}
#breathe_default_project = project
# Setup the exhale extension
#exhale_args = { #todd-mod
# # These arguments are required
# "containmentFolder": "./api",
# "rootFileName": "library_root.rst",
# "rootFileTitle": "Library API",
# "doxygenStripFromPath": "..",
# "fullApiSubSectionTitle": 'Full API'
#}
# -- Options for manual page output ------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'sphinx-infodev', u'sphinx-infodev Documentation',
[author], 1)
]
# -- Options for Texinfo output ----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'sphinx-infodev', u'sphinx-infodev Documentation',
author, 'sphinx-infodev', 'One line description of project.',
'Miscellaneous'),
]
# -- Options for Epub output -------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = project
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#
# epub_identifier = ''
# A unique identification for the text.
#
# epub_uid = ''
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
# -- Extension configuration -------------------------------------------------
# -- Options for intersphinx extension ---------------------------------------
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
# -- Options for todo extension ----------------------------------------------
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
+37
View File
@@ -0,0 +1,37 @@
|full_name|
===========
This document contains information about |full_name|.
|short_name| is a flexible performance library that can be found in the |base_tk|
or as a stand-alone product. More information and specifications can be found on the
|full_name| main page.
Documentation for older versions of |short_name| is available for download only.
For a list of available documentation downloads by product version, see these pages:
* `Download Documentation for Intel Parallel Studio XE <https://software.intel.com/content/www/us/en/develop/articles/download-documentation-intel-parallel-studio-xe-current-previous.html>`_
* `Download Documentation for Intel System Studio <https://software.intel.com/content/www/us/en/develop/articles/download-documentation-intel-system-studio-current-previous.html>`_
The following are some important topics for the ``novice user``:
* `Get Started with oneTBB <https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-onetbb/top.html>`_ gives you a brief explanation of what oneTBB is.
* :ref:`Benefits` describes how |short_name| differs from typical threading packages.
* :ref:`Package_Contents` describes dynamic library files and header files for Windows*, Linux*, and macOS* operating systems used in |short_name|.
The following is an important topic for the ``experienced user``:
:ref:`Migration_Guide` describes how to migrate from TBB to oneTBB.
.. toctree::
:maxdepth: 2
intro/help_support
intro/notation
intro/intro
intro/Benefits
tbb_userguide/title
reference/reference
intro/notices_and_disclaimers
+88
View File
@@ -0,0 +1,88 @@
.. _Benefits:
|short_name| Benefits
=====================
|full_name| is a library that helps you leverage multi-core performance
without having to be a threading expert. Typically you can improve
performance for multi-core processors by implementing the key points
explained in the early sections of the Developer Guide. As your
expertise grows, you may want to dive into more complex subjects that
are covered in advanced sections.
There are a variety of approaches to parallel programming, ranging from
using platform-dependent threading primitives to exotic new languages.
The advantage of oneTBB is that it works at a higher level than raw
threads, yet does not require exotic languages or compilers. You can use
it with any compiler supporting ISO C++. The library differs from
typical threading packages in the following ways:
- **oneTBB enables you to specify logical parallelism instead of
threads**. Most threading packages require you to specify threads.
Programming directly in terms of threads can be tedious and lead to
inefficient programs, because threads are low-level, heavy constructs
that are close to the hardware. Direct programming with threads
forces you to efficiently map logical tasks onto threads. In
contrast, the oneTBB run-time library automatically maps logical
parallelism onto threads in a way that makes efficient use of
processor resources.
- **oneTBB targets threading for performance**. Most general-purpose
threading packages support many different kinds of threading, such as
threading for asynchronous events in graphical user interfaces. As a
result, general-purpose packages tend to be low-level tools that
provide a foundation, not a solution. Instead, oneTBB focuses on the
particular goal of parallelizing computationally intensive work,
delivering higher-level, simpler solutions.
- **oneTBB is compatible with other threading packages.** Because the
library is not designed to address all threading problems, it can
coexist seamlessly with other threading packages.
- **oneTBB emphasizes scalable, data parallel programming**. Breaking a
program up into separate functional blocks, and assigning a separate
thread to each block is a solution that typically does not scale well
since typically the number of functional blocks is fixed. In
contrast, oneTBB emphasizes *data-parallel* programming, enabling
multiple threads to work on different parts of a collection.
Data-parallel programming scales well to larger numbers of processors
by dividing the collection into smaller pieces. With data-parallel
programming, program performance increases as you add processors.
- **oneTBB relies on generic programming**. Traditional libraries
specify interfaces in terms of specific types or base classes.
Instead, oneAPI Threading Building Blocks uses generic programming.
The essence of generic programming is writing the best possible
algorithms with the fewest constraints. The C++ Standard Template
Library (STL) is a good example of generic programming in which the
interfaces are specified by *requirements* on types. For example, C++
STL has a template function ``sort`` that sorts a sequence abstractly
defined in terms of iterators on the sequence. The requirements on
the iterators are:
- Provide random access
- The expression ``*i<*j`` is true if the item pointed to by
iterator ``i`` should precede the item pointed to by iterator
``j``, and false otherwise.
- The expression ``swap(*i,*j)`` swaps two elements.
Specification in terms of requirements on types enables the template to
sort many different representations of sequences, such as vectors and
deques. Similarly, the oneTBB templates specify requirements on types,
not particular types, and thus adapt to different data representations.
Generic programming enables oneTBB to deliver high performance
algorithms with broad applicability.
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

+15
View File
@@ -0,0 +1,15 @@
.. _help_support:
Getting Help and Support
========================
.. container:: section
.. rubric:: Getting Technical Support
:class: sectiontitle
For general information about oneTBB technical support, product
updates, user forums, FAQs, tips and tricks and other support
questions, go to `GitHub issues <https://github.com/oneapi-src/oneTBB/issues>`_.
+39
View File
@@ -0,0 +1,39 @@
.. _intro:
Introduction
============
|full_name| is a library that supports scalable parallel programming using
standard ISO C++ code. It does not require special languages or
compilers. It is designed to promote scalable data parallel programming.
Additionally, it fully supports nested parallelism, so you can build
larger parallel components from smaller parallel components. To use the
library, you specify tasks, not threads, and let the library map tasks
onto threads in an efficient manner.
Many of the library interfaces employ generic programming, in which
interfaces are defined by requirements on types and not specific types.
The C++ Standard Template Library (STL) is an example of generic
programming. Generic programming enables oneTBB to be flexible yet
efficient. The generic interfaces enable you to customize components to
your specific needs.
.. note::
|full_name| requires C++11 standard compiler support.
The net result is that oneTBB enables you to specify parallelism far
more conveniently than using raw threads, and at the same time can
improve performance.
.. admonition:: Product and Performance Information
Performance varies by use, configuration and other factors. Learn more at `www.intel.com/PerformanceIndex <https://www.intel.com/PerformanceIndex>`_.
Notice revision #20201201
+35
View File
@@ -0,0 +1,35 @@
.. _intro:
Introduction
============
|full_name| is a library that supports scalable parallel programming using
standard ISO C++ code. It does not require special languages or
compilers. It is designed to promote scalable data parallel programming.
Additionally, it fully supports nested parallelism, so you can build
larger parallel components from smaller parallel components. To use the
library, you specify tasks, not threads, and let the library map tasks
onto threads in an efficient manner.
Many of the library interfaces employ generic programming, in which
interfaces are defined by requirements on types and not specific types.
The C++ Standard Template Library (STL) is an example of generic
programming. Generic programming enables oneTBB to be flexible yet
efficient. The generic interfaces enable you to customize components to
your specific needs.
.. note::
|full_name| requires C++11 standard compiler support.
The net result is that oneTBB enables you to specify parallelism far
more conveniently than using raw threads, and at the same time can
improve performance.
+39
View File
@@ -0,0 +1,39 @@
.. _introducing_main:
Introduction
============
|full_name| is a library that supports scalable parallel programming using
standard ISO C++ code. It does not require special languages or
compilers. It is designed to promote scalable data parallel programming.
Additionally, it fully supports nested parallelism, so you can build
larger parallel components from smaller parallel components. To use the
library, you specify tasks, not threads, and let the library map tasks
onto threads in an efficient manner.
Many of the library interfaces employ generic programming, in which
interfaces are defined by requirements on types and not specific types.
The C++ Standard Template Library (STL) is an example of generic
programming. Generic programming enables oneTBB to be flexible yet
efficient. The generic interfaces enable you to customize components to
your specific needs.
.. note::
|full_name| requires C++11 standard compiler support.
The net result is that oneTBB enables you to specify parallelism far
more conveniently than using raw threads, and at the same time can
improve performance.
.. admonition:: Product and Performance Information
Performance varies by use, configuration and other factors. Learn more at `www.intel.com/PerformanceIndex <https://www.intel.com/PerformanceIndex>`_.
Notice revision #20201201
+46
View File
@@ -0,0 +1,46 @@
.. _limitations:
Known Limitations
*****************
This page outlines the known limitations of oneTBB to help you better understand its capabilities.
Freestanding Compilation Mode
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
**Limitation:** oneTBB does not support the freestanding compilation mode.
**Risk:** Compiling an application that utilizes oneTBB headers using the Intel(R) oneAPI DPC+/C+ Compiler may result in failure on Windows* OS if the ``/Qfreestanding`` compiler option is employed.
Static Assert
^^^^^^^^^^^^^
**Limitation:** A static assert causes the compilation failures in oneTBB headers if the following conditions are satisfied:
* Compilation is done with Clang 12.0.0 or a more recent version.
* The LLVM standard library is employed, coupled with the use of the ``-ffreestanding`` flag and C++11/14 compiler options.
**Risk:** The compilation failures.
Interface Incompatibilities: TBB vs oneTBB
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
**Limitation:** An application using Parallel STL algorithms in the ``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).
**Solution:** 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.
Incorrect Installation Location
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
**Limitation:** On Linux* OS, if oneAPI Threading Building Blocks (oneTBB) or Threading Building Blocks (TBB) are installed in a system folder, such as ``/usr/lib64``, the application may fail to link due to the order in which the linker searches for libraries.
**Risk:** The issue does not affect the program execution.
**Solution:** Use the ``-L`` linker option to specify the correct location of oneTBB library.
``fork()`` Support
^^^^^^^^^^^^^^^^^^^
**Limitation:** oneTBB does not support ``fork()``.
**Solution:** To work-around the issue, consider using ``task_scheduler_handle`` to join oneTBB worker threads before using ``fork()``.
+106
View File
@@ -0,0 +1,106 @@
.. _notation:
Notational Conventions
======================
The following conventions may be used in this document.
.. container:: tablenoborder
.. list-table::
:header-rows: 1
* - Convention
- Explanation
- Example
* - \ *Italic*
- Used for introducing new terms, denotation of terms, placeholders, or titles of manuals.
- The filename consists of the *basename* and the *extension*.
* - \ ``Monospace``
- Indicates directory paths and filenames, commands and command line options, function names, methods, classes, data structures in body text, source code.
- \ ``ippsapi.h`` \ ``\alt\include`` Use the okCreateObjs() function to... \ ``printf("hello, world\n");``
* - [ ]
- Items enclosed in brackets are optional.
- Fa[c] Indicates Fa or Fac.
* - { \| }
- Braces and vertical bars indicate the choice of one item from a selection of two or more items.
- X{K \| W \| P} Indicates XK, XW, or XP.
* - "[" "]" "{" | " }" "|"
- Writing a metacharacter in quotation marks negates the syntactical meaning stated above; | the character is taken as a literal.
- "[" X "]" [ Y ] Denotes the letter X enclosed in brackets, optionally followed by the letter Y.
* - ...
- The ellipsis indicates that the previous item can be repeated several times.
- \ ``filename`` ... Indicates that one or more filenames can be specified.
* - ,...
- The ellipsis preceded by a comma indicates that the previous item can be repeated several times, | separated by commas.
- \ ``word`` ,... Indicates that one or more words can be specified. If more than one word is specified, the words are comma-separated.
.. container:: section
Class members are summarized by informal class declarations that
describe the class as it seems to clients, not how it is actually
implemented. For example, here is an informal declaration of class
``Foo``:
::
class Foo {
public:
int x();
int y;
~Foo();
};
The actual implementation might look like:
::
namespace internal {
class FooBase {
protected:
int x();
};
class Foo_v3: protected FooBase {
private:
int internal_stuff;
public:
using FooBase::x;
int y;
};
}
typedef internal::Foo_v3 Foo;
The example shows two cases where the actual implementation departs
from the informal declaration:
- ``Foo`` is actually a typedef to ``Foo_v3``.
- Method ``x()`` is inherited from a protected base class.
- The destructor is an implicit method generated by the compiler.
The informal declarations are intended to show you what you need to
know to use the class without the distraction of irrelevant clutter
particular to the implementation.
@@ -0,0 +1,49 @@
.. _notices_and_disclaimers:
Notices and Disclaimers
=======================
Intel technologies may require enabled hardware, software or service
activation.
No product or component can be absolutely secure.
Your costs and results may vary.
© Intel Corporation. Intel, the Intel logo, and other Intel marks are
trademarks of Intel Corporation or its subsidiaries. Other names and
brands may be claimed as the property of others.
Intel's compilers may or may not optimize to the same degree for
non-Intel microprocessors for optimizations that are not unique to Intel
microprocessors. These optimizations include SSE2, SSE3, and SSSE3
instruction sets and other optimizations. Intel does not guarantee the
availability, functionality, or effectiveness of any optimization on
microprocessors not manufactured by Intel. Microprocessor-dependent
optimizations in this product are intended for use with Intel
microprocessors. Certain optimizations not specific to Intel
microarchitecture are reserved for Intel microprocessors. Please refer
to the applicable product User and Reference Guides for more information
regarding the specific instruction sets covered by this notice.
No license (express or implied, by estoppel or otherwise) to any
intellectual property rights is granted by this document.
The products described may contain design defects or errors known as
errata which may cause the product to deviate from published
specifications. Current characterized errata are available on request.
Intel disclaims all express and implied warranties, including without
limitation, the implied warranties of merchantability, fitness for a
particular purpose, and non-infringement, as well as any warranty
arising from course of performance, course of dealing, or usage in
trade.
+31
View File
@@ -0,0 +1,31 @@
.. _testing_approach:
Testing Approach
================
There are four main types of errors/hazards you can encounter in the development of libraries for parallelism:
* Interface correspondence to specification
* Memory errors
* Data race
* Race conditions and deadlocks
|short_name| testing approach is designed to provide high coverage of these error types.
All types of errors are covered with unit testing and review.
Code coverage metrics are tracked to ensure high code coverage with tests. Uncovered branches are analyzed manually.
Memory errors and data races are additionally covered by special tools that include thread and memory sanitizers.
Race conditions and deadlocks are the most complicated errors.
They are covered by:
* **Unit tests** that, however, have limited capability to catch such errors
* **Integration tests**. Multiple different functionalities are heavily combined to emulate user use cases that may trigger such errors based on prior knowledge and expertise.
* **Stress testing with different possible combinations**. It ensures that even rarely triggered error conditions are caught by testing.
.. note:: Every fix is required to be covered by a test to guarantee the detection of such issues in the future.
Continuous Integration triggers all the tests on each commit. This ensures that:
* Issues are detected, starting from the early development phase and up to the moment of integration of changes into the library.
* The highest quality of the library is maintained even in such error-prone domains as parallelism.
Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 KiB

+165
View File
@@ -0,0 +1,165 @@
.. _task_scheduler_handle_reference:
task_scheduler_handle Class
===========================
.. note::
To enable this feature, set the ``TBB_PREVIEW_WAITING_FOR_WORKERS`` macro to 1.
.. contents::
:local:
:depth: 1
Description
***********
The ``oneapi::tbb::task_scheduler_handle`` class and the ``oneapi::tbb::finalize`` function allow to wait for completion of worker threads.
When the ``oneapi::tbb::finalize`` function is called with an ``oneapi::tbb::task_scheduler_handle`` instance, it blocks the calling
thread until the completion of all worker threads that were implicitly created by the library.
API
***
Header
------
.. code:: cpp
#include <oneapi/tbb/global_control.h>
Synopsis
--------
.. code:: cpp
namespace oneapi {
namespace tbb {
class task_scheduler_handle {
public:
task_scheduler_handle() = default;
~task_scheduler_handle();
task_scheduler_handle(const task_scheduler_handle& other) = delete;
task_scheduler_handle(task_scheduler_handle&& other) noexcept;
task_scheduler_handle& operator=(const task_scheduler_handle& other) = delete;
task_scheduler_handle& operator=(task_scheduler_handle&& other) noexcept;
explicit operator bool() const noexcept;
static task_scheduler_handle get();
static void release(task_scheduler_handle& handle);
};
void finalize(task_scheduler_handle& handle);
bool finalize(task_scheduler_handle& handle, const std::nothrow_t&) noexcept;
} // namespace tbb
} // namespace oneapi
Member Functions
----------------
.. cpp:function:: task_scheduler_handle()
**Effects**: Creates an instance of the ``task_scheduler_handle`` class that does not contain any reference to the task scheduler.
-------------------------------------------------------
.. cpp:function:: ~task_scheduler_handle()
**Effects**: Destroys an instance of the ``task_scheduler_handle`` class.
Releases a reference to the task scheduler and deactivates an instance of the ``task_scheduler_handle`` class.
-------------------------------------------------------
.. cpp:function:: task_scheduler_handle(task_scheduler_handle&& other) noexcept
**Effects**: Creates an instance of the ``task_scheduler_handle`` class that references the task scheduler referenced by ``other``. In turn, ``other`` releases its reference to the task scheduler.
-------------------------------------------------------
.. cpp:function:: task_scheduler_handle& operator=(task_scheduler_handle&& other) noexcept
**Effects**: Releases a reference to the task scheduler referenced by ``this``. Adds a reference to the task scheduler referenced by ``other``.
In turn, ``other`` releases its reference to the task scheduler.
-------------------------------------------------------
.. cpp:function:: explicit operator bool() const noexcept
**Returns**: ``true`` if ``this`` references any task scheduler; ``false`` otherwise.
-------------------------------------------------------
.. cpp:function:: task_scheduler_handle get()
**Returns**: An instance of the ``task_scheduler_handle`` class that holds a reference to the task scheduler preventing
its premature destruction.
-------------------------------------------------------
.. cpp:function:: void release(task_scheduler_handle& handle)
**Effects**: Releases a reference to the task scheduler and deactivates an instance of the ``task_scheduler_handle``
class. Non-blocking method.
Non-member Functions
--------------------
.. cpp:function:: void finalize(task_scheduler_handle& handle)
**Effects**: Blocks the program execution until all worker threads have been completed. Throws the ``oneapi::tbb::unsafe_wait``
exception if it is not safe to wait for the completion of the worker threads.
The following conditions should be met for finalization to succeed:
- No active (not yet terminated) instances of class ``task_arena`` exist in the whole program;
- ``task_scheduler_handle::release`` is called for each other active instance of class ``task_scheduler_handle``, possibly by different application threads.
Under these conditions, it is guaranteed that at least one ``finalize`` call succeeds,
at which point all worker threads have been completed.
If calls are performed simultaneously, more than one call might succeed.
.. note::
If you know how many active ``task_scheduler_handle`` instances exist in the program,
it is necessary to ``release`` all but the last one, then call ``finalize`` for
the last instance.
.. caution::
The method always fails if called within a task, a parallel algorithm, or a flow graph node.
-------------------------------------------------------
.. cpp:function:: bool finalize(task_scheduler_handle& handle, const std::nothrow_t&) noexcept
**Effects**: Blocks the program execution until all worker threads have been completed. Same as above, but returns ``true`` if all worker
threads have been completed successfully, or ``false`` if it is not safe to wait for the completion of the worker threads.
Examples
********
.. code:: cpp
#define TBB_PREVIEW_WAITING_FOR_WORKERS 1
#include <oneapi/tbb/global_control.h>
#include <oneapi/tbb/parallel_for.h>
#include <iostream>
int main() {
oneapi::tbb::task_scheduler_handle handle = oneapi::tbb::task_scheduler_handle::get();
// Do some parallel work here, e.g.
oneapi::tbb::parallel_for(0, 10000, [](int){});
try {
oneapi::tbb::finalize(handle);
// oneTBB worker threads are terminated at this point.
} catch (const oneapi::tbb::unsafe_wait&) {
std::cerr << "Failed to terminate the worker threads." << std::endl;
}
return 0;
}
@@ -0,0 +1,163 @@
.. _concurrent_lru_cache:
concurrent_lru_cache
====================
.. note::
To enable this feature, define the ``TBB_PREVIEW_CONCURRENT_LRU_CACHE`` macro to 1.
A Class Template for Least Recently Used cache with concurrent operations.
.. contents::
:local:
:depth: 1
Description
***********
A ``concurrent_lru_cache`` container maps keys to values with the ability
to limit the number of stored unused values. For each key, there is at most one item
stored in the container.
The container permits multiple threads to concurrently retrieve items from it.
The container tracks which items are in use by returning a proxy
``concurrent_lru_cache::handle`` object that refers to an item instead of its value.
Once there are no ``handle`` objects holding reference to an item, it is considered unused.
The container stores all the items that are currently in use plus a limited
number of unused items. Excessive unused items are erased according to
least recently used policy.
When no item is found for a given key, the container calls the user-specified
``value_function_type`` object to construct a value for the key, and stores that value.
The ``value_function_type`` object must be thread-safe.
API
***
Header
------
.. code:: cpp
#include "oneapi/tbb/concurrent_lru_cache.h"
Synopsis
--------
.. code:: cpp
namespace oneapi {
namespace tbb {
template <typename Key, typename Value, typename ValueFunctionType = Value (*)(Key)>
class concurrent_lru_cache {
public:
using key_type = Key;
using value_type = Value;
using pointer = value_type*;
using const_pointer = const value_type*;
using reference = value_type&;
using const_reference = const value_type&;
using value_function_type = ValueFunctionType;
class handle {
public:
handle();
handle( handle&& other );
~handle();
handle& operator=( handle&& other );
operator bool() const;
value_type& value();
}; // class handle
concurrent_lru_cache( value_function_type f, std::size_t number_of_lru_history_items );
~concurrent_lru_cache();
handle operator[]( key_type key );
}; // class concurrent_lru_cache
} // namespace tbb
} // namespace oneapi
Member Functions
----------------
.. cpp:function:: concurrent_lru_cache( value_function_type f, std::size_t number_of_lru_history_items );
**Effects**: Constructs an empty cache that can keep up to ``number_of_lru_history_items``
unused values, with a function object ``f`` for constructing new values.
-------------------------------------------------------
.. cpp:function:: ~concurrent_lru_cache();
**Effects**: Destroys the ``concurrent_lru_cache``. Calls the destructors of the stored elements and
deallocates the used storage.
The behavior is undefined in case of concurrent operations with ``*this``.
-------------------------------------------------------
.. cpp:function:: handle operator[]( key_type k );
**Effects**: Searches the container for an item that corresponds to the given key.
If such an item is not found, the user-specified function object is called to
construct a value that is inserted into the container.
**Returns**: a ``handle`` object holding reference to the matching value.
Member Objects
--------------
``handle`` class
^^^^^^^^^^^^^^^^
**Member Functions**
.. cpp:function:: handle();
**Effects**: Constructs a ``handle`` object that does not refer to any value.
--------------------------------------------------
.. cpp:function:: handle( handle&& other );
**Effects**: Transfers the reference to the value stored in ``concurrent_lru_cache``
from ``other`` to the newly constructed object. Upon completion,
``other`` no longer refers to any value.
---------------------------------------------------
.. cpp:function:: ~handle();
**Effects**: Releases the reference (if it exists) to a value stored in ``concurrent_lru_cache``.
The behavior is undefined for concurrent operations with ``*this``.
---------------------------------------------------
.. cpp:function:: handle& operator=( handle&& other );
**Effects**: Transfers the reference to a value stored in ``concurrent_lru_cache`` from ``other``
to ``*this``. If existed, the previous reference held by ``*this`` is released. Upon
completion ``other`` no longer refers to any value.
**Returns**: a reference to ``*this``.
---------------------------------------------------
.. cpp:function:: operator bool() const;
**Returns**: ``true`` if ``*this`` holds reference to a value, ``false`` otherwise.
---------------------------------------------------
.. cpp:function:: value_type& value();
**Returns**: a reference to a ``value_type`` object stored in ``concurrent_lru_cache``.
The behavior is undefined if ``*this`` does not refer to any value.
@@ -0,0 +1,118 @@
.. _constraints_extensions:
task_arena::constraints extensions
======================================
.. note::
To enable this feature, set the ``TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION`` macro to 1.
.. contents::
:local:
:depth: 1
Description
***********
These extensions allow to customize ``tbb::task_arena::constraints`` with the following properties:
* On machines with Intel® Hybrid Technology set the preferred core type for threads working within the task arena.
* Limit the maximum number of threads that can be scheduled to one core simultaneously.
API
***
Header
------
.. code:: cpp
#include <oneapi/tbb/task_arena.h>
Synopsis
--------
.. code:: cpp
namespace oneapi {
namespace tbb {
class task_arena {
public:
struct constraints {
constraints& set_numa_id(numa_node_id id);
constraints& set_max_concurrency(int maximal_concurrency);
constraints& set_core_type(core_type_id id);
constraints& set_max_threads_per_core(int threads_number);
numa_node_id numa_id = task_arena::automatic;
int max_concurrency = task_arena::automatic;
core_type_id core_type = task_arena::automatic;
int max_threads_per_core = task_arena::automatic;
}; // struct constraints
}; // class task_arena
} // namespace tbb
} // namespace oneapi
Member Functions
----------------
.. cpp:function:: constraints& set_numa_id(numa_node_id id)
Sets the ``numa_id`` field to the ``id``.
**Returns:** Reference to ``*this``.
.. cpp:function:: constraints& set_max_concurrency(int maximal_concurrency)
Sets the ``max_concurrency`` field to the ``maximal_concurrency``.
**Returns:** Reference to ``*this``.
.. cpp:function:: constraints& set_core_type(core_type_id id)
Sets the ``core_type`` field to the ``id``.
**Returns:** Reference to ``*this``.
.. cpp:function:: constraints& set_max_threads_per_core(int threads_number)
Sets the ``max_threads_per_core`` field to the ``threads_number``.
**Returns:** Reference to ``*this``.
Member Objects
--------------
.. cpp:member:: numa_node_id numa_id
An integral logical index uniquely identifying a NUMA node. All threads joining the
``task_arena`` are bound to this NUMA node.
.. note::
To obtain a valid NUMA node ID, call ``oneapi::tbb::info::numa_nodes()``.
.. cpp:member:: int max_concurrency
The maximum number of threads that can participate in work processing within the
``task_arena`` at the same time.
.. cpp:member:: core_type_id core_type
An integral logical index uniquely identifying a core type. All threads joining the
``task_arena`` are bound to this core type.
.. note::
To obtain a valid core type node ID, call ``oneapi::tbb::info::core_types()``.
.. cpp:member:: int max_threads_per_core
The maximum number of threads that can be scheduled to one core simultaneously.
See also:
* :doc:`oneapi::tbb::info namespace preview extensions <info_namespace_extensions>`
* `oneapi::tbb::task_arena specification <https://spec.oneapi.com/versions/latest/elements/oneTBB/source/task_scheduler/task_arena/task_arena_cls.html>`_
@@ -0,0 +1,104 @@
.. _constructors_for_fg_nodes:
Constructors for Flow Graph nodes
=================================
.. note::
To enable this feature, define the ``TBB_PREVIEW_FLOW_GRAPH_FEATURES`` macro to 1.
.. contents::
:local:
:depth: 1
Description
***********
The "Helper Functions for Expressing Graphs" feature adds a set of new constructors
that can be used to construct a node that ``follows`` or ``precedes`` a set of nodes.
Where possible, the constructors support Class Template Argument Deduction (since C++17).
API
***
Header
------
.. code:: cpp
#include <oneapi/tbb/flow_graph.h>
Syntax
------
.. code:: cpp
// continue_node
continue_node(follows(...), Body body, Policy = Policy());
continue_node(precedes(...), Body body, Policy = Policy());
continue_node(follows(...), int number_of_predecessors, Body body, Policy = Policy());
continue_node(precedes(...), int number_of_predecessors, Body body, Policy = Policy());
// function_node
function_node(follows(...), std::size_t concurrency, Policy = Policy());
function_node(precedes(...), std::size_t concurrency, Policy = Policy());
// input_node
input_node(precedes(...), body);
// multifunction_node
multifunction_node(follows(...), std::size_t concurrency, Body body);
multifunction_node(precedes(...), std::size_t concurrency, Body body);
// async_node
async_node(follows(...), std::size_t concurrency, Body body);
async_node(precedes(...), std::size_t concurrency, Body body);
// overwrite_node
explicit overwrite_node(follows(...));
explicit overwrite_node(precedes(...));
// write_once_node
explicit write_once_node(follows(...));
explicit write_once_node(precedes(...));
// buffer_node
explicit buffer_node(follows(...));
explicit buffer_node(precedes(...));
// queue_node
explicit queue_node(follows(...));
explicit queue_node(precedes(...));
// priority_queue_node
explicit priority_queue_node(follows(...), const Compare& comp = Compare());
explicit priority_queue_node(precedes(...), const Compare& compare = Compare());
// sequencer_node
sequencer_node(follows(...), const Sequencer& s);
sequencer_node(precedes(...), const Sequencer& s);
// limiter_node
limiter_node(follows(...), std::size_t threshold);
limiter_node(precedes(...), std::size_t threshold);
// broadcast_node
explicit broadcast_node(follows(...));
explicit broadcast_node(precedes(...));
// join_node
explicit join_node(follows(...), Policy = Policy());
explicit join_node(precedes(...), Policy = Policy());
// split_node
explicit split_node(follows(...));
explicit split_node(precedes(...));
// indexer_node
indexer_node(follows(...));
indexer_node(precedes(...));
See Also
********
:ref:`follows_precedes`
+158
View File
@@ -0,0 +1,158 @@
.. _custom_mutex_chmap:
The customizing mutex type for ``concurrent_hash_map``
======================================================
.. note::
To enable this feature, define the ``TBB_PREVIEW_CONCURRENT_HASH_MAP_EXTENSIONS`` macro to 1.
.. contents::
:local:
:depth: 1
Description
***********
oneTBB ``concurrnent_hash_map`` class uses reader-writer mutex
to provide thread safety and avoid data races for insert, lookup, and erasure operations. This feature adds an extra template parameter
for ``concurrent_hash_map`` that allows to customize the type of the reader-writer mutex.
API
***
Header
------
.. code:: cpp
#include <oneapi/tbb/concurrent_hash_map.h>
Synopsis
--------
.. code:: cpp
namespace oneapi {
namespace tbb {
template <typename Key, typename T,
typename HashCompare = tbb_hash_compare<Key>,
typename Allocator = tbb_allocator<std::pair<const Key, T>>,
typename Mutex = spin_rw_mutex>
class concurrent_hash_map {
using mutex_type = Mutex;
};
} // namespace tbb
} // namespace oneapi
Type requirements
-----------------
The type of the mutex passed as a template argument for ``concurrent_hash_map`` should
meet the requirements of `ReaderWriterMutex <https://spec.oneapi.com/versions/latest/elements/oneTBB/source/named_requirements/mutexes/rw_mutex.html>`_.
It should also provide the following API:
.. cpp:function:: bool ReaderWriterMutex::scoped_lock::is_writer() const;
**Returns**: ``true`` if the ``scoped_lock`` object acquires the mutex as a writer, ``false`` otherwise.
The behavior is undefined if the ``scoped_lock`` object does not acquire the mutex.
``oneapi::tbb::spin_rw_mutex``, ``oneapi::tbb::speculative_spin_rw_mutex``, ``oneapi::tbb::queuing_rw_mutex``, ``oneapi::tbb::null_rw_mutex``,
and ``oneapi::tbb::rw_mutex`` meet the requirements above.
.. rubric:: Example
The example below demonstrates how to wrap ``std::shared_mutex`` (C++17) to meet the requirements
of `ReaderWriterMutex` and how to customize ``concurrent_hash_map`` to use this mutex.
.. code:: cpp
#define TBB_PREVIEW_CONCURRENT_HASH_MAP_EXTENSIONS 1
#include "oneapi/tbb/concurrent_hash_map.h"
#include <shared_mutex>
class SharedMutexWrapper {
public:
// ReaderWriterMutex requirements
static constexpr bool is_rw_mutex = true;
static constexpr bool is_recursive_mutex = false;
static constexpr bool is_fair_mutex = false;
class scoped_lock {
public:
scoped_lock() : my_mutex_ptr(nullptr), my_writer_flag(false) {}
scoped_lock(SharedMutexWrapper& mutex, bool write = true)
: my_mutex_ptr(&mutex), my_writer_flag(write)
{
if (my_writer_flag) {
my_mutex_ptr->my_mutex.lock();
} else {
my_mutex_ptr->my_mutex.lock_shared();
}
}
~scoped_lock() {
if (my_mutex_ptr) release();
}
void acquire(SharedMutexWrapper& mutex, bool write = true) {
if (my_mutex_ptr) release();
my_mutex_ptr = &mutex;
my_writer_flag = write;
if (my_writer_flag) {
my_mutex_ptr->my_mutex.lock();
} else {
my_mutex_ptr->my_mutex.lock_shared();
}
}
void release() {
if (my_writer_flag) {
my_mutex_ptr->my_mutex.unlock();
} else {
my_mutex_ptr->my_mutex.unlock_shared();
}
}
bool upgrade_to_writer() {
// std::shared_mutex does not have the upgrade/downgrade parallel_for_each_semantics
if (my_writer_flag) return true; // Already a writer
my_mutex_ptr->my_mutex.unlock_shared();
my_mutex_ptr->my_mutex.lock();
return false; // The lock was reacquired
}
bool downgrade_to_reader() {
if (!my_writer_flag) return true; // Already a reader
my_mutex_ptr->my_mutex.unlock();
my_mutex_ptr->my_mutex.lock_shared();
return false;
}
bool is_writer() const {
return my_writer_flag;
}
private:
SharedMutexWrapper* my_mutex_ptr;
bool my_writer_flag;
};
private:
std::shared_mutex my_mutex;
}; // struct SharedMutexWrapper
int main() {
using map_type = oneapi::tbb::concurrent_hash_map<int, int,
oneapi::tbb::tbb_hash_compare<int>,
oneapi::tbb::tbb_allocator<std::pair<const int, int>>,
SharedMutexWrapper>;
map_type map; // This object will use SharedMutexWrapper for thread safety of insert/find/erase operations
}
@@ -0,0 +1,78 @@
.. _follows_precedes:
``follows`` and ``precedes`` function templates
===============================================
.. note::
To enable this feature, define the ``TBB_PREVIEW_FLOW_GRAPH_FEATURES`` macro to 1.
The ``follows`` and ``precedes`` helper functions aid in expressing
dependencies between nodes when building oneTBB flow graphs. These helper functions can
only be used while constructing the node.
.. contents::
:local:
:depth: 1
Description
***********
The ``follows`` helper function specifies that the node being constructed is
the successor of the set of nodes passed as an argument.
The ``precedes`` helper function specifies that the node being constructed is
the predecessor of the set of nodes passed as an argument.
Functions ``follows`` and ``precedes`` are meant to replace the graph argument, which is
passed as the first argument to the constructor of the node. The graph argument for the
node being constructed is obtained either from the specified node set or the sequence of nodes passed
to ``follows`` or ``precedes``.
If the nodes passed to ``follows`` or ``precedes`` belong to
different graphs, the behavior is undefined.
API
***
Header
------
.. code:: cpp
#include <oneapi/tbb/flow_graph.h>
Syntax
------
.. code:: cpp
// node_set is an exposition-only name for the type returned from make_node_set function
template <typename NodeType, typename... NodeTypes>
/*unspecified*/ follows( node_set<NodeType, NodeTypes...>& set );
template <typename NodeType, typename... NodeTypes>
/*unspecified*/ follows( NodeType& node, NodeTypes&... nodes );
template <typename NodeType, typename... NodeTypes>
/*unspecified*/ precedes( node_set<NodeType, NodeTypes...>& set );
template <typename NodeType, typename... NodeTypes>
/*unspecified*/ precedes( NodeType& node, NodeTypes&... nodes );
Input Parameters
----------------
Either a set or a sequence of nodes can be used as arguments for ``follows`` and
``precedes``. The following expressions are equivalent:
.. code-block:: cpp
:caption: A set of nodes as an input
auto handlers = make_node_set(n1, n2, n3);
broadcast_node<int> input(precedes(handlers));
.. code-block:: cpp
:caption: A sequence of nodes as an input
broadcast_node<int> input(precedes(n1, n2, n3));
@@ -0,0 +1,118 @@
.. _helpers_for_expressing_graphs:
Helper Functions for Expressing Graphs
======================================
.. note::
To enable this feature, define the ``TBB_PREVIEW_FLOW_GRAPH_FEATURES`` macro to 1.
Helper functions are intended to make creation of the flow graphs less verbose.
.. contents::
:local:
:depth: 1
Description
***********
This feature adds ``make_edges``, ``make_node_set``,
``follows`` and ``precedes`` functions to ``oneapi::tbb::flow`` namespace.
These functions simplify the process of building flow graphs by allowing to gather nodes
into sets and connect them to other nodes in the graph.
API
***
.. toctree::
:titlesonly:
constructors_for_nodes
follows_and_precedes_functions
make_node_set_function
make_edges_function
Example
*******
Consider the graph depicted below.
.. figure:: ./Resources/fg_api_graph_structure.png
:align: center
In the examples below, C++17 Class Template Argument Deduction is used
to avoid template parameter specification where possible.
**Regular API**
.. code:: cpp
#include <oneapi/tbb/flow_graph.h>
int main() {
using namespace oneapi::tbb::flow;
graph g;
broadcast_node<int> input(g);
function_node doubler(g, unlimited, [](const int& v) { return 2 * v; });
function_node squarer(g, unlimited, [](const int&) { return v * v; });
function_node cuber(g, unlimited, [](const int& v) { return v * v * v; });
join_node<std::tuple<int, int, int>> join(g);
int sum = 0;
function_node summer(g, serial, [&](const std::tuple<int, int, int>& v) {
int sub_sum = std::get<0>(v) + std::get<1>(v) + std::get<2>(v);
sum += sub_sum;
return sub_sum;
});
make_edge(input, doubler);
make_edge(input, squarer);
make_edge(input, cuber);
make_edge(doubler, std::get<0>(join.input_ports()));
make_edge(squarer, std::get<1>(join.input_ports()));
make_edge(cuber, std::get<2>(join.input_ports()));
make_edge(join, summer);
for (int i = 1; i <= 10; ++i) {
input.try_put(i);
}
g.wait_for_all();
}
**Preview API**
.. code:: cpp
#define TBB_PREVIEW_FLOW_GRAPH_FEATURES 1
#include <oneapi/tbb/flow_graph.h>
int main() {
using namespace oneapi::tbb::flow;
graph g;
function_node doubler(g, unlimited, [](const int& v) { return 2 * v; });
function_node squarer(g, unlimited, [](const int&) { return v * v; });
function_node cuber(g, unlimited, [](const int& v) { return v * v * v; });
auto handlers = make_node_set(doubler, squarer, cuber);
broadcast_node input(precedes(handlers));
join_node join(follows(handlers));
int sum = 0;
function_node summer(follows(join), serial,
[&](const std::tuple<int, int, int>& v) {
int sub_sum = std::get<0>(v) + std::get<1>(v) + std::get<2>(v);
sum += sub_sum;
return sub_sum;
});
for (int i = 1; i <= 10; ++i) {
input.try_put(i);
}
g.wait_for_all();
}
@@ -0,0 +1,241 @@
.. _heterogeneous_extensions_chmap:
Heterogeneous overloads for ``concurrent_hash_map`` member functions
====================================================================
.. note::
To enable this feature, define the ``TBB_PREVIEW_CONCURRENT_HASH_MAP_EXTENSIONS`` macro to 1.
A set of overloads for ``concurrent_hash_map`` member functions that allow to search, erase, and insert
elements into the container without creating a temporary ``key_type`` object.
.. contents::
:local:
:depth: 1
Description
***********
Heterogeneous overloads allow you to perform insert, lookup, and erasure operations on ``concurrent_hash_map`` object
using an object of the type that is different from ``key_type`` but comparable with it.
All member functions described below only participate in overload resolution if ``HashCompareType::is_transparent``
is valid and denotes a type.``HashCompareType`` is a type of the ``HashCompare`` passed as a template argument
for ``concurrent_hash_map``. It means that the ``HashCompare`` object calculates a hash and compares keys for
equality without creating a temporary ``key_type`` object.
API
***
Header
------
.. code:: cpp
#include "oneapi/tbb/concurrent_hash_map.h"
Synopsis
--------
.. code:: cpp
namespace oneapi {
namespace tbb {
template <typename Key, typename Mapped,
typename HashCompare = tbb_hash_compare<Key>,
typename Allocator = tbb_allocator<std::pair<const Key, Mapped>>>
class concurrent_hash_map {
public:
// Insertion
template <typename K>
bool insert( accessor& result, const K& k );
template <typename K>
bool insert( const_accessor& result, const K& k );
// Lookup
template <typename K>
bool find( accessor& result, const K& k );
template <typename K>
bool find( const_accessor& result, const K& k ) const;
template <typename K>
size_type count( const K& k ) const;
template <typename K>
std::pair<iterator, iterator> equal_range( const K& k );
template <typename K>
std::pair<const_iterator, const_iterator> equal_range( const K& k ) const;
// Erasure
template <typename K>
bool erase( const K& k );
};
} // namespace tbb
} // namespace oneapi
Member functions
----------------
Insertion
^^^^^^^^^
.. code:: cpp
template <typename K>
bool insert( accessor& result, const K& k );
template <typename K>
bool insert( const_accessor& result, const K& k );
If the accessor ``result`` is not empty, releases the ``result`` and tries to
insert the value constructed from ``{k, mapped_type()}`` into the container.
Sets the ``result`` to provide access to the inserted element or to the element with the key that
compares `equivalent` to the value ``k``.
This overload only participates in overload resolution if ``std::is_constructible<key_type, const K&>`` is ``true``.
**Returns**: ``true`` if the insertion was applied, ``false`` otherwise.
Lookup
^^^^^^
.. code:: cpp
template <typename K>
bool find( accessor& result, const K& k );
template <typename K>
bool find( const_accessor& result, const K& k ) const;
If the accessor ``result`` is not empty, releases the ``result``.
If an element with the key that compares `equivalent` to the value ``k`` exists,
sets the ``result`` to provide access to this element.
**Returns**: ``true`` if an element with the key that compares `equivalent` to the value ``k`` is found,
``false`` otherwise.
------------------------------------------------
.. code:: cpp
template <typename K>
size_type count( const K& k ) const;
**Returns**: ``1`` if an element with the key that compares `equivalent` to the value ``k`` exists, ``0`` otherwise.
------------------------------------------------
.. code:: cpp
template <typename K>
std::pair<iterator, iterator> equal_range( const K& k );
template <typename K>
std::pair<const_iterator, const_iterator> equal_range( const K& k ) const;
**Returns**:
- A pair of iterators ``{f, l}`` if an element with the key that compares `equivalent` to the value ``k`` exists in the container.
Here ``f`` is an iterator to this element, ``l`` is ``std::next(f)``.
- ``{end(), end()}`` otherwise.
.. rubric:: Example
The example below demonstrates how to use heterogeneous lookup feature to find an object with the key of type ``std::string``
using an object of type ``const char*`` without conversions.
.. code:: cpp
#define TBB_PREVIEW_CONCURRENT_HASH_MAP_EXTENSIONS 1
#include "oneapi/tbb/concurrent_hash_map.h"
#include <string>
#include <cstring>
// HashCompare an object that can calculate the hash code for
// std::string only and compare strings for equality
class RegularHashCompare {
private:
std::hash<std::string> my_hasher;
public:
std::size_t hash( const std::string& key ) const {
return my_hasher(key);
}
bool equal( const std::string& key1, const std::string& key2 ) const {
return key1 == key2;
}
};
// HashCompare an object that can calculate the hash code for
// std::string and const char*, and compare them for equality
class TransparentHashCompare {
private:
std::hash<char> my_hasher;
// Calculates a hash for the array of chars
std::size_t calculate_hash( const char* ptr ) const {
std::size_t h = 0;
for (auto c = ptr; *c; ++c) {
h = h ^ my_hasher(*c);
}
return h;
}
public:
using is_transparent = void;
std::size_t hash( const char* key ) const {
return calculate_hash(key);
}
std::size_t hash( const std::string& key ) const {
return calculate_hash(key.c_str());
}
bool equal( const char* key1, const char* key2 ) const {
return std::strcmp(key1, key2) == 0;
}
bool equal( const char* key1, const std::string& key2 ) const {
return std::strcmp(key1, key2.c_str()) == 0;
}
bool equal( const std::string& key1, const char* key2 ) const {
return std::strcmp(key1.c_str(), key2) == 0;
}
bool equal( const std::string& key1, const std::string& key2 ) const {
return std::strcmp(key1.c_str(), key2.c_str()) == 0;
}
};
int main() {
using regular_hash_map =
oneapi::tbb::concurrent_hash_map<std::string, int, RegularHashCompare>;
using transparent_hash_map =
oneapi::tbb::concurrent_hash_map<std::string, int, TransparentHashCompare>;
using regular_accessor = typename regular_hash_map::accessor;
using transparent_accessor = typename transparent_hash_map::accessor;
// Accessors
regular_accessor reg_accessor;
transparent_accessor tran_accessor;
// Maps
regular_hash_map regular_map;
transparent_hash_map tran_map;
// Heterogeneous overloads do not participate in overload resolution
// Such a call matches on the find overload, which accepts key_type (std::string)
// Creates a temporary key_type (std::string) object because of implicit conversion
bool result = regular_map.find(reg_accessor, "abc");
// Heterogeneous overloads participate in overload resolution
// No implicit conversion from const char* to std::string takes place
result = tran_map.find(tran_accessor, "abc");
}
+17
View File
@@ -0,0 +1,17 @@
.. _info_namespace:
oneapi::tbb::info namespace
===========================
The ``oneapi::tbb::info`` namespace satisfies `the corresponding oneTBB specification section
<https://spec.oneapi.com/versions/latest/elements/oneTBB/source/info_namespace.html>`_.
The |full_name| implementation requires `the hwloc library <https://www-lb.open-mpi.org/projects/hwloc>`_
to query NUMA(version >= 1.11) and Hybrid CPUs(version >= 2.4) topology information.
See also:
* `info namespace specification <https://spec.oneapi.com/versions/latest/elements/oneTBB/source/info_namespace.html>`_
* `oneapi::tbb::task_arena specification <https://spec.oneapi.com/versions/latest/elements/oneTBB/source/task_scheduler/task_arena/task_arena_cls.html>`_
* :doc:`oneapi::tbb::info namespace preview extensions <info_namespace_extensions>`
* :doc:`task_arena::constraints class preview extensions <constraints_extensions>`

Some files were not shown because too many files have changed in this diff Show More