-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend the documentation with more information about multidimensional ranges #1569
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
equivalent, even on a single processor. | ||
equivalent, even on a single processor. | ||
|
||
Also, ``blocked_range2d`` allows to use different value types across |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The blocked_range2d
allows you to use different value types for its two dimensions: rows (the first dimension) and columns (the second dimension).
doc/main/tbb_userguide/Advanced_Topic_Other_Kinds_of_Iteration_Spaces.rst
Outdated
Show resolved
Hide resolved
Also, ``blocked_range2d`` allows to use different value types across | ||
its first dimension (called "rows") and the second one ("columns"). | ||
That allows combining indexes, pointers, and iterators into a joint | ||
iteration space. The method functions ``rows()`` and ``cols()`` return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To get the range for each dimension, use the rows()
and cols()
methods that return the respective dimensions as blocked_range
objects.
The ``blocked_range3d`` class template extends this approach to 3D by adding | ||
``pages()`` as the first dimension, followed by ``rows()`` and ``cols()``. | ||
|
||
The ``blocked_nd_range<T,N>`` class template represents a blocked iteration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that I got it right, but maybe smth like:
The blocked_nd_range<T,N>
class template represents a blocked iteration space of any dimensionality. However, unlike other classes, all dimensions in blocked_nd_range
must share the same value type. Instead of specifying boundary values directly, you pass N
instances of blocked_range<T>
to the constructor. This difference is also reflected in its different naming pattern.
doc/main/tbb_userguide/Advanced_Topic_Other_Kinds_of_Iteration_Spaces.rst
Outdated
Show resolved
Hide resolved
The example demonstrates calculation of a 3-dimensional filter over the pack | ||
of feature maps, applying a kernel to a subrange of features. | ||
|
||
The ``convolution3d`` function iterates over the output cells and sets cell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The convolution3d
function processes each output cell, setting its value based on the result of the kernel3d
function. This function combines values from the feature maps to produce the final result.
values to the result of the ``kernel3d`` function, which summarizes values | ||
from feature maps. | ||
|
||
For the computation to be performed in parallel, ``tbb::parallel_for`` is called |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the computation to be performed in parallel, ``tbb::parallel_for`` is called | |
To enable parallel computation, ``tbb::parallel_for`` is called |
|
||
For the computation to be performed in parallel, ``tbb::parallel_for`` is called | ||
with ``tbb::blocked_nd_range<int,3>`` as an argument. The body function then | ||
iterates over the received 3-dimensional subrange in a loop nest, using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Within the body function, a nested loop iterates over the 3D subrange received. The dim
method is used to get the loop boundaries for each dimension.
Co-authored-by: Alexandra <[email protected]>
@aepanchi thanks. I have tried to improve the text based on your suggestions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
The oneTBB documentation lacks information about multidimensional ranges (
blocked_range2d/3d
,blocked_nd_range
) that the library provides.Addresses #1529.
Type of change
blocked_nd_range_example.h
is the example source code included (by this patch) into and described in the documentation.blocked_nd_range_example.cpp
is a test for this code; it will not be shown in the docs. Both files were taken from the TBB 2020 documentation for theblocked_rangeNd
preview feature and adjusted to matchblocked_nd_range
. I have not tested the code however.