Skip to content

Commit 247ef9c

Browse files
[oneTBB] Fix namespaces and headers (#353)
* [oneTBB] Fix namespaces - This patch replaces tbb namespaces and headers with oneapi tbb. Signed-off-by: Alexandra Epanchinzeva [email protected] Co-authored-by: Anton Potapov <[email protected]>
1 parent 0db3e20 commit 247ef9c

File tree

154 files changed

+2567
-2341
lines changed

Some content is hidden

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

154 files changed

+2567
-2341
lines changed

source/elements/oneTBB/source/algorithms/blocked_ranges/blocked_range2d_cls.rst

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,41 @@ A ``blocked_range2d`` meets the :doc:`Range requirements <../../named_requiremen
1717

1818
.. code:: cpp
1919
20-
// Defined in header <tbb/blocked_range2d.h>
21-
22-
namespace tbb {
23-
24-
template<typename RowValue, typename ColValue=RowValue>
25-
class blocked_range2d {
26-
public:
27-
// Types
28-
using row_range_type = blocked_range<RowValue>;
29-
using col_range_type = blocked_range<ColValue>;
30-
31-
// Constructors
32-
blocked_range2d(
33-
RowValue row_begin, RowValue row_end,
34-
typename row_range_type::size_type row_grainsize,
35-
ColValue col_begin, ColValue col_end,
36-
typename col_range_type::size_type col_grainsize);
37-
blocked_range2d( RowValue row_begin, RowValue row_end,
38-
ColValue col_begin, ColValue col_end );
39-
// Splitting constructors
40-
blocked_range2d( blocked_range2d& r, split );
41-
blocked_range2d( blocked_range2d& r, proportional_split proportion );
42-
43-
// Capacity
44-
bool empty() const;
45-
46-
// Access
47-
bool is_divisible() const;
48-
const row_range_type& rows() const;
49-
const col_range_type& cols() const;
50-
};
51-
52-
} // namespace tbb
20+
// Defined in header <oneapi/tbb/blocked_range2d.h>
21+
22+
namespace oneapi {
23+
namespace tbb {
24+
25+
template<typename RowValue, typename ColValue=RowValue>
26+
class blocked_range2d {
27+
public:
28+
// Types
29+
using row_range_type = blocked_range<RowValue>;
30+
using col_range_type = blocked_range<ColValue>;
31+
32+
// Constructors
33+
blocked_range2d(
34+
RowValue row_begin, RowValue row_end,
35+
typename row_range_type::size_type row_grainsize,
36+
ColValue col_begin, ColValue col_end,
37+
typename col_range_type::size_type col_grainsize);
38+
blocked_range2d( RowValue row_begin, RowValue row_end,
39+
ColValue col_begin, ColValue col_end );
40+
// Splitting constructors
41+
blocked_range2d( blocked_range2d& r, split );
42+
blocked_range2d( blocked_range2d& r, proportional_split proportion );
43+
44+
// Capacity
45+
bool empty() const;
46+
47+
// Access
48+
bool is_divisible() const;
49+
const row_range_type& rows() const;
50+
const col_range_type& cols() const;
51+
};
52+
53+
} // namespace tbb
54+
} // namespace oneapi
5355
5456
Requirements:
5557

source/elements/oneTBB/source/algorithms/blocked_ranges/blocked_range3d_cls.rst

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,42 @@ A ``blocked_range3d`` is the three-dimensional extension of ``blocked_range2d``.
1313

1414
.. code:: cpp
1515
16-
namespace tbb {
17-
template<typename PageValue, typename RowValue=PageValue, typename ColValue=RowValue>
18-
class blocked_range3d {
19-
public:
20-
// Types
21-
using page_range_type = blocked_range<PageValue>;
22-
using row_range_type = blocked_range<RowValue>;
23-
using col_range_type = blocked_range<ColValue>;
24-
25-
// Constructors
26-
blocked_range3d(
27-
PageValue page_begin, PageValue page_end,
28-
typename page_range_type::size_type page_grainsize,
29-
RowValue row_begin, RowValue row_end,
30-
typename row_range_type::size_type row_grainsize,
31-
ColValue col_begin, ColValue col_end,
32-
typename col_range_type::size_type col_grainsize );
33-
blocked_range3d( PageValue page_begin, PageValue page_end
34-
RowValue row_begin, RowValue row_end,
35-
ColValue col_begin, ColValue col_end );
36-
blocked_range3d( blocked_range3d& r, split );
37-
blocked_range3d( blocked_range3d& r, proportional_split& proportion );
38-
39-
// Capacity
40-
bool empty() const;
41-
42-
// Access
43-
bool is_divisible() const;
44-
const page_range_type& pages() const;
45-
const row_range_type& rows() const;
46-
const col_range_type& cols() const;
47-
};
48-
}
16+
namespace oneapi {
17+
namespace tbb {
18+
template<typename PageValue, typename RowValue=PageValue, typename ColValue=RowValue>
19+
class blocked_range3d {
20+
public:
21+
// Types
22+
using page_range_type = blocked_range<PageValue>;
23+
using row_range_type = blocked_range<RowValue>;
24+
using col_range_type = blocked_range<ColValue>;
25+
26+
// Constructors
27+
blocked_range3d(
28+
PageValue page_begin, PageValue page_end,
29+
typename page_range_type::size_type page_grainsize,
30+
RowValue row_begin, RowValue row_end,
31+
typename row_range_type::size_type row_grainsize,
32+
ColValue col_begin, ColValue col_end,
33+
typename col_range_type::size_type col_grainsize );
34+
blocked_range3d( PageValue page_begin, PageValue page_end
35+
RowValue row_begin, RowValue row_end,
36+
ColValue col_begin, ColValue col_end );
37+
blocked_range3d( blocked_range3d& r, split );
38+
blocked_range3d( blocked_range3d& r, proportional_split& proportion );
39+
40+
// Capacity
41+
bool empty() const;
42+
43+
// Access
44+
bool is_divisible() const;
45+
const page_range_type& pages() const;
46+
const row_range_type& rows() const;
47+
const col_range_type& cols() const;
48+
};
49+
50+
} // namespace tbb
51+
} // namespace oneapi
4952
5053
Requirements:
5154

source/elements/oneTBB/source/algorithms/blocked_ranges/blocked_range_cls.rst

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,38 @@ to the loop templates ``parallel_for``, ``parallel_reduce``, or ``parallel_scan`
2121

2222
.. code:: cpp
2323
24-
// Defined in header <tbb/blocked_range.h>
25-
26-
namespace tbb {
27-
28-
template<typename Value>
29-
class blocked_range {
30-
public:
31-
// types
32-
using size_type = size_t;
33-
using const_iterator = Value;
34-
35-
// constructors
36-
blocked_range( Value begin, Value end, size_type grainsize=1 );
37-
blocked_range( blocked_range& r, split );
38-
blocked_range( blocked_range& r, proportional_split& proportion );
39-
40-
// capacity
41-
size_type size() const;
42-
bool empty() const;
43-
44-
// access
45-
size_type grainsize() const;
46-
bool is_divisible() const;
47-
48-
// iterators
49-
const_iterator begin() const;
50-
const_iterator end() const;
51-
};
52-
}
24+
// Defined in header <oneapi/tbb/blocked_range.h>
25+
26+
namespace oneapi {
27+
namespace tbb {
28+
29+
template<typename Value>
30+
class blocked_range {
31+
public:
32+
// types
33+
using size_type = size_t;
34+
using const_iterator = Value;
35+
36+
// constructors
37+
blocked_range( Value begin, Value end, size_type grainsize=1 );
38+
blocked_range( blocked_range& r, split );
39+
blocked_range( blocked_range& r, proportional_split& proportion );
40+
41+
// capacity
42+
size_type size() const;
43+
bool empty() const;
44+
45+
// access
46+
size_type grainsize() const;
47+
bool is_divisible() const;
48+
49+
// iterators
50+
const_iterator begin() const;
51+
const_iterator end() const;
52+
};
53+
54+
} // namespace tbb
55+
} // namespace oneapi
5356
5457
Requirements:
5558

source/elements/oneTBB/source/algorithms/examples/blocked_rangeNd_example.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#include "tbb/tbb_config.h"
1+
#include "oneapi/tbb/tbb_config.h"
22

33
#if __TBB_CPP11_PRESENT && __TBB_CPP11_ARRAY_PRESENT && __TBB_CPP11_TEMPLATE_ALIASES_PRESENT
44
#include "blocked_rangeNd_example.h"
55
#endif
66

7-
#include "tbb/tbb_stddef.h"
7+
#include "oneapi/tbb/tbb_stddef.h"
88
#include <vector>
99

1010
int main() {

source/elements/oneTBB/source/algorithms/examples/blocked_rangeNd_example.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#define TBB_PREVIEW_BLOCKED_RANGE_ND 1
2-
#include "tbb/blocked_rangeNd.h"
2+
#include "oneapi/tbb/blocked_rangeNd.h"
33

4-
#include "tbb/parallel_for.h"
5-
#include "tbb/parallel_reduce.h"
4+
#include "oneapi/tbb/parallel_for.h"
5+
#include "oneapi/tbb/parallel_reduce.h"
66

77
template<typename Features>
88
float kernel3d(const Features& feature_maps, int i, int j, int k,
@@ -21,9 +21,9 @@ template<typename Features, typename Output>
2121
void convolution3d(const Features& feature_maps, Output& out,
2222
int out_length, int out_width, int out_heigth,
2323
int kernel_length, int kernel_width, int kernel_height) {
24-
using range_t = tbb::blocked_rangeNd<int, 3>;
24+
using range_t = oneapi::tbb::blocked_rangeNd<int, 3>;
2525

26-
tbb::parallel_for(
26+
oneapi::tbb::parallel_for(
2727
range_t({0, out_length}, {0, out_width}, {0, out_heigth}),
2828
[&](const range_t& out_range) {
2929
auto out_x = out_range.dim(0);

source/elements/oneTBB/source/algorithms/examples/range_concept.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <tbb/tbb_stddef.h> // for split tags
1+
#include <oneapi/tbb/tbb_stddef.h> // for split tags
22

33
struct TrivialNaturalRange {
44
// restore the default constructor
@@ -10,14 +10,14 @@ struct TrivialNaturalRange {
1010
bool is_divisible() const { return upper > lower + 1; }
1111

1212
// basic splitting constructor
13-
TrivialNaturalRange(TrivialNaturalRange& r, tbb::split) {
13+
TrivialNaturalRange(TrivialNaturalRange& r, oneapi::tbb::split) {
1414
size_t m = r.lower + (r.upper - r.lower) / 2;
1515
upper = r.upper;
1616
r.upper = lower = m;
1717
}
1818

1919
// optional proportional splitting constructor
20-
TrivialNaturalRange(TrivialNaturalRange& r, tbb::proportional_split p) {
20+
TrivialNaturalRange(TrivialNaturalRange& r, oneapi::tbb::proportional_split p) {
2121
size_t m = r.lower + ((r.upper - r.lower) * p.left()) / (p.left() + p.right());
2222
if (m == r.lower)
2323
m++;

source/elements/oneTBB/source/algorithms/functions/feeder.rst

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,20 @@ Inlet into which additional work items for a ``parallel_for_each`` can be fed.
1111

1212
.. code:: cpp
1313
14-
// Defined in header <tbb/parallel_for_each.h>
14+
// Defined in header <oneapi/tbb/parallel_for_each.h>
1515
16-
namespace tbb {
16+
namespace oneapi {
17+
namespace tbb {
1718
18-
template<typename Item>
19-
class feeder {
20-
public:
21-
void add( const Item& item );
22-
void add( Item&& item );
23-
};
19+
template<typename Item>
20+
class feeder {
21+
public:
22+
void add( const Item& item );
23+
void add( Item&& item );
24+
};
2425
25-
} // namespace tbb
26+
} // namespace tbb
27+
} //namespace oneapi
2628
2729
Member functions
2830
----------------

source/elements/oneTBB/source/algorithms/functions/parallel_deterministic_reduce_func.rst

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,31 @@ Function template that computes reduction over a range, with deterministic split
1111

1212
.. code:: cpp
1313
14-
// Defined in header <tbb/parallel_reduce.h>
15-
16-
namespace tbb {
17-
18-
template<typename Range, typename Value, typename Func, typename Reduction>
19-
Value parallel_deterministic_reduce( const Range& range, const Value& identity, const Func& func, const Reduction& reduction, /* see-below */ partitioner, task_group_context& group);
20-
template<typename Range, typename Value, typename Func, typename Reduction>
21-
Value parallel_deterministic_reduce( const Range& range, const Value& identity, const Func& func, const Reduction& reduction, /* see-below */ partitioner);
22-
template<typename Range, typename Value, typename Func, typename Reduction>
23-
Value parallel_deterministic_reduce( const Range& range, const Value& identity, const Func& func, const Reduction& reduction, task_group_context& group);
24-
template<typename Range, typename Value, typename Func, typename Reduction>
25-
Value parallel_deterministic_reduce( const Range& range, const Value& identity, const Func& func, const Reduction& reduction);
26-
27-
template<typename Range, typename Body>
28-
void parallel_deterministic_reduce( const Range& range, Body& body, /* see-below */ partitioner, task_group_context& group);
29-
template<typename Range, typename Body>
30-
void parallel_deterministic_reduce( const Range& range, Body& body, /* see-below */ partitioner);
31-
template<typename Range, typename Body>
32-
void parallel_deterministic_reduce( const Range& range, Body& body, task_group_context& group);
33-
template<typename Range, typename Body>
34-
void parallel_deterministic_reduce( const Range& range, Body& body);
35-
36-
} // namespace tbb
14+
// Defined in header <oneapi/tbb/parallel_reduce.h>
15+
16+
namespace oneapi {
17+
namespace tbb {
18+
19+
template<typename Range, typename Value, typename Func, typename Reduction>
20+
Value parallel_deterministic_reduce( const Range& range, const Value& identity, const Func& func, const Reduction& reduction, /* see-below */ partitioner, task_group_context& group);
21+
template<typename Range, typename Value, typename Func, typename Reduction>
22+
Value parallel_deterministic_reduce( const Range& range, const Value& identity, const Func& func, const Reduction& reduction, /* see-below */ partitioner);
23+
template<typename Range, typename Value, typename Func, typename Reduction>
24+
Value parallel_deterministic_reduce( const Range& range, const Value& identity, const Func& func, const Reduction& reduction, task_group_context& group);
25+
template<typename Range, typename Value, typename Func, typename Reduction>
26+
Value parallel_deterministic_reduce( const Range& range, const Value& identity, const Func& func, const Reduction& reduction);
27+
28+
template<typename Range, typename Body>
29+
void parallel_deterministic_reduce( const Range& range, Body& body, /* see-below */ partitioner, task_group_context& group);
30+
template<typename Range, typename Body>
31+
void parallel_deterministic_reduce( const Range& range, Body& body, /* see-below */ partitioner);
32+
template<typename Range, typename Body>
33+
void parallel_deterministic_reduce( const Range& range, Body& body, task_group_context& group);
34+
template<typename Range, typename Body>
35+
void parallel_deterministic_reduce( const Range& range, Body& body);
36+
37+
} // namespace tbb
38+
} // namespace oneapi
3739
3840
A ``partitioner`` type may be one of the following entities:
3941

0 commit comments

Comments
 (0)