From eca91f16d7490a8abfdee652dadf457ec820cc37 Mon Sep 17 00:00:00 2001 From: tbbdev Date: Fri, 10 Jul 2020 16:18:01 +0300 Subject: [PATCH] Committing TBB 2020 Update 3 source code --- .gitignore | 2 + CHANGES | 25 ++++ README.md | 2 +- cmake/TBBBuild.cmake | 2 +- include/tbb/flow_graph.h | 28 +++-- include/tbb/internal/_flow_graph_body_impl.h | 60 ++++++++- include/tbb/internal/_flow_graph_impl.h | 10 +- .../internal/_flow_graph_nodes_deduction.h | 28 +++++ include/tbb/internal/_template_helpers.h | 27 ++++ include/tbb/partitioner.h | 2 +- include/tbb/pipeline.h | 7 ++ include/tbb/task.h | 2 +- include/tbb/task_scheduler_init.h | 4 +- include/tbb/tbb_stddef.h | 4 +- python/tbb/__init__.py | 2 +- src/rml/include/rml_omp.h | 4 +- src/rml/include/rml_tbb.h | 6 +- src/rml/server/rml_server.cpp | 22 ++-- src/tbb/intrusive_list.h | 117 +++++++++--------- src/tbb/tools_api/ittnotify.h | 2 +- src/test/harness_eh.h | 2 +- src/test/harness_graph.h | 2 +- src/test/test_composite_node.cpp | 18 ++- src/test/test_eh_flow_graph.cpp | 46 ++++++- src/test/test_flow_graph.cpp | 14 +++ src/test/test_flow_graph_priorities.cpp | 12 ++ src/test/test_flow_graph_whitebox.cpp | 12 ++ src/test/test_indexer_node.cpp | 15 +++ src/test/test_input_node.cpp | 59 ++++++--- src/test/test_join_node.h | 25 ++++ src/test/test_runtime_loader.cpp | 2 +- src/test/test_source_node.cpp | 46 ++++++- src/test/test_split_node.cpp | 14 +++ src/test/test_task_scheduler_init.cpp | 4 +- src/test/test_tbb_version.cpp | 4 +- 35 files changed, 499 insertions(+), 132 deletions(-) diff --git a/.gitignore b/.gitignore index 9b2411eca8..864ef9779a 100644 --- a/.gitignore +++ b/.gitignore @@ -77,6 +77,8 @@ Thumbs.db ################################ CMakeCache.txt CMakeFiles/ +cmake/TBBConfig.cmake +cmake/TBBConfigVersion.cmake # Other # ######### diff --git a/CHANGES b/CHANGES index de502b6856..e96a969958 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,31 @@ The list of most significant changes made over time in Intel(R) Threading Building Blocks (Intel(R) TBB). +Intel TBB 2020 Update 3 +TBB_INTERFACE_VERSION == 11103 + +Changes (w.r.t. Intel TBB 2020 Update 2): + +Changes affecting backward compatibility: + +- Changed body type concept of the flow::input_node. + Set TBB_DEPRECATED_INPUT_NODE_BODY to 1 to compile with the previous + concept of the body type. + +Bugs fixed: + +- Fixed compilation errors in C++20 mode due to ambiguity of comparison + operators. Inspired by Barry Revzin + (https://github.com/oneapi-src/oneTBB/pull/251). + +Open-source contributions integrated: + +- Fixed an issue in TBBBuild.cmake that causes the build with no arguments + to fail (https://github.com/oneapi-src/oneTBB/pull/233) by tttapa. +- Added cmake/{TBBConfig,TBBConfigVersion}.cmake to Git ignore list + (https://github.com/oneapi-src/oneTBB/pull/239) by Eisuke Kawashima. + +------------------------------------------------------------------------ Intel TBB 2020 Update 2 TBB_INTERFACE_VERSION == 11102 diff --git a/README.md b/README.md index 8efcf6736f..15fc3f5ef7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Threading Building Blocks 2020 -[![Stable release](https://img.shields.io/badge/version-2020.2-green.svg)](https://github.com/intel/tbb/releases/tag/v2020.2) +[![Stable release](https://img.shields.io/badge/version-2020.3-green.svg)](https://github.com/intel/tbb/releases/tag/v2020.3) [![Apache License Version 2.0](https://img.shields.io/badge/license-Apache_2.0-green.svg)](LICENSE) Threading Building Blocks (TBB) lets you easily write parallel C++ programs that take diff --git a/cmake/TBBBuild.cmake b/cmake/TBBBuild.cmake index ca63a7f4de..e4831d09c5 100644 --- a/cmake/TBBBuild.cmake +++ b/cmake/TBBBuild.cmake @@ -54,7 +54,7 @@ function(tbb_build) set(multiValueArgs USER_DEFINED_ARGS) cmake_parse_arguments(tbb_GMA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - set(result ${tbb_GMA_USER_DEFINED_ARGS}) + set(result "${tbb_GMA_USER_DEFINED_ARGS}") if (NOT tbb_GMA_USER_DEFINED_ARGS MATCHES "compiler=") # TODO: add other supported compilers. diff --git a/include/tbb/flow_graph.h b/include/tbb/flow_graph.h index 8c9702e181..03020f7914 100644 --- a/include/tbb/flow_graph.h +++ b/include/tbb/flow_graph.h @@ -29,6 +29,7 @@ #include "task.h" #include "cache_aligned_allocator.h" #include "tbb_exception.h" +#include "pipeline.h" #include "internal/_template_helpers.h" #include "internal/_aggregator_impl.h" #include "tbb/internal/_allocator_traits.h" @@ -920,12 +921,12 @@ class input_node : public graph_node, public sender< Output > { template< typename Body > __TBB_NOINLINE_SYM input_node( graph &g, Body body ) : graph_node(g), my_active(false), - my_body( new internal::source_body_leaf< output_type, Body>(body) ), - my_init_body( new internal::source_body_leaf< output_type, Body>(body) ), + my_body( new internal::input_body_leaf< output_type, Body>(body) ), + my_init_body( new internal::input_body_leaf< output_type, Body>(body) ), my_reserved(false), my_has_cached_item(false) { my_successors.set_owner(this); - tbb::internal::fgt_node_with_body( CODEPTR(), tbb::internal::FLOW_SOURCE_NODE, &this->my_graph, + tbb::internal::fgt_node_with_body( CODEPTR(), tbb::internal::FLOW_SOURCE_NODE, &this->my_graph, static_cast *>(this), this->my_body ); } @@ -1066,8 +1067,8 @@ class input_node : public graph_node, public sender< Output > { template Body copy_function_object() { - internal::source_body &body_ref = *this->my_body; - return dynamic_cast< internal::source_body_leaf & >(body_ref).get_body(); + internal::input_body &body_ref = *this->my_body; + return dynamic_cast< internal::input_body_leaf & >(body_ref).get_body(); } #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION @@ -1081,7 +1082,7 @@ class input_node : public graph_node, public sender< Output > { protected: - //! resets the source_node to its initial state + //! resets the input_node to its initial state void reset_node( reset_flags f) __TBB_override { my_active = false; my_reserved = false; @@ -1089,7 +1090,7 @@ class input_node : public graph_node, public sender< Output > { if(f & rf_clear_edges) my_successors.clear(); if(f & rf_reset_bodies) { - internal::source_body *tmp = my_init_body->clone(); + internal::input_body *tmp = my_init_body->clone(); delete my_body; my_body = tmp; } @@ -1098,8 +1099,8 @@ class input_node : public graph_node, public sender< Output > { private: spin_mutex my_mutex; bool my_active; - internal::source_body *my_body; - internal::source_body *my_init_body; + internal::input_body *my_body; + internal::input_body *my_init_body; internal::broadcast_cache< output_type > my_successors; bool my_reserved; bool my_has_cached_item; @@ -1113,11 +1114,18 @@ class input_node : public graph_node, public sender< Output > { } if ( !my_has_cached_item ) { tbb::internal::fgt_begin_body( my_body ); + +#if TBB_DEPRECATED_INPUT_NODE_BODY bool r = (*my_body)(my_cached_item); - tbb::internal::fgt_end_body( my_body ); if (r) { my_has_cached_item = true; } +#else + flow_control control; + my_cached_item = (*my_body)(control); + my_has_cached_item = !control.is_pipeline_stopped; +#endif + tbb::internal::fgt_end_body( my_body ); } if ( my_has_cached_item ) { v = my_cached_item; diff --git a/include/tbb/internal/_flow_graph_body_impl.h b/include/tbb/internal/_flow_graph_body_impl.h index 5d3ad6a0bb..e75f50dab4 100644 --- a/include/tbb/internal/_flow_graph_body_impl.h +++ b/include/tbb/internal/_flow_graph_body_impl.h @@ -17,6 +17,8 @@ #ifndef __TBB__flow_graph_body_impl_H #define __TBB__flow_graph_body_impl_H +#include "tbb/internal/_template_helpers.h" + #ifndef __TBB_flow_graph_H #error Do not #include this internal file directly; use public TBB headers instead. #endif @@ -90,8 +92,61 @@ namespace graph_policy_namespace { } // namespace graph_policy_namespace // -------------- function_body containers ---------------------- - //! A functor that takes no input and generates a value of type Output +template< typename Output > +class input_body : tbb::internal::no_assign { +public: + virtual ~input_body() {} + +#if TBB_DEPRECATED_INPUT_NODE_BODY + virtual bool operator()(Output &output) = 0; +#else + virtual Output operator()(flow_control& fc) = 0; +#endif + virtual input_body* clone() = 0; +}; + +template +void check_input_node_body_input_type_impl(Body) { + __TBB_STATIC_ASSERT((tbb::internal::is_same_type::arg_type, flow_control&>::value), + "TBB Warning: input_node body requirements have been changed." + "To temporarily enforce deprecated API specify TBB_DEPRECATED_INPUT_NODE_BODY."); +} + +template +void check_input_node_body_input_type(Body) { + check_input_node_body_input_type_impl(&Body::operator()); +} + +template +void check_input_node_body_input_type(ReturnType(*)(T)) { + __TBB_STATIC_ASSERT((tbb::internal::is_same_type::value), + "TBB Warning: input_node body requirements have been changed." + "To temporarily enforce deprecated API specify TBB_DEPRECATED_INPUT_NODE_BODY."); +} + +//! The leaf for input_body +template< typename Output, typename Body> +class input_body_leaf : public input_body { +public: + input_body_leaf( const Body &_body ) : body(_body) { } + +#if TBB_DEPRECATED_INPUT_NODE_BODY + bool operator()(Output &output) __TBB_override { return body( output ); } +#else + Output operator()(flow_control& fc) __TBB_override { + check_input_node_body_input_type(body); + return body(fc); + } +#endif + input_body_leaf* clone() __TBB_override { + return new input_body_leaf< Output, Body >(body); + } + Body get_body() { return body; } +private: + Body body; +}; + template< typename Output > class source_body : tbb::internal::no_assign { public: @@ -105,10 +160,13 @@ template< typename Output, typename Body> class source_body_leaf : public source_body { public: source_body_leaf( const Body &_body ) : body(_body) { } + bool operator()(Output &output) __TBB_override { return body( output ); } + source_body_leaf* clone() __TBB_override { return new source_body_leaf< Output, Body >(body); } + Body get_body() { return body; } private: Body body; diff --git a/include/tbb/internal/_flow_graph_impl.h b/include/tbb/internal/_flow_graph_impl.h index 2f18676e2e..7859e9449f 100644 --- a/include/tbb/internal/_flow_graph_impl.h +++ b/include/tbb/internal/_flow_graph_impl.h @@ -292,11 +292,11 @@ class graph : tbb::internal::no_copy, public tbb::flow::graph_proxy { void set_name(const char *name); #endif - void increment_wait_count() { + __TBB_DEPRECATED void increment_wait_count() { reserve_wait(); } - void decrement_wait_count() { + __TBB_DEPRECATED void decrement_wait_count() { release_wait(); } @@ -314,7 +314,7 @@ class graph : tbb::internal::no_copy, public tbb::flow::graph_proxy { /** The task is spawned as a child of the graph. This is useful for running tasks that need to block a wait_for_all() on the graph. For example a one-off source. */ template< typename Receiver, typename Body > - void run(Receiver &r, Body body) { + __TBB_DEPRECATED void run(Receiver &r, Body body) { if (tbb::flow::interface11::internal::is_graph_active(*this)) { task* rtask = new (task::allocate_additional_child_of(*root_task())) run_and_put_task< Receiver, Body >(r, body); @@ -326,7 +326,7 @@ class graph : tbb::internal::no_copy, public tbb::flow::graph_proxy { /** The task is spawned as a child of the graph. This is useful for running tasks that need to block a wait_for_all() on the graph. For example a one-off source. */ template< typename Body > - void run(Body body) { + __TBB_DEPRECATED void run(Body body) { if (tbb::flow::interface11::internal::is_graph_active(*this)) { task* rtask = new (task::allocate_additional_child_of(*root_task())) run_task< Body >(body); my_task_arena->execute(spawn_functor(*rtask)); @@ -371,7 +371,7 @@ class graph : tbb::internal::no_copy, public tbb::flow::graph_proxy { } //! Returns the root task of the graph - tbb::task * root_task() { + __TBB_DEPRECATED tbb::task * root_task() { return my_root_task; } diff --git a/include/tbb/internal/_flow_graph_nodes_deduction.h b/include/tbb/internal/_flow_graph_nodes_deduction.h index ffdfae2edf..caf2f6895e 100644 --- a/include/tbb/internal/_flow_graph_nodes_deduction.h +++ b/include/tbb/internal/_flow_graph_nodes_deduction.h @@ -29,6 +29,13 @@ struct declare_body_types { using output_type = Output; }; +struct NoInputBody {}; + +template +struct declare_body_types { + using output_type = Output; +}; + template struct body_types; template @@ -49,6 +56,15 @@ struct body_types : declare_body_types {}; template struct body_types : declare_body_types {}; +template +struct body_types : declare_body_types {}; + +template +struct body_types : declare_body_types {}; + +template +struct body_types : declare_body_types {}; + template using input_t = typename body_types::input_type; @@ -81,18 +97,30 @@ decltype(decide_on_operator_overload(std::declval())) decide_on_callable_t // Deduction guides for Flow Graph nodes #if TBB_USE_SOURCE_NODE_AS_ALIAS +#if TBB_DEPRECATED_INPUT_NODE_BODY template source_node(GraphOrSet&&, Body) ->source_node(0))>>; #else template +source_node(GraphOrSet&&, Body) +->source_node(0))>>; +#endif // TBB_DEPRECATED_INPUT_NODE_BODY +#else +template source_node(GraphOrSet&&, Body, bool = true) ->source_node(0))>>; #endif +#if TBB_DEPRECATED_INPUT_NODE_BODY template input_node(GraphOrSet&&, Body, bool = true) ->input_node(0))>>; +#else +template +input_node(GraphOrSet&&, Body) +->input_node(0))>>; +#endif #if __TBB_PREVIEW_FLOW_GRAPH_NODE_SET diff --git a/include/tbb/internal/_template_helpers.h b/include/tbb/internal/_template_helpers.h index 197f77a115..0847043088 100644 --- a/include/tbb/internal/_template_helpers.h +++ b/include/tbb/internal/_template_helpers.h @@ -279,6 +279,33 @@ using is_transparent = typename std::conditional::type::is_transp #endif /* __TBB_CPP11_PRESENT */ +template +struct body_arg_detector; + +template +struct body_arg_detector { + typedef T arg_type; +}; + +template +struct body_arg_detector { + typedef T arg_type; +}; + +#if __TBB_CPP11_PRESENT +using std::conditional; +#else +template +struct conditional { + typedef U type; +}; + +template +struct conditional { + typedef T type; +}; +#endif + } } // namespace internal, namespace tbb #endif /* __TBB_template_helpers_H */ diff --git a/include/tbb/partitioner.h b/include/tbb/partitioner.h index 23990868e2..c130d3493c 100644 --- a/include/tbb/partitioner.h +++ b/include/tbb/partitioner.h @@ -76,7 +76,7 @@ namespace interface9 { namespace internal { //< @cond INTERNAL size_t __TBB_EXPORTED_FUNC get_initial_auto_partitioner_divisor(); -//! Defines entry point for affinity partitioner into tbb run-time library. +//! Defines entry point for affinity partitioner into TBB run-time library. class affinity_partitioner_base_v3: no_copy { friend class tbb::affinity_partitioner; friend class tbb::interface9::internal::affinity_partition_type; diff --git a/include/tbb/pipeline.h b/include/tbb/pipeline.h index 13bf4e33cf..b8212ddb77 100644 --- a/include/tbb/pipeline.h +++ b/include/tbb/pipeline.h @@ -300,6 +300,12 @@ class __TBB_DEPRECATED_MSG("tbb::pipeline is deprecated, use tbb::parallel_pipel // Support for lambda-friendly parallel_pipeline interface //------------------------------------------------------------------------ +namespace flow { +namespace interface11 { + template class input_node; +} +} + namespace interface6 { namespace internal { @@ -311,6 +317,7 @@ class flow_control { bool is_pipeline_stopped; flow_control() { is_pipeline_stopped = false; } template friend class internal::concrete_filter; + template friend class flow::interface11::input_node; public: void stop() { is_pipeline_stopped = true; } }; diff --git a/include/tbb/task.h b/include/tbb/task.h index d58fb361c6..5e137c6999 100644 --- a/include/tbb/task.h +++ b/include/tbb/task.h @@ -510,7 +510,7 @@ class task_group_context : internal::no_copy { init(); } - // Custom constructor for instrumentation of tbb algorithm + // Custom constructor for instrumentation of TBB algorithm task_group_context ( internal::string_index name ) : my_kind(bound) , my_version_and_traits(3 | default_traits) diff --git a/include/tbb/task_scheduler_init.h b/include/tbb/task_scheduler_init.h index c025454b76..687bba1d9e 100644 --- a/include/tbb/task_scheduler_init.h +++ b/include/tbb/task_scheduler_init.h @@ -146,8 +146,8 @@ class __TBB_DEPRECATED_IN_VERBOSE_MODE task_scheduler_init: internal::no_copy { /** Result returned by this method does not depend on whether the scheduler has already been initialized. - Because tbb 2.0 does not support blocking tasks yet, you may use this method - to boost the number of threads in the tbb's internal pool, if your tasks are + Because TBB 2.0 does not support blocking tasks yet, you may use this method + to boost the number of threads in the TBB's internal pool, if your tasks are doing I/O operations. The optimal number of additional threads depends on how much time your tasks spend in the blocked state. diff --git a/include/tbb/tbb_stddef.h b/include/tbb/tbb_stddef.h index aed4d1c4ef..9674302456 100644 --- a/include/tbb/tbb_stddef.h +++ b/include/tbb/tbb_stddef.h @@ -19,10 +19,10 @@ // Marketing-driven product version #define TBB_VERSION_MAJOR 2020 -#define TBB_VERSION_MINOR 2 +#define TBB_VERSION_MINOR 3 // Engineering-focused interface version -#define TBB_INTERFACE_VERSION 11102 +#define TBB_INTERFACE_VERSION 11103 #define TBB_INTERFACE_VERSION_MAJOR TBB_INTERFACE_VERSION/1000 // The oldest major interface version still supported diff --git a/python/tbb/__init__.py b/python/tbb/__init__.py index 2446c2a9d9..508ad1ef5c 100644 --- a/python/tbb/__init__.py +++ b/python/tbb/__init__.py @@ -31,7 +31,7 @@ __all__ = ["Monkey", "is_active"] + api__all + pool__all __doc__ = """ -Python API for Intel(R) Threading Building Blocks library (Intel(R) TBB) +Python API for Intel(R) Threading Building Blocks (Intel(R) TBB) extended with standard Python's pools implementation and monkey-patching. Command-line interface example: diff --git a/src/rml/include/rml_omp.h b/src/rml/include/rml_omp.h index 2c203141a7..6838d48cf4 100644 --- a/src/rml/include/rml_omp.h +++ b/src/rml/include/rml_omp.h @@ -60,10 +60,10 @@ class omp_server: public ::rml::server { Note: conversion between a coin and a thread does not affect the accounting. */ #if _WIN32||_WIN64 - //! Inform server of a tbb master thread. + //! Inform server of a TBB master thread. virtual void register_master( execution_resource_t& /*v*/ ) = 0; - //! Inform server that the tbb master thread is done with its work. + //! Inform server that the TBB master thread is done with its work. virtual void unregister_master( execution_resource_t /*v*/ ) = 0; //! deactivate diff --git a/src/rml/include/rml_tbb.h b/src/rml/include/rml_tbb.h index a7d8592914..452a89671e 100644 --- a/src/rml/include/rml_tbb.h +++ b/src/rml/include/rml_tbb.h @@ -32,17 +32,17 @@ class tbb_client; // Classes instantiated by the server //------------------------------------------------------------------------ -//! Represents a set of tbb worker threads provided by the server. +//! Represents a set of TBB worker threads provided by the server. class tbb_server: public ::rml::server { public: //! Inform server of adjustments in the number of workers that the client can profitably use. virtual void adjust_job_count_estimate( int delta ) = 0; #if _WIN32||_WIN64 - //! Inform server of a tbb master thread. + //! Inform server of a TBB master thread. virtual void register_master( execution_resource_t& v ) = 0; - //! Inform server that the tbb master thread is done with its work. + //! Inform server that the TBB master thread is done with its work. virtual void unregister_master( execution_resource_t v ) = 0; #endif /* _WIN32||_WIN64 */ }; diff --git a/src/rml/server/rml_server.cpp b/src/rml/server/rml_server.cpp index 75dd828cd1..d73c6e6633 100644 --- a/src/rml/server/rml_server.cpp +++ b/src/rml/server/rml_server.cpp @@ -147,7 +147,7 @@ enum thread_state_t { ts_omp_busy, //! Thread is busy doing TBB work. ts_tbb_busy, - //! For tbb threads only + //! For TBB threads only ts_done, ts_created, ts_started, @@ -1005,7 +1005,7 @@ connection_scavenger_thread connection_scavenger; template struct connection_traits {}; -// head of the active tbb connections +// head of the active TBB connections static tbb::atomic active_tbb_connections; static tbb::atomic current_tbb_conn_readers; static size_t current_tbb_conn_reader_epoch; @@ -1381,7 +1381,7 @@ template void generic_connection::request_close_connection( bool ) { #endif /* RML_USE_WCRM */ if( connection_traits::is_tbb ) { - // acquire the head of active tbb connections + // acquire the head of active TBB connections uintptr_t conn; do { for( ; (conn=active_tbb_connections)&1; ) @@ -1402,7 +1402,7 @@ void generic_connection::request_close_connection( bool ) { } else active_tbb_connections = (uintptr_t) curr_conn->next_conn; // update & release it curr_conn->next_conn = NULL; - // Increment the tbb connection close event count + // Increment the TBB connection close event count my_ec = ++close_tbb_connection_event_count; // Wait happens in tbb_connection_v2::~tbb_connection_v2() } @@ -1672,12 +1672,12 @@ void omp_connection_v2::reactivate( rml::job* j ) #endif /* RML_USE_WCRM */ -//! Wake up some available tbb threads +//! Wake up some available TBB threads void wakeup_some_tbb_threads() { /* First, atomically grab the connection, then increase the server ref count to keep it from being released prematurely. Second, check if the balance is available for TBB - and the tbb connection has slack to exploit. If the answer is true, go ahead and + and the TBB connection has slack to exploit. If the answer is true, go ahead and try to wake some up. */ if( generic_connection::get_addr(active_tbb_connections)==0 ) // the next connection will see the change; return. @@ -1687,7 +1687,7 @@ void wakeup_some_tbb_threads() int n_curr_readers = ++current_tbb_conn_readers; if( n_curr_readers>1 ) // I lost return; - // if n_curr_readers==1, i am the first one, so I will take responsibility for waking tbb threads up. + // if n_curr_readers==1, i am the first one, so I will take responsibility for waking TBB threads up. // update the current epoch current_tbb_conn_reader_epoch = close_tbb_connection_event_count; @@ -1702,7 +1702,7 @@ void wakeup_some_tbb_threads() generic_connection* next_conn_wake_up = generic_connection::get_addr( active_tbb_connections ); for( ; next_conn_wake_up; ) { - /* some threads are creating tbb server threads; they may not see my changes made to the_balance */ + /* some threads are creating TBB server threads; they may not see my changes made to the_balance */ /* When a thread is in adjust_job_count_estimate() to increase the slack RML tries to activate worker threads on behalf of the requesting thread by repeatedly drawing a coin from the bank optimistically and grabbing a @@ -2076,7 +2076,7 @@ void server_thread::loop() { if( s==ts_omp_busy ) { // Enslaved by OpenMP team. omp_dispatch.consume(); - /* here wake tbb threads up if feasible */ + /* here wake TBB threads up if feasible */ if( ++the_balance>0 ) wakeup_some_tbb_threads(); state = ts_idle; @@ -2109,7 +2109,7 @@ void server_thread::loop() { } } // else the new request will see my changes to state & the_balance. } - /* here wake tbb threads up if feasible */ + /* here wake TBB threads up if feasible */ if( the_balance>0 ) wakeup_some_tbb_threads(); } @@ -2229,7 +2229,7 @@ void tbb_server_thread::Dispatch( DispatchState* ) { make_job( *tbb_conn, *this ); for( ;; ) { - // Try to wake some tbb threads if the balance is positive. + // Try to wake some TBB threads if the balance is positive. // When a thread is added by ConcRT and enter here for the first time, // the thread may wake itself up (i.e., atomically change its state to ts_busy. if( the_balance>0 ) diff --git a/src/tbb/intrusive_list.h b/src/tbb/intrusive_list.h index 1bdc3cf740..add58e7200 100644 --- a/src/tbb/intrusive_list.h +++ b/src/tbb/intrusive_list.h @@ -18,6 +18,7 @@ #define _TBB_intrusive_list_H #include "tbb/tbb_stddef.h" +#include "tbb/internal/_template_helpers.h" namespace tbb { namespace internal { @@ -49,63 +50,75 @@ class intrusive_list_base { static T& item ( intrusive_list_node* node ) { return List::item(node); } - template - class iterator_impl { - Iterator& self () { return *static_cast(this); } + static const T& item( const intrusive_list_node* node ) { return List::item(node); } - //! Node the iterator points to at the moment - intrusive_list_node *my_pos; + template + class iterator_impl { + __TBB_STATIC_ASSERT((tbb::internal::is_same_type::value || + tbb::internal::is_same_type::value), + "Incorrect DereferenceType in iterator_impl"); + typedef typename tbb::internal::conditional::value, + intrusive_list_node*, + const intrusive_list_node*>::type pointer_type; + public: + iterator_impl() : my_pos(NULL) {} - protected: - iterator_impl (intrusive_list_node* pos ) - : my_pos(pos) - {} + iterator_impl( pointer_type pos ) : my_pos(pos) {} - T& item () const { - return intrusive_list_base::item(my_pos); + iterator_impl& operator=( const iterator_impl& other ) { + if (this != &other) { + my_pos = other.my_pos; + } + return *this; } - public: - iterator_impl () : my_pos(NULL) {} + iterator_impl& operator=( const T& val ) { + my_pos = &node(val); + return *this; + } - Iterator& operator = ( const Iterator& it ) { - return my_pos = it.my_pos; + iterator_impl& operator++() { + my_pos = my_pos->my_next_node; + return *this; } - Iterator& operator = ( const T& val ) { - return my_pos = &node(val); + iterator_impl operator++( int ) { + iterator_impl it(*this); + ++*this; + return it; } - bool operator == ( const Iterator& it ) const { - return my_pos == it.my_pos; + iterator_impl& operator--() { + my_pos = my_pos->my_prev_node; + return *this; } - bool operator != ( const Iterator& it ) const { - return my_pos != it.my_pos; + iterator_impl operator--( int ) { + iterator_impl it(*this); + --*this; + return it; } - Iterator& operator++ () { - my_pos = my_pos->my_next_node; - return self(); + bool operator==( const iterator_impl& rhs ) const { + return my_pos == rhs.my_pos; } - Iterator& operator-- () { - my_pos = my_pos->my_prev_node; - return self(); + bool operator!=( const iterator_impl& rhs ) const { + return my_pos != rhs.my_pos; } - Iterator operator++ ( int ) { - Iterator result = self(); - ++(*this); - return result; + DereferenceType& operator*() const { + return intrusive_list_base::item(my_pos); } - Iterator operator-- ( int ) { - Iterator result = self(); - --(*this); - return result; + DereferenceType* operator->() const { + return &intrusive_list_base::item(my_pos); } - }; // intrusive_list_base::iterator_impl + + private: + // Node the iterator points to at the moment + pointer_type my_pos; + }; // class iterator_impl void assert_ok () const { __TBB_ASSERT( (my_head.my_prev_node == &my_head && !my_size) || @@ -119,31 +132,8 @@ class intrusive_list_base { } public: - class iterator : public iterator_impl { - template friend class intrusive_list_base; - public: - iterator (intrusive_list_node* pos ) - : iterator_impl(pos ) - {} - iterator () {} - - T* operator-> () const { return &this->item(); } - - T& operator* () const { return this->item(); } - }; // class iterator - - class const_iterator : public iterator_impl { - template friend class intrusive_list_base; - public: - const_iterator (const intrusive_list_node* pos ) - : iterator_impl(const_cast(pos) ) - {} - const_iterator () {} - - const T* operator-> () const { return &this->item(); } - - const T& operator* () const { return this->item(); } - }; // class iterator + typedef iterator_impl iterator; + typedef iterator_impl const_iterator; intrusive_list_base () : my_size(0) { my_head.my_prev_node = &my_head; @@ -219,6 +209,10 @@ class memptr_intrusive_list : public intrusive_list_base((char*)node - ((ptrdiff_t)&(reinterpret_cast(0x1000)->*NodePtr) - 0x1000)); } + + static const T& item( const intrusive_list_node* node ) { + return item(const_cast(node)); + } }; // intrusive_list //! Double linked list of items of type T that is derived from intrusive_list_node class. @@ -234,6 +228,7 @@ class intrusive_list : public intrusive_list_base, T> static intrusive_list_node& node ( T& val ) { return val; } static T& item ( intrusive_list_node* node ) { return *static_cast(node); } + static const T& item( const intrusive_list_node* node ) { return *static_cast(node); } }; // intrusive_list } // namespace internal diff --git a/src/tbb/tools_api/ittnotify.h b/src/tbb/tools_api/ittnotify.h index 27f3b88be7..95ca8e6071 100644 --- a/src/tbb/tools_api/ittnotify.h +++ b/src/tbb/tools_api/ittnotify.h @@ -22,7 +22,7 @@ @brief Public User API functions and types @mainpage -The ITT API is used to annotate a user's program with additional information +The Instrumentation and Tracing Technology API (ITT API) is used to annotate a user's program with additional information that can be used by correctness and performance tools. The user inserts calls in their program. Those calls generate information that is collected at runtime, and used by Intel(R) Threading Tools. diff --git a/src/test/harness_eh.h b/src/test/harness_eh.h index 8d039ef401..721c5d401c 100644 --- a/src/test/harness_eh.h +++ b/src/test/harness_eh.h @@ -45,7 +45,7 @@ tbb::atomic g_ActualCurrentThreads; volatile bool g_ThrowException = true, // g_Flog is true for nested construct tests with catches (exceptions are not allowed to - // propagate to the tbb construct itself.) + // propagate to the TBB construct itself.) g_Flog = false, g_MasterExecuted = false, g_NonMasterExecuted = false; diff --git a/src/test/harness_graph.h b/src/test/harness_graph.h index ae5e8e537d..0617671129 100644 --- a/src/test/harness_graph.h +++ b/src/test/harness_graph.h @@ -1204,7 +1204,7 @@ void test_limited_lightweight_execution(unsigned N, unsigned concurrency) { tbb::flow::graph g; NodeType node(g, concurrency, limited_lightweight_checker_body()); // Execute first body as lightweight, then wait for all other threads to fill internal buffer. - // Then unblock the lightweightd thread and check if other body executions are inside tbb task. + // Then unblock the lightweightd thread and check if other body executions are inside TBB task. Harness::SpinBarrier barrier(N - concurrency); NativeParallelFor(N, native_loop_limited_body(node, barrier)); g.wait_for_all(); diff --git a/src/test/test_composite_node.cpp b/src/test/test_composite_node.cpp index e2d80f6099..d2205db906 100644 --- a/src/test/test_composite_node.cpp +++ b/src/test/test_composite_node.cpp @@ -16,6 +16,7 @@ #include "harness.h" #if __TBB_FLOW_GRAPH_CPP11_FEATURES +#define TBB_DEPRECATED_INPUT_NODE_BODY __TBB_CPF_BUILD #include "tbb/flow_graph.h" #include "harness_graph.h" @@ -35,6 +36,7 @@ class src_body{ int step; public: src_body(int f, int s) : start(1), finish(f), step(s) {} +#if TBB_DEPRECATED_INPUT_NODE_BODY bool operator()(int &a) { a = start; if (start <= finish) { @@ -45,7 +47,21 @@ class src_body{ else { return false; }; - } + } +#else + int operator()(tbb::flow_control& fc) { + int a = start; + if (start <= finish) { + a = start; + start+=step; + return a; + } + else { + fc.stop(); + return int(); + }; + } +#endif }; struct m_fxn_body{ diff --git a/src/test/test_eh_flow_graph.cpp b/src/test/test_eh_flow_graph.cpp index 5819570613..9cc92a03c2 100644 --- a/src/test/test_eh_flow_graph.cpp +++ b/src/test/test_eh_flow_graph.cpp @@ -40,6 +40,8 @@ #define TBB_RUN_BUFFERING_TEST 1 #endif +#define TBB_DEPRECATED_INPUT_NODE_BODY __TBB_CPF_BUILD + #if TBB_USE_EXCEPTIONS #if USE_TASK_SCHEDULER_OBSERVER #include "tbb/task_scheduler_observer.h" @@ -177,6 +179,7 @@ class test_source_body : WaitThrow { REMARK("- --------- - - - constructed %lx\n", (size_t)(my_current_val)); } +#if TBB_DEPRECATED_INPUT_NODE_BODY bool operator()(OutputType & out) { UPDATE_COUNTS(); out = OutputType(my_mult * ++(*my_current_val)); @@ -189,6 +192,19 @@ class test_source_body : WaitThrow { WaitAndThrow((int)out,"test_source_body"); return true; } +#else + OutputType operator()(tbb::flow_control& fc) { + UPDATE_COUNTS(); + OutputType ret = OutputType(my_mult * ++(*my_current_val)); + if(*my_current_val > g_NumItems) { + *my_current_val = g_NumItems; + fc.stop(); + return OutputType(); + } + WaitAndThrow((int)ret,"test_input_body"); + return ret; + } +#endif int count_value() { return (int)*my_current_val; } }; @@ -199,7 +215,7 @@ class test_source_body : WaitThrow *my_current_val; public: test_source_body(tbb::atomic &my_cnt) : my_current_val(&my_cnt) { } - +#if TBB_DEPRECATED_INPUT_NODE_BODY bool operator()(tbb::flow::continue_msg & out) { UPDATE_COUNTS(); int outint = ++(*my_current_val); @@ -211,6 +227,19 @@ class test_source_body : WaitThrow g_NumItems) { + *my_current_val = g_NumItems; + fc.stop(); + return tbb::flow::continue_msg(); + } + WaitAndThrow(outint,"test_input_body"); + return tbb::flow::continue_msg(); + } +#endif int count_value() { return (int)*my_current_val; } }; @@ -320,7 +349,7 @@ class tuple_test_source_body : WaitThrow { tbb::atomic *my_current_val; public: tuple_test_source_body(tbb::atomic &my_cnt) : my_current_val(&my_cnt) { } - +#if TBB_DEPRECATED_INPUT_NODE_BODY bool operator()(OutputTuple & out) { UPDATE_COUNTS(); int ival = ++(*my_current_val); @@ -332,6 +361,19 @@ class tuple_test_source_body : WaitThrow { WaitAndThrow(ival,"tuple_test_source_body"); return true; } +#else + OutputTuple operator()(tbb::flow_control& fc) { + UPDATE_COUNTS(); + int ival = ++(*my_current_val); + if(*my_current_val > g_NumItems) { + *my_current_val = g_NumItems; // jam the final value; we assert on it later. + fc.stop(); + return OutputTuple(); + } + WaitAndThrow(ival,"tuple_test_input_body"); + return OutputTuple(ItemType0(ival),ItemType1(ival)); + } +#endif int count_value() { return (int)*my_current_val; } }; diff --git a/src/test/test_flow_graph.cpp b/src/test/test_flow_graph.cpp index 99516aab9b..08c7390d72 100644 --- a/src/test/test_flow_graph.cpp +++ b/src/test/test_flow_graph.cpp @@ -14,11 +14,14 @@ limitations under the License. */ +#define TBB_DEPRECATED_INPUT_NODE_BODY __TBB_CPF_BUILD + #include "harness_graph.h" #include "harness_barrier.h" #include "tbb/flow_graph.h" #include "tbb/task_scheduler_init.h" + const int T = 4; const int W = 4; @@ -246,6 +249,8 @@ struct source_body { tbb::task_arena* my_a; int counter; source_body(tbb::task_arena* a) : my_a(a), counter(0) {} + +#if TBB_DEPRECATED_INPUT_NODE_BODY bool operator()(const int& /*i*/) { check_arena(my_a); if (counter < 1) { @@ -254,6 +259,15 @@ struct source_body { } return false; } +#else + int operator()(tbb::flow_control &fc) { + check_arena(my_a); + if (counter++ >= 1) { + fc.stop(); + } + return int(); + } +#endif }; struct run_test_functor : tbb::internal::no_assign { diff --git a/src/test/test_flow_graph_priorities.cpp b/src/test/test_flow_graph_priorities.cpp index c5f5e9621f..9c0c873586 100644 --- a/src/test/test_flow_graph_priorities.cpp +++ b/src/test/test_flow_graph_priorities.cpp @@ -17,6 +17,7 @@ #include "harness_defs.h" #if __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES +#define TBB_DEPRECATED_INPUT_NODE_BODY __TBB_CPF_BUILD #include "harness_graph.h" #include "harness_barrier.h" @@ -233,6 +234,7 @@ struct AsyncActivity { struct StartBody { bool has_run; +#if TBB_DEPRECATED_INPUT_NODE_BODY bool operator()(data_type& input) { if (has_run) return false; else { @@ -241,6 +243,16 @@ struct StartBody { return true; } } +#else + data_type operator()(tbb::flow_control& fc) { + if (has_run){ + fc.stop(); + return data_type(); + } + has_run = true; + return 1; + } +#endif StartBody() : has_run(false) {} }; diff --git a/src/test/test_flow_graph_whitebox.cpp b/src/test/test_flow_graph_whitebox.cpp index 5e991be845..e63916dc66 100644 --- a/src/test/test_flow_graph_whitebox.cpp +++ b/src/test/test_flow_graph_whitebox.cpp @@ -25,6 +25,8 @@ #endif #endif +#define TBB_DEPRECATED_INPUT_NODE_BODY __TBB_CPF_BUILD + #include "harness.h" #include // merely prevents LNK2001 error to happen (on ICL+VC9 configurations) @@ -633,11 +635,21 @@ struct snode_body { int max_cnt; int my_cnt; snode_body( const int &in) : max_cnt(in) { my_cnt = 0; } +#if TBB_DEPRECATED_INPUT_NODE_BODY bool operator()(int &out) { if(max_cnt <= my_cnt++) return false; out = my_cnt; return true; } +#else + int operator()(tbb::flow_control &fc) { + if(max_cnt <= my_cnt++) { + fc.stop(); + return int(); + } + return my_cnt; + } +#endif }; void diff --git a/src/test/test_indexer_node.cpp b/src/test/test_indexer_node.cpp index c9c4317b53..27839365d0 100644 --- a/src/test/test_indexer_node.cpp +++ b/src/test/test_indexer_node.cpp @@ -17,6 +17,7 @@ #if __TBB_CPF_BUILD #define TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1 #endif +#define TBB_DEPRECATED_INPUT_NODE_BODY __TBB_CPF_BUILD #include "harness.h" #include "harness_graph.h" @@ -414,12 +415,26 @@ class source_body { int addend; public: source_body(TT multiplier, int init_val, int addto) : my_mult(multiplier), my_count(init_val), addend(addto) { } +#if TBB_DEPRECATED_INPUT_NODE_BODY bool operator()( TT &v) { int lc = my_count; v = my_mult * (TT)my_count; my_count += addend; return lc < Count; } +#else + TT operator()( tbb::flow_control& fc) { + int lc = my_count; + TT ret = my_mult * (TT)my_count; + my_count += addend; + if ( lc < Count){ + return ret; + }else{ + fc.stop(); + return TT(); + } + } +#endif }; // allocator for indexer_node. diff --git a/src/test/test_input_node.cpp b/src/test/test_input_node.cpp index 25ea789d44..0a7d4d5999 100644 --- a/src/test/test_input_node.cpp +++ b/src/test/test_input_node.cpp @@ -17,6 +17,7 @@ // have to expose the reset_node method to be able to reset a function_body #include "harness.h" +#define TBB_DEPRECATED_INPUT_NODE_BODY __TBB_CPF_BUILD #include "harness_graph.h" #include "tbb/flow_graph.h" @@ -80,15 +81,27 @@ class source_body { source_body() : ninvocations(NULL) { my_count = 0; } source_body(int &_inv) : ninvocations(&_inv) { my_count = 0; } - bool operator()( T &v ) { - v = (T)my_count++; - if(ninvocations) ++(*ninvocations); - if ( (int)v < N ) - return true; - else - return false; - } - +#if TBB_DEPRECATED_INPUT_NODE_BODY + bool operator()( T &v ) { + v = (T)my_count++; + if(ninvocations) ++(*ninvocations); + if ( (int)v < N ) + return true; + else + return false; + } +#else + T operator()( tbb::flow_control& fc ) { + T v = (T)my_count++; + if(ninvocations) ++(*ninvocations); + if ( (int)v < N ){ + return v; + }else{ + fc.stop(); + return T(); + } + } +#endif }; template< typename T > @@ -256,15 +269,22 @@ void test_reset() { } #if __TBB_CPP17_DEDUCTION_GUIDES_PRESENT -bool source_body_f(int& i) { return i > 5; } - +#if TBB_DEPRECATED_INPUT_NODE_BODY + bool source_body_f(int& i) { return i > 5; } +#else + int source_body_f(tbb::flow_control&) { return 42; } +#endif void test_deduction_guides() { using namespace tbb::flow; graph g; +#if TBB_DEPRECATED_INPUT_NODE_BODY auto lambda = [](int& i) { return i > 5; }; auto non_const_lambda = [](int& i) mutable { return i > 5; }; - +#else + auto lambda = [](tbb::flow_control&) { return 42; }; + auto non_const_lambda = [](tbb::flow_control&) mutable { return 42; }; +#endif // Tests for source_node(graph&, Body) input_node s1(g, lambda); static_assert(std::is_same_v>); @@ -310,7 +330,9 @@ void test_follows_and_precedes_api() { }}; bool do_try_put = true; - input_node src(precedes(successors[0], successors[1], successors[2]), [&](bool& v) -> bool { + input_node src(precedes(successors[0], successors[1], successors[2]), + #if TBB_DEPRECATED_INPUT_NODE_BODY + [&](bool& v) -> bool { if(do_try_put) { v = do_try_put; do_try_put = false; @@ -319,7 +341,16 @@ void test_follows_and_precedes_api() { else { return false; } - }); + } + #else + [&](tbb::flow_control& fc) -> bool { + if(!do_try_put) + fc.stop(); + do_try_put = !do_try_put; + return true; + } + #endif + ); src.activate(); g.wait_for_all(); diff --git a/src/test/test_join_node.h b/src/test/test_join_node.h index 88f998930b..3c53bd1300 100644 --- a/src/test/test_join_node.h +++ b/src/test/test_join_node.h @@ -26,6 +26,8 @@ #endif #endif +#define TBB_DEPRECATED_INPUT_NODE_BODY __TBB_CPF_BUILD + #include "harness.h" #include "harness_graph.h" #include "harness_checktype.h" @@ -835,11 +837,20 @@ static int input_count; // source_nodes are serial // emit input_count continue_msg class recirc_source_node_body { public: +#if TBB_DEPRECATED_INPUT_NODE_BODY bool operator()(tbb::flow::continue_msg &v) { --input_count; v = tbb::flow::continue_msg(); return 0<=input_count; } +#else + tbb::flow::continue_msg operator()(tbb::flow_control &fc) { + if( --input_count < 0 ){ + fc.stop(); + } + return tbb::flow::continue_msg(); + } +#endif }; // T must be arithmetic, and shouldn't wrap around for reasonable sizes of Count (which is now 150, and maxPorts is 10, @@ -854,12 +865,26 @@ class source_body { int addend; public: source_body(int init_val, int addto): my_count(init_val), addend(addto) { } +#if TBB_DEPRECATED_INPUT_NODE_BODY bool operator()(TT &v) { int lc = my_count; v = make_thingie()(my_count); my_count += addend; return lc < Count; } +#else + TT operator()(tbb::flow_control& fc) { + int lc = my_count; + TT ret = make_thingie()(my_count); + my_count += addend; + if ( lc < Count){ + return ret; + }else{ + fc.stop(); + return TT(); + } + } +#endif }; template diff --git a/src/test/test_runtime_loader.cpp b/src/test/test_runtime_loader.cpp index 1e69a543d8..b0eba53787 100644 --- a/src/test/test_runtime_loader.cpp +++ b/src/test/test_runtime_loader.cpp @@ -42,7 +42,7 @@ int TestMain () { #include #ifdef HARNESS_USE_RUNTIME_LOADER - #undef HARNESS_USE_RUNTIME_LOADER // We do not want harness to preload tbb. + #undef HARNESS_USE_RUNTIME_LOADER // We do not want harness to preload TBB. #endif #include "harness.h" diff --git a/src/test/test_source_node.cpp b/src/test/test_source_node.cpp index b2594e7d59..cfe0359dc1 100644 --- a/src/test/test_source_node.cpp +++ b/src/test/test_source_node.cpp @@ -17,6 +17,7 @@ // have to expose the reset_node method to be able to reset a function_body #define TBB_USE_SOURCE_NODE_AS_ALIAS __TBB_CPF_BUILD +#define TBB_DEPRECATED_INPUT_NODE_BODY !__TBB_CPF_BUILD #include "harness.h" @@ -24,6 +25,8 @@ #define TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1 #endif + + #include "harness_graph.h" #include "tbb/flow_graph.h" #include "tbb/task.h" @@ -78,7 +81,7 @@ class test_push_receiver : public tbb::flow::receiver, NoAssign { template< typename T > class source_body { - tbb::atomic my_count; + unsigned my_count; int *ninvocations; public: @@ -86,14 +89,27 @@ class source_body { source_body() : ninvocations(NULL) { my_count = 0; } source_body(int &_inv) : ninvocations(&_inv) { my_count = 0; } +#if TBB_DEPRECATED_INPUT_NODE_BODY bool operator()( T &v ) { - v = (T)my_count.fetch_and_increment(); + v = (T)my_count++; if(ninvocations) ++(*ninvocations); if ( (int)v < N ) return true; else return false; } +#else + T operator()( tbb::flow_control& fc ) { + T v = (T)my_count++; + if(ninvocations) ++(*ninvocations); + if ( (int)v < N ){ + return v; + }else{ + fc.stop(); + return T(); + } + } +#endif }; @@ -434,14 +450,23 @@ void test_extract() { #endif /* TBB_DEPRECATED_FLOW_NODE_EXTRACTION */ #if __TBB_CPP17_DEDUCTION_GUIDES_PRESENT -bool source_body_f(int& i) { return i > 5; } +#if TBB_DEPRECATED_INPUT_NODE_BODY + bool source_body_f(int& i) { return i > 5; } +#else + int source_body_f(tbb::flow_control&) { return 42; } +#endif void test_deduction_guides() { using namespace tbb::flow; graph g; +#if TBB_DEPRECATED_INPUT_NODE_BODY auto lambda = [](int& i) { return i > 5; }; auto non_const_lambda = [](int& i) mutable { return i > 5; }; +#else + auto lambda = [](tbb::flow_control&) { return 42; }; + auto non_const_lambda = [](tbb::flow_control&) mutable { return 42; }; +#endif // Tests for source_node(graph&, Body) source_node s1(g, lambda); @@ -489,7 +514,9 @@ void test_follows_and_precedes_api() { bool do_try_put = true; - source_node src(precedes(successors[0], successors[1], successors[2]), [&](bool& v) -> bool { + source_node src(precedes(successors[0], successors[1], successors[2]), + #if TBB_DEPRECATED_INPUT_NODE_BODY + [&](bool& v) -> bool { if(do_try_put) { v = do_try_put; do_try_put = false; @@ -498,7 +525,16 @@ void test_follows_and_precedes_api() { else { return false; } - }); + } + #else + [&](tbb::flow_control& fc) -> bool { + if(!do_try_put) + fc.stop(); + do_try_put = !do_try_put; + return true; + } + #endif + ); src.activate(); g.wait_for_all(); diff --git a/src/test/test_split_node.cpp b/src/test/test_split_node.cpp index 59e7462534..5879b9773e 100644 --- a/src/test/test_split_node.cpp +++ b/src/test/test_split_node.cpp @@ -15,6 +15,7 @@ */ #define TBB_DEPRECATED_FLOW_NODE_ALLOCATOR __TBB_CPF_BUILD +#define TBB_DEPRECATED_INPUT_NODE_BODY __TBB_CPF_BUILD #include "harness.h" #include "harness_graph.h" @@ -100,12 +101,25 @@ class source_body { int addend; public: source_body(int init_val, int addto) : my_count(init_val), addend(addto) { } +#if TBB_DEPRECATED_INPUT_NODE_BODY bool operator()( TT &v) { if(my_count >= Count) return false; tuple_helper::set_element(v, my_count); my_count += addend; return true; } +#else + TT operator()( tbb::flow_control &fc) { + if(my_count >= Count){ + fc.stop(); + return TT(); + } + TT v; + tuple_helper::set_element(v, my_count); + my_count += addend; + return v; + } +#endif }; // allocator for split_node. diff --git a/src/test/test_task_scheduler_init.cpp b/src/test/test_task_scheduler_init.cpp index 396150d1e9..6479ea1f11 100644 --- a/src/test/test_task_scheduler_init.cpp +++ b/src/test/test_task_scheduler_init.cpp @@ -324,10 +324,10 @@ int TestMain () { #if _MSC_VER && !__TBB_NO_IMPLICIT_LINKAGE && !defined(__TBB_LIB_NAME) #ifdef _DEBUG ASSERT(!GetModuleHandle(_T("tbb.dll")) && GetModuleHandle(_T("tbb_debug.dll")), - "test linked with wrong (non-debug) tbb library"); + "test linked with wrong (non-debug) TBB library"); #else ASSERT(!GetModuleHandle(_T("tbb_debug.dll")) && GetModuleHandle(_T("tbb.dll")), - "test linked with wrong (debug) tbb library"); + "test linked with wrong (debug) TBB library"); #endif #endif /* _MSC_VER && !__TBB_NO_IMPLICIT_LINKAGE && !__TBB_LIB_NAME */ std::srand(2); diff --git a/src/test/test_tbb_version.cpp b/src/test/test_tbb_version.cpp index 8248995d12..9032fc5ef7 100644 --- a/src/test/test_tbb_version.cpp +++ b/src/test/test_tbb_version.cpp @@ -224,8 +224,8 @@ int main(int argc, char *argv[] ) { // Fill dictionary with version strings for platforms void initialize_strings_vector(std::vector * vector) { - vector->push_back(string_pair("TBB: VERSION\t\t2020.2", required)); // check TBB_VERSION - vector->push_back(string_pair("TBB: INTERFACE VERSION\t11102", required)); // check TBB_INTERFACE_VERSION + vector->push_back(string_pair("TBB: VERSION\t\t2020.3", required)); // check TBB_VERSION + vector->push_back(string_pair("TBB: INTERFACE VERSION\t11103", required)); // check TBB_INTERFACE_VERSION vector->push_back(string_pair("TBB: BUILD_DATE", required)); vector->push_back(string_pair("TBB: BUILD_HOST", required)); vector->push_back(string_pair("TBB: BUILD_OS", required));