Visible to Intel only — GUID: GUID-6F4E4046-0848-4BA4-A042-977D8B4412FE
Package Contents
Parallelizing Simple Loops
Parallelizing Complex Loops
Parallelizing Data Flow and Dependence Graphs
Work Isolation
Exceptions and Cancellation
Containers
Mutual Exclusion
Timing
Memory Allocation
The Task Scheduler
Design Patterns
Migrating from Threading Building Blocks (TBB)
Constrained APIs
Invoke a Callable Object
Appendix A Costs of Time Slicing
Appendix B Mixing With Other Threading Packages
References
parallel_for_each Body semantics and requirements
parallel_sort ranges interface extension
TBB_malloc_replacement_log Function
Type-specified message keys for join_node
Scalable Memory Pools
Helper Functions for Expressing Graphs
concurrent_lru_cache
task_group extensions
The customizing mutex type for concurrent_hash_map
Visible to Intel only — GUID: GUID-6F4E4046-0848-4BA4-A042-977D8B4412FE
make_edges function template
NOTE:
To enable this feature, define the TBB_PREVIEW_FLOW_GRAPH_FEATURES macro to 1.
Description
The make_edges function template creates edges between a single node and each node in a set of nodes.
There are two ways to connect nodes in a set and a single node using make_edges:
API
Header
#include <oneapi/tbb/flow_graph.h>
Syntax
// node_set is an exposition-only name for the type returned from make_node_set function template <typename NodeType, typename Node, typename... Nodes> void make_edges(node_set<Node, Nodes...>& set, NodeType& node); template <typename NodeType, typename Node, typename... Nodes> void make_edges(NodeType& node, node_set<Node, Nodes...>& set);
Example
The example implements the graph structure in the picture below.
#define TBB_PREVIEW_FLOW_GRAPH_FEATURES 1 #include <oneapi/tbb/flow_graph.h> int main() { using namespace oneapi::tbb::flow; graph g; broadcast_node<int> input(g); function_node doubler(g, unlimited, [](const int& i) { return 2 * i; }); function_node squarer(g, unlimited, [](const int& i) { return i * i; }); function_node cuber(g, unlimited, [](const int& i) { return i * i * i; }); buffer_node<int> buffer(g); auto handlers = make_node_set(doubler, squarer, cuber); make_edges(input, handlers); make_edges(handlers, buffer); for (int i = 1; i <= 10; ++i) { input.try_put(i); } g.wait_for_all(); }