Skip to content

Commit 8ff3697

Browse files
committed
Committing TBB 2019 Update 2 source code
1 parent 4cebdd9 commit 8ff3697

31 files changed

+750
-96
lines changed

CHANGES

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,30 @@
22
The list of most significant changes made over time in
33
Intel(R) Threading Building Blocks (Intel(R) TBB).
44

5+
Intel TBB 2019 Update 2
6+
TBB_INTERFACE_VERSION == 11002
7+
8+
Changes (w.r.t. Intel TBB 2019 Update 1):
9+
10+
- Added constructors with HashCompare argument to concurrent_hash_map
11+
(https://github.com/01org/tbb/pull/63).
12+
- Added overloads for parallel_reduce with default partitioner and
13+
user-supplied context.
14+
- Added deduction guides for tbb containers: concurrent_vector,
15+
concurrent_queue, concurrent_bounded_queue,
16+
concurrent_priority_queue.
17+
- Reallocation of memory objects >1MB now copies and frees memory if
18+
the size is decreased twice or more, trading performance off for
19+
reduced memory usage.
20+
- After a period of sleep, TBB worker threads now prefer returning to
21+
their last used task arena.
22+
23+
Bugs fixed:
24+
25+
- Fixed compilation of task_group.h when targeting macOS* 10.11 or
26+
earlier (https://github.com/conda-forge/tbb-feedstock/issues/42).
27+
28+
------------------------------------------------------------------------
529
Intel TBB 2019 Update 1
630
TBB_INTERFACE_VERSION == 11001
731

@@ -27,6 +51,9 @@ Bugs fixed:
2751
observer.
2852
- Fixed compilation of task_group.h by Visual C++* 15.7 with
2953
/permissive- option (https://github.com/01org/tbb/issues/53).
54+
- Fixed tbb4py to avoid dependency on Intel(R) C++ Compiler shared
55+
libraries.
56+
- Fixed compilation for Anaconda environment with GCC 7.3 and higher.
3057

3158
------------------------------------------------------------------------
3259
Intel TBB 2019

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Threading Building Blocks 2019 Update 1
2-
[![Stable release](https://img.shields.io/badge/version-2019_U1-green.svg)](https://github.com/01org/tbb/releases/tag/2019_U1)
1+
# Threading Building Blocks 2019 Update 2
2+
[![Stable release](https://img.shields.io/badge/version-2019_U2-green.svg)](https://github.com/01org/tbb/releases/tag/2019_U2)
33
[![Apache License Version 2.0](https://img.shields.io/badge/license-Apache_2.0-green.svg)](LICENSE)
44

55
Threading Building Blocks (TBB) lets you easily write parallel C++ programs that take

doc/Release_Notes.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Software - Supported Compilers
9292
GNU Compilers (gcc) 4.1 - 7.1
9393
GNU C Library (glibc) version 2.4 - 2.19
9494
Xcode* 7.0 - 9.1
95-
Android* NDK r10e - r16
95+
Android* NDK r10e - r17b
9696

9797
Software - Supported Performance Analysis Tools
9898

include/tbb/concurrent_hash_map.h

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -759,9 +759,19 @@ class concurrent_hash_map : protected internal::hash_map_base {
759759
: internal::hash_map_base(), my_allocator(a)
760760
{}
761761

762+
explicit concurrent_hash_map( const HashCompare& compare, const allocator_type& a = allocator_type() )
763+
: internal::hash_map_base(), my_allocator(a), my_hash_compare(compare)
764+
{}
765+
762766
//! Construct empty table with n preallocated buckets. This number serves also as initial concurrency level.
763767
concurrent_hash_map( size_type n, const allocator_type &a = allocator_type() )
764-
: my_allocator(a)
768+
: internal::hash_map_base(), my_allocator(a)
769+
{
770+
reserve( n );
771+
}
772+
773+
concurrent_hash_map( size_type n, const HashCompare& compare, const allocator_type& a = allocator_type() )
774+
: internal::hash_map_base(), my_allocator(a), my_hash_compare(compare)
765775
{
766776
reserve( n );
767777
}
@@ -800,7 +810,16 @@ class concurrent_hash_map : protected internal::hash_map_base {
800810
//! Construction with copying iteration range and given allocator instance
801811
template<typename I>
802812
concurrent_hash_map( I first, I last, const allocator_type &a = allocator_type() )
803-
: my_allocator(a)
813+
: internal::hash_map_base(), my_allocator(a)
814+
{
815+
call_clear_on_leave scope_guard(this);
816+
internal_copy(first, last, std::distance(first, last));
817+
scope_guard.dismiss();
818+
}
819+
820+
template<typename I>
821+
concurrent_hash_map( I first, I last, const HashCompare& compare, const allocator_type& a = allocator_type() )
822+
: internal::hash_map_base(), my_allocator(a), my_hash_compare(compare)
804823
{
805824
call_clear_on_leave scope_guard(this);
806825
internal_copy(first, last, std::distance(first, last));
@@ -810,7 +829,15 @@ class concurrent_hash_map : protected internal::hash_map_base {
810829
#if __TBB_INITIALIZER_LISTS_PRESENT
811830
//! Construct empty table with n preallocated buckets. This number serves also as initial concurrency level.
812831
concurrent_hash_map( std::initializer_list<value_type> il, const allocator_type &a = allocator_type() )
813-
: my_allocator(a)
832+
: internal::hash_map_base(), my_allocator(a)
833+
{
834+
call_clear_on_leave scope_guard(this);
835+
internal_copy(il.begin(), il.end(), il.size());
836+
scope_guard.dismiss();
837+
}
838+
839+
concurrent_hash_map( std::initializer_list<value_type> il, const HashCompare& compare, const allocator_type& a = allocator_type() )
840+
: internal::hash_map_base(), my_allocator(a), my_hash_compare(compare)
814841
{
815842
call_clear_on_leave scope_guard(this);
816843
internal_copy(il.begin(), il.end(), il.size());

include/tbb/concurrent_priority_queue.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class concurrent_priority_queue {
121121

122122
//! Copy constructor
123123
/** This operation is unsafe if there are pending concurrent operations on the src queue. */
124-
explicit concurrent_priority_queue(const concurrent_priority_queue& src) : mark(src.mark),
124+
concurrent_priority_queue(const concurrent_priority_queue& src) : mark(src.mark),
125125
my_size(src.my_size), data(src.data.begin(), src.data.end(), src.data.get_allocator())
126126
{
127127
my_aggregator.initialize_handler(my_functor_t(this));
@@ -481,6 +481,14 @@ class concurrent_priority_queue {
481481
}
482482
};
483483

484+
#if __TBB_CPP17_DEDUCTION_GUIDES_PRESENT
485+
// Deduction guide for the constructor from two iterators
486+
template<typename InputIterator,
487+
typename T = typename std::iterator_traits<InputIterator>::value_type,
488+
typename A = cache_aligned_allocator<T>
489+
> concurrent_priority_queue(InputIterator, InputIterator, const A& = A())
490+
-> concurrent_priority_queue<T, std::less<T>, A>;
491+
#endif /* __TBB_CPP17_DEDUCTION_GUIDES_PRESENT */
484492
} // namespace interface5
485493

486494
using interface5::concurrent_priority_queue;

include/tbb/concurrent_queue.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,15 @@ class concurrent_queue: public internal::concurrent_queue_base_v3<T> {
177177
const_iterator unsafe_end() const {return const_iterator();}
178178
} ;
179179

180+
#if __TBB_CPP17_DEDUCTION_GUIDES_PRESENT
181+
// Deduction guide for the constructor from two iterators
182+
template<typename InputIterator,
183+
typename T = typename std::iterator_traits<InputIterator>::value_type,
184+
typename A = cache_aligned_allocator<T>
185+
> concurrent_queue(InputIterator, InputIterator, const A& = A())
186+
-> concurrent_queue<T, A>;
187+
#endif /* __TBB_CPP17_DEDUCTION_GUIDES_PRESENT */
188+
180189
template<typename T, class A>
181190
concurrent_queue<T,A>::~concurrent_queue() {
182191
clear();
@@ -439,6 +448,15 @@ class concurrent_bounded_queue: public internal::concurrent_queue_base_v8 {
439448

440449
};
441450

451+
#if __TBB_CPP17_DEDUCTION_GUIDES_PRESENT
452+
// guide for concurrent_bounded_queue(InputIterator, InputIterator, ...)
453+
template<typename InputIterator,
454+
typename T = typename std::iterator_traits<InputIterator>::value_type,
455+
typename A = cache_aligned_allocator<T>
456+
> concurrent_bounded_queue(InputIterator, InputIterator, const A& = A())
457+
-> concurrent_bounded_queue<T, A>;
458+
#endif /* __TBB_CPP17_DEDUCTION_GUIDES_PRESENT */
459+
442460
template<typename T, class A>
443461
concurrent_bounded_queue<T,A>::~concurrent_bounded_queue() {
444462
clear();

include/tbb/concurrent_vector.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,25 @@ class concurrent_vector: protected internal::allocator_base<T, A>,
11561156
};
11571157
};
11581158

1159+
#if __TBB_CPP17_DEDUCTION_GUIDES_PRESENT
1160+
// Deduction guide for the constructor from two iterators
1161+
template<typename I,
1162+
typename T = typename std::iterator_traits<I>::value_type,
1163+
typename A = cache_aligned_allocator<T>
1164+
> concurrent_vector(I, I, const A& = A())
1165+
-> concurrent_vector<T, A>;
1166+
1167+
// Deduction guide for the constructor from a vector and allocator
1168+
template<typename T, typename A1, typename A2>
1169+
concurrent_vector(const concurrent_vector<T, A1> &, const A2 &)
1170+
-> concurrent_vector<T, A2>;
1171+
1172+
// Deduction guide for the constructor from an initializer_list
1173+
template<typename T, typename A = cache_aligned_allocator<T>
1174+
> concurrent_vector(std::initializer_list<T>, const A& = A())
1175+
-> concurrent_vector<T, A>;
1176+
#endif /* __TBB_CPP17_DEDUCTION_GUIDES_PRESENT */
1177+
11591178
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
11601179
#pragma warning (push)
11611180
#pragma warning (disable: 4701) // potentially uninitialized local variable "old"

include/tbb/parallel_reduce.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,13 @@ void parallel_reduce( const Range& range, Body& body, affinity_partitioner& part
393393
}
394394

395395
#if __TBB_TASK_GROUP_CONTEXT
396+
//! Parallel iteration with reduction, default partitioner and user-supplied context.
397+
/** @ingroup algorithms **/
398+
template<typename Range, typename Body>
399+
void parallel_reduce( const Range& range, Body& body, task_group_context& context ) {
400+
internal::start_reduce<Range,Body,const __TBB_DEFAULT_PARTITIONER>::run( range, body, __TBB_DEFAULT_PARTITIONER(), context );
401+
}
402+
396403
//! Parallel iteration with reduction, simple partitioner and user-supplied context.
397404
/** @ingroup algorithms **/
398405
template<typename Range, typename Body>
@@ -480,6 +487,17 @@ Value parallel_reduce( const Range& range, const Value& identity, const RealBody
480487
}
481488

482489
#if __TBB_TASK_GROUP_CONTEXT
490+
//! Parallel iteration with reduction, default partitioner and user-supplied context.
491+
/** @ingroup algorithms **/
492+
template<typename Range, typename Value, typename RealBody, typename Reduction>
493+
Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
494+
task_group_context& context ) {
495+
internal::lambda_reduce_body<Range,Value,RealBody,Reduction> body(identity, real_body, reduction);
496+
internal::start_reduce<Range,internal::lambda_reduce_body<Range,Value,RealBody,Reduction>,const __TBB_DEFAULT_PARTITIONER>
497+
::run( range, body, __TBB_DEFAULT_PARTITIONER(), context );
498+
return body.result();
499+
}
500+
483501
//! Parallel iteration with reduction, simple partitioner and user-supplied context.
484502
/** @ingroup algorithms **/
485503
template<typename Range, typename Value, typename RealBody, typename Reduction>

include/tbb/tbb_config.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
#endif
5757

5858
#if __clang__
59-
/** according to clang documentation, version can be vendor specific **/
59+
// according to clang documentation, version can be vendor specific
6060
#define __TBB_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
6161
#endif
6262

@@ -65,6 +65,16 @@
6565
#define __TBB_IOS 1
6666
#endif
6767

68+
#if __APPLE__
69+
#if __INTEL_COMPILER && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1099 \
70+
&& __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101000
71+
// ICC does not correctly set the macro if -mmacosx-min-version is not specified
72+
#define __TBB_MACOS_TARGET_VERSION (100000 + 10*(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ - 1000))
73+
#else
74+
#define __TBB_MACOS_TARGET_VERSION __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
75+
#endif
76+
#endif
77+
6878
/** Preprocessor symbols to determine HW architecture **/
6979

7080
#if _WIN32||_WIN64
@@ -208,6 +218,7 @@
208218
#define __TBB_ALIGNAS_PRESENT (__INTEL_CXX11_MODE__ && __INTEL_COMPILER >= 1500)
209219
#define __TBB_CPP11_TEMPLATE_ALIASES_PRESENT (__INTEL_CXX11_MODE__ && __INTEL_COMPILER >= 1210)
210220
#define __TBB_CPP14_INTEGER_SEQUENCE_PRESENT (__cplusplus >= 201402L)
221+
#define __TBB_CPP17_DEDUCTION_GUIDES_PRESENT __INTEL_COMPILER > 1900
211222
#elif __clang__
212223
/** TODO: these options need to be rechecked **/
213224
#define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT __has_feature(__cxx_variadic_templates__)
@@ -237,6 +248,7 @@
237248
#define __TBB_ALIGNAS_PRESENT __has_feature(cxx_alignas)
238249
#define __TBB_CPP11_TEMPLATE_ALIASES_PRESENT __has_feature(cxx_alias_templates)
239250
#define __TBB_CPP14_INTEGER_SEQUENCE_PRESENT (__cplusplus >= 201402L)
251+
#define __TBB_CPP17_DEDUCTION_GUIDES_PRESENT (__has_feature(__cpp_deduction_guides))
240252
#elif __GNUC__
241253
#define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT __GXX_EXPERIMENTAL_CXX0X__
242254
#define __TBB_CPP11_VARIADIC_FIXED_LENGTH_EXP_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40700)
@@ -262,6 +274,7 @@
262274
#define __TBB_ALIGNAS_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40800)
263275
#define __TBB_CPP11_TEMPLATE_ALIASES_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40700)
264276
#define __TBB_CPP14_INTEGER_SEQUENCE_PRESENT (__cplusplus >= 201402L && __TBB_GCC_VERSION >= 50000)
277+
#define __TBB_CPP17_DEDUCTION_GUIDES_PRESENT (__cpp_deduction_guides >= 201606)
265278
#elif _MSC_VER
266279
// These definitions are also used with Intel C++ Compiler in "default" mode (__INTEL_CXX11_MODE__ == 0);
267280
// see a comment in "__INTEL_COMPILER" section above.
@@ -286,6 +299,7 @@
286299
#define __TBB_ALIGNAS_PRESENT (_MSC_VER >= 1900)
287300
#define __TBB_CPP11_TEMPLATE_ALIASES_PRESENT (_MSC_VER >= 1800)
288301
#define __TBB_CPP14_INTEGER_SEQUENCE_PRESENT (_MSC_VER >= 1900)
302+
#define __TBB_CPP17_DEDUCTION_GUIDES_PRESENT (_MSVC_LANG >= 201703L)
289303
#else
290304
#define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT 0
291305
#define __TBB_CPP11_RVALUE_REF_PRESENT 0
@@ -306,6 +320,7 @@
306320
#define __TBB_ALIGNAS_PRESENT 0
307321
#define __TBB_CPP11_TEMPLATE_ALIASES_PRESENT 0
308322
#define __TBB_CPP14_INTEGER_SEQUENCE_PRESENT (__cplusplus >= 201402L)
323+
#define __TBB_CPP17_DEDUCTION_GUIDES_PRESENT 0
309324
#endif
310325

311326
// C++11 standard library features
@@ -337,7 +352,8 @@
337352

338353
#define __TBB_CPP11_GET_NEW_HANDLER_PRESENT (_MSC_VER >= 1900 || __TBB_GLIBCXX_VERSION >= 40900 && __GXX_EXPERIMENTAL_CXX0X__ || _LIBCPP_VERSION)
339354

340-
#define __TBB_CPP17_UNCAUGHT_EXCEPTIONS_PRESENT (_MSC_VER >= 1900 || __GLIBCXX__ && __cpp_lib_uncaught_exceptions || _LIBCPP_VERSION >= 3700)
355+
#define __TBB_CPP17_UNCAUGHT_EXCEPTIONS_PRESENT (_MSC_VER >= 1900 || __GLIBCXX__ && __cpp_lib_uncaught_exceptions \
356+
|| _LIBCPP_VERSION >= 3700 && (!__TBB_MACOS_TARGET_VERSION || __TBB_MACOS_TARGET_VERSION >= 101200))
341357

342358
// std::swap is in <utility> only since C++11, though MSVC had it at least since VS2005
343359
#if _MSC_VER>=1400 || _LIBCPP_VERSION || __GXX_EXPERIMENTAL_CXX0X__

include/tbb/tbb_stddef.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#define TBB_VERSION_MINOR 0
2727

2828
// Engineering-focused interface version
29-
#define TBB_INTERFACE_VERSION 11001
29+
#define TBB_INTERFACE_VERSION 11002
3030
#define TBB_INTERFACE_VERSION_MAJOR TBB_INTERFACE_VERSION/1000
3131

3232
// The oldest major interface version still supported

0 commit comments

Comments
 (0)