Skip to content

Commit 45587e9

Browse files
authored
Update documentation for oneTBB 2022.1.0 (#1687)
1 parent d75ea93 commit 45587e9

61 files changed

Lines changed: 1658 additions & 603 deletions

File tree

Some content is hidden

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

doc/GSG/get_started.rst

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,7 @@
33
Get Started with |full_name|
44
=============================
55

6-
|short_name| Get Started Guide provides the information you need to begin working with oneTBB.
7-
It is helpful for new users of parallel programming and experienced developers that want to improve code performance.
8-
9-
It is recommended for you to have a basic knowledge of C++ programming and some experience with parallel programming concepts.
10-
11-
|full_name| is a runtime-based parallel programming model for C++ code that uses tasks.
12-
The template-based runtime library can help you harness the latent performance of multi-core processors.
13-
14-
oneTBB enables you to simplify parallel programming by breaking computation into parallel running tasks. Within a single process,
15-
parallelism is carried out by mapping tasks to threads. Threads are an operating system mechanism that allows the same or different sets of instructions
16-
to be executed simultaneously. Using threads can make your program work faster and more efficiently.
17-
18-
Here you can see one of the possible executions of tasks by threads.
19-
20-
.. figure:: Images/how-oneTBB-works.png
21-
:scale: 70%
22-
:align: center
23-
24-
Use oneTBB to write scalable applications that:
25-
26-
* Specify logical parallel structure instead of threads.
27-
* Emphasize data-parallel programming.
28-
* Take advantage of concurrent collections and parallel algorithms.
29-
30-
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.
31-
32-
oneTBB is used in different areas, such as scientific simulations, gaming, data analysis, etc.
33-
34-
It is available as a stand-alone product and as part of the |base_tk|.
35-
6+
.. include:: /GSG/intro_gsg.rst
367

378
To start using oneTBB, follow the next steps:
389
*********************************************

doc/GSG/intro_gsg.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
|short_name| Get Started Guide provides the information you need to begin working with oneTBB.
2+
It is helpful for new users of parallel programming and experienced developers that want to improve code performance.
3+
4+
It is recommended for you to have a basic knowledge of C++ programming and some experience with parallel programming concepts.
5+
6+
|full_name| is a runtime-based parallel programming model for C++ code that uses tasks.
7+
The template-based runtime library can help you harness the latent performance of multi-core processors.
8+
9+
oneTBB enables you to simplify parallel programming by breaking computation into parallel running tasks. Within a single process,
10+
parallelism is carried out by mapping tasks to threads. Threads are an operating system mechanism that allows the same or different sets of instructions
11+
to be executed simultaneously. Using threads can make your program work faster and more efficiently.
12+
13+
Here you can see one of the possible executions of tasks by threads.
14+
15+
.. figure:: /GSG/Images/how-oneTBB-works.png
16+
:scale: 70%
17+
:align: center
18+
19+
Use oneTBB to write scalable applications that:
20+
21+
* Specify logical parallel structure instead of threads.
22+
* Emphasize data-parallel programming.
23+
* Take advantage of concurrent collections and parallel algorithms.
24+
25+
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.
26+
27+
oneTBB is used in different areas, such as scientific simulations, gaming, data analysis, etc.
28+
29+
It is available as a stand-alone product and as part of the |base_tk|.

doc/GSG/next_steps.rst

Lines changed: 71 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -27,101 +27,102 @@ After installing |short_name|, set the environment variables:
2727
Build and Run a Sample
2828
**********************
2929

30-
.. tabs::
30+
.. tab-set::
3131

32-
.. group-tab:: Windows* OS
32+
.. tab-item:: Windows* OS
3333

34-
#. Create a new C++ project using your IDE. In this example, Microsoft* Visual Studio* Code is used.
35-
#. Create an ``example.cpp`` file in the project.
36-
#. 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.
34+
#. Create a new C++ project using your IDE. In this example, Microsoft* Visual Studio* Code is used.
35+
#. Create an ``example.cpp`` file in the project.
36+
#. 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.
3737

38-
.. code::
38+
.. code::
3939
40-
#include <oneapi/tbb.h>
40+
#include <oneapi/tbb.h>
4141
42-
int main (){
43-
int sum = oneapi::tbb::parallel_reduce(
44-
oneapi::tbb::blocked_range<int>(1,101), 0,
45-
[](oneapi::tbb::blocked_range<int> const& r, int init) -> int {
46-
for (int v = r.begin(); v != r.end(); v++) {
47-
init += v;
48-
}
49-
return init;
50-
},
51-
[](int lhs, int rhs) -> int {
52-
return lhs + rhs;
53-
}
54-
);
42+
int main (){
43+
int sum = oneapi::tbb::parallel_reduce(
44+
oneapi::tbb::blocked_range<int>(1,101), 0,
45+
[](oneapi::tbb::blocked_range<int> const& r, int init) -> int {
46+
for (int v = r.begin(); v != r.end(); v++) {
47+
init += v;
48+
}
49+
return init;
50+
},
51+
[](int lhs, int rhs) -> int {
52+
return lhs + rhs;
53+
}
54+
);
5555
56-
printf("Sum: %d\n", sum);
57-
return 0;
58-
}
56+
printf("Sum: %d\n", sum);
57+
return 0;
58+
}
5959
60-
#. Open the ``tasks.json`` file in the ``.vscode`` directory and paste the following lines to the args array:
60+
#. Open the ``tasks.json`` file in the ``.vscode`` directory and paste the following lines to the args array:
6161

62-
* ``-Ipath/to/oneTBB/include`` to add oneTBB include directory.
63-
* ``path/to/oneTBB/`` to add oneTBB.
62+
* ``-Ipath/to/oneTBB/include`` to add oneTBB include directory.
63+
* ``path/to/oneTBB/`` to add oneTBB.
6464

65-
For example:
65+
For example:
6666

67-
.. code-block::
67+
.. code-block::
6868
69-
{
70-
"tasks": [
71-
{
72-
"label": "build & run",
73-
"type": "cppbuild",
74-
"group": {
75-
"args": [
76-
"/IC:\\Program Files (x86)\\Intel\\oneAPI\\tbb\\2021.9.0\\include",
77-
"C:\\Program Files (x86)\\Intel\\oneAPI\\tbb\\2021.9.0\\lib\\ia32\\vc14\\tbb12.lib"
69+
{
70+
"tasks": [
71+
{
72+
"label": "build & run",
73+
"type": "cppbuild",
74+
"group": {
75+
"args": [
76+
"/IC:\\Program Files (x86)\\Intel\\oneAPI\\tbb\\2022.0.0\\include",
77+
"C:\\Program Files (x86)\\Intel\\oneAPI\\tbb\\2022.0.0\\lib\\tbb12.lib"
7878
7979
80-
#. Build the project.
81-
#. Run the example.
82-
#. If oneTBB is configured correctly, the output displays ``Sum: 5050``.
80+
#. Build the project.
81+
#. Run the example.
82+
#. If oneTBB is configured correctly, the output displays ``Sum: 5050``.
8383

84-
.. group-tab:: Linux* OS
84+
.. tab-item:: Linux* OS
8585

86-
#. Create an ``example.cpp`` file in the project.
87-
#. 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.
86+
#. Create an ``example.cpp`` file in the project.
87+
#. 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.
8888

89-
.. code::
90-
91-
#include <oneapi/tbb.h>
92-
93-
int main(){
94-
int sum = oneapi::tbb::parallel_reduce(
95-
oneapi::tbb::blocked_range<int>(1,101), 0,
96-
[](oneapi::tbb::blocked_range<int> const& r, int init) -> int {
97-
for (int v = r.begin(); v != r.end(); v++) {
98-
init += v;
99-
}
100-
return init;
101-
},
102-
[](int lhs, int rhs) -> int {
103-
return lhs + rhs;
104-
}
105-
);
89+
.. code::
90+
91+
#include <oneapi/tbb.h>
92+
93+
int main(){
94+
int sum = oneapi::tbb::parallel_reduce(
95+
oneapi::tbb::blocked_range<int>(1,101), 0,
96+
[](oneapi::tbb::blocked_range<int> const& r, int init) -> int {
97+
for (int v = r.begin(); v != r.end(); v++) {
98+
init += v;
99+
}
100+
return init;
101+
},
102+
[](int lhs, int rhs) -> int {
103+
return lhs + rhs;
104+
}
105+
);
106106
107-
printf("Sum: %d\n", sum);
108-
return 0;
109-
}
107+
printf("Sum: %d\n", sum);
108+
return 0;
109+
}
110110
111-
#. Compile the code using oneTBB. For example,
111+
#. Compile the code using oneTBB. For example,
112112

113-
.. code-block::
113+
.. code-block::
114114
115-
g++ -std=c++11 example.cpp -o example -ltbb
115+
g++ -std=c++11 example.cpp -o example -ltbb
116116
117117
118-
#. Run the executable:
118+
#. Run the executable:
119119

120-
.. code-block::
120+
.. code-block::
121121
122-
./example
122+
./example
123123
124-
#. If oneTBB is configured correctly, the output displays ``Sum: 5050``.
124+
#. If oneTBB is configured correctly, the output displays ``Sum: 5050``.
125+
125126

126127

127128
Hybrid CPU and NUMA Support

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
'sphinx.ext.ifconfig',
5858
'sphinx.ext.viewcode',
5959
'sphinx.ext.githubpages',
60-
'sphinx_tabs.tabs'
60+
'sphinx_design'
6161
]
6262

6363
# Add any paths that contain templates here, relative to this directory.

doc/index/toctree.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
.. toctree::
44
:caption: About
5+
:hidden:
56
:maxdepth: 1
67

78
/main/intro/help_support
@@ -14,7 +15,8 @@
1415

1516
.. toctree::
1617
:caption: Get Started
17-
:maxdepth: 2
18+
:hidden:
19+
:maxdepth: 1
1820

1921
/GSG/get_started
2022
/GSG/system_requirements
@@ -26,13 +28,15 @@
2628

2729
.. toctree::
2830
:maxdepth: 3
31+
:hidden:
2932
:caption: Developer Guide
3033

3134
/main/tbb_userguide/title
3235

3336

3437
.. toctree::
3538
:maxdepth: 3
39+
:hidden:
3640
:caption: Developer Reference
3741

3842
/main/reference/reference
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright (c) 2025 Intel Corporation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
cmake_minimum_required(VERSION 3.11)
16+
project(doc_examples_testing LANGUAGES CXX)
17+
18+
set(_reference_examples_path "${CMAKE_CURRENT_SOURCE_DIR}/../reference/examples")
19+
set(_userguide_examples_path "${CMAKE_CURRENT_SOURCE_DIR}/../tbb_userguide/examples")
20+
21+
add_custom_target(build-doc-examples
22+
COMMENT "Build oneTBB documentation samples")
23+
set(doc_examples_test_label "doc-examples")
24+
25+
macro(add_doc_example _doc_example_path)
26+
get_filename_component(_doc_example_name "${_doc_example_path}" NAME_WE)
27+
add_executable(${_doc_example_name} EXCLUDE_FROM_ALL "${_doc_example_path}")
28+
29+
add_dependencies(${_doc_example_name} TBB::tbb TBB::tbbmalloc TBB::tbbmalloc_proxy)
30+
target_link_libraries(${_doc_example_name} TBB::tbb TBB::tbbmalloc TBB::tbbmalloc_proxy)
31+
32+
add_dependencies(build-doc-examples ${_doc_example_name})
33+
add_test(NAME ${_doc_example_name} COMMAND ${_doc_example_name})
34+
set_tests_properties(${_doc_example_name} PROPERTIES LABELS "${doc_examples_test_label}")
35+
endmacro()
36+
37+
file(GLOB_RECURSE DOC_EXAMPLES_LIST "${_reference_examples_path}/*.cpp" "${_userguide_examples_path}/*.cpp")
38+
39+
foreach(_doc_example_path IN LISTS DOC_EXAMPLES_LIST)
40+
add_doc_example(${_doc_example_path})
41+
endforeach()

doc/main/intro/limitations.rst

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,30 @@ Known Limitations
55

66
This page outlines the known limitations of oneTBB to help you better understand its capabilities.
77

8+
Debug TBB In The SYCL Program
9+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10+
11+
**Limitation:** The application may crash when using the Debug version of oneTBB in a SYCL program compiled with Intel(R) oneAPI DPC++/C++ Compiler. This happens because both ``tbb`` (Release version) and ``tbb_debug`` (Debug version) libraries load simultaneously, causing conflicts.
12+
13+
**Solution:** Do one of the following:
14+
15+
* Link the application with the Release version ``tbb`` instead of ``tbb_debug``.
16+
* Use the ``qtbb`` flag provided by the Intel(R) oneAPI DPC++/C++ Compiler.
17+
818
Freestanding Compilation Mode
919
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1020

1121
**Limitation:** oneTBB does not support the freestanding compilation mode.
1222

13-
**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.
23+
**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.
1424

1525
Static Assert
1626
^^^^^^^^^^^^^
1727

1828
**Limitation:** A static assert causes the compilation failures in oneTBB headers if the following conditions are satisfied:
1929

20-
* Compilation is done with Clang 12.0.0 or a more recent version.
21-
* The LLVM standard library is employed, coupled with the use of the ``-ffreestanding`` flag and C++11/14 compiler options.
30+
* Compilation is done with Clang 12.0.0 or a more recent version.
31+
* The LLVM standard library is employed, coupled with the use of the ``-ffreestanding`` flag and C++11/14 compiler options.
2232

2333
**Risk:** The compilation failures.
2434

@@ -44,3 +54,10 @@ Incorrect Installation Location
4454
**Limitation:** oneTBB does not support ``fork()``.
4555

4656
**Solution:** To work-around the issue, consider using ``task_scheduler_handle`` to join oneTBB worker threads before using ``fork()``.
57+
58+
Dynamic Malloc Replacement and Topology API Incompatibilities
59+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
60+
61+
**Limitation:** On Linux* OS, using dynamic malloc replacement with ``tbb::info`` and ``tbb::task_arena::constraints`` APIs may result in runtime failures.
62+
63+
**Solution:** Set ``TBB_ENABLE_SANITIZERS=1`` in the environment. This informs that dynamic malloc replacement is used.

0 commit comments

Comments
 (0)