Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::flow::interface11::internal Namespace Reference

Classes

class  async_body
 
class  async_body_base
 
class  broadcast_cache
 
struct  graph_task_comparator
 
class  predecessor_cache
 
class  priority_task_selector
 
class  reservable_predecessor_cache
 
class  round_robin_cache
 
class  successor_cache
 

Typedefs

typedef tbb::concurrent_priority_queue< graph_task *, graph_task_comparatorgraph_task_priority_queue_t
 

Functions

opencl_device_list find_available_devices ()
 
void activate_graph (tbb::flow::interface10::graph &g)
 
void deactivate_graph (tbb::flow::interface10::graph &g)
 
bool is_graph_active (tbb::flow::interface10::graph &g)
 
tbb::taskprioritize_task (tbb::flow::interface10::graph &g, tbb::task &arena_task)
 
void spawn_in_graph_arena (graph &g, tbb::task &arena_task)
 Spawns a task inside graph arena. More...
 
void enqueue_in_graph_arena (graph &g, tbb::task &arena_task)
 Enqueues a task inside graph arena. More...
 
void add_task_to_graph_reset_list (tbb::flow::interface10::graph &g, tbb::task *tp)
 

Typedef Documentation

◆ graph_task_priority_queue_t

Function Documentation

◆ activate_graph()

void tbb::flow::interface11::internal::activate_graph ( tbb::flow::interface10::graph g)
inline

Definition at line 486 of file _flow_graph_impl.h.

486  {
487  g.my_is_active = true;
488 }

References tbb::flow::interface10::graph::my_is_active.

Referenced by tbb::flow::interface10::graph::reset().

Here is the caller graph for this function:

◆ add_task_to_graph_reset_list()

void tbb::flow::interface11::internal::add_task_to_graph_reset_list ( tbb::flow::interface10::graph g,
tbb::task tp 
)
inline

Definition at line 537 of file _flow_graph_impl.h.

537  {
538  g.my_reset_task_list.push_back(tp);
539 }

References tbb::flow::interface10::graph::my_reset_task_list.

Referenced by tbb::flow::interface11::source_node< Output >::reset_node().

Here is the caller graph for this function:

◆ deactivate_graph()

void tbb::flow::interface11::internal::deactivate_graph ( tbb::flow::interface10::graph g)
inline

Definition at line 490 of file _flow_graph_impl.h.

490  {
491  g.my_is_active = false;
492 }

References tbb::flow::interface10::graph::my_is_active.

Referenced by tbb::flow::interface10::graph::reset().

Here is the caller graph for this function:

◆ enqueue_in_graph_arena()

void tbb::flow::interface11::internal::enqueue_in_graph_arena ( tbb::flow::interface10::graph g,
tbb::task arena_task 
)
inline

Enqueues a task inside graph arena.

Definition at line 530 of file _flow_graph_impl.h.

530  {
531  if (is_graph_active(g)) {
532  __TBB_ASSERT( g.my_task_arena && g.my_task_arena->is_active(), "Is graph's arena initialized and active?" );
533  task::enqueue(prioritize_task(g, arena_task), *g.my_task_arena);
534  }
535 }

References __TBB_ASSERT, tbb::task::enqueue(), tbb::interface7::task_arena::is_active(), is_graph_active(), tbb::flow::interface10::graph::my_task_arena, and prioritize_task().

Referenced by tbb::flow::interface11::async_node< Input, Output, Policy, Allocator >::try_put_impl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_available_devices()

opencl_device_list tbb::flow::interface11::internal::find_available_devices ( )
inline

Definition at line 283 of file flow_graph_opencl_node.h.

283  {
284  opencl_device_list opencl_devices;
285 
286  cl_uint num_platforms;
287  enforce_cl_retcode(clGetPlatformIDs(0, NULL, &num_platforms), "clGetPlatformIDs failed");
288 
289  std::vector<cl_platform_id> platforms(num_platforms);
290  enforce_cl_retcode(clGetPlatformIDs(num_platforms, platforms.data(), NULL), "clGetPlatformIDs failed");
291 
292  cl_uint num_devices;
293  std::vector<cl_platform_id>::iterator platforms_it = platforms.begin();
294  cl_uint num_all_devices = 0;
295  while (platforms_it != platforms.end()) {
296  cl_int err = clGetDeviceIDs(*platforms_it, CL_DEVICE_TYPE_ALL, 0, NULL, &num_devices);
297  if (err == CL_DEVICE_NOT_FOUND) {
298  platforms_it = platforms.erase(platforms_it);
299  }
300  else {
301  enforce_cl_retcode(err, "clGetDeviceIDs failed");
302  num_all_devices += num_devices;
303  ++platforms_it;
304  }
305  }
306 
307  std::vector<cl_device_id> devices(num_all_devices);
308  std::vector<cl_device_id>::iterator devices_it = devices.begin();
309  for (auto p = platforms.begin(); p != platforms.end(); ++p) {
310  enforce_cl_retcode(clGetDeviceIDs((*p), CL_DEVICE_TYPE_ALL, (cl_uint)std::distance(devices_it, devices.end()), &*devices_it, &num_devices), "clGetDeviceIDs failed");
311  devices_it += num_devices;
312  }
313 
314  for (auto d = devices.begin(); d != devices.end(); ++d) {
315  opencl_devices.add(opencl_device((*d)));
316  }
317 
318  return opencl_devices;
319 }

References tbb::flow::interface11::opencl_device_list::add(), d, tbb::flow::interface11::enforce_cl_retcode(), and p.

Referenced by tbb::flow::interface11::opencl_info::available_devices().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_graph_active()

bool tbb::flow::interface11::internal::is_graph_active ( tbb::flow::interface10::graph g)
inline

Definition at line 494 of file _flow_graph_impl.h.

494  {
495  return g.my_is_active;
496 }

References tbb::flow::interface10::graph::my_is_active.

Referenced by internal::function_input_base< Input, queueing, cache_aligned_allocator< Input >, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, queueing, cache_aligned_allocator< Input > > >::create_body_task(), internal::function_input_base< Input, queueing, cache_aligned_allocator< Input >, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, queueing, cache_aligned_allocator< Input > > >::create_forward_task(), internal::join_node_FE< reserving, InputTuple, OutputTuple >::decrement_port_count(), internal::join_node_FE< queueing, InputTuple, OutputTuple >::decrement_port_count(), enqueue_in_graph_arena(), internal::continue_input< Output, internal::Policy< void > >::execute(), internal::join_node_FE< key_matching< K, KHash >, InputTuple, OutputTuple >::fill_output_buffer(), tbb::flow::interface11::limiter_node< T, DecrementType >::forward_task(), internal::join_node_base< JP, InputTuple, OutputTuple >::handle_operations(), tbb::flow::interface11::buffer_node< T, cache_aligned_allocator< T > >::handle_operations_impl(), tbb::flow::interface11::limiter_node< T, DecrementType >::register_predecessor(), tbb::flow::interface11::limiter_node< T, DecrementType >::register_successor(), tbb::flow::interface11::overwrite_node< T >::register_successor(), tbb::flow::interface10::graph::run(), spawn_in_graph_arena(), tbb::flow::interface11::source_node< Output >::spawn_put(), and tbb::flow::interface11::limiter_node< T, DecrementType >::try_put_task().

Here is the caller graph for this function:

◆ prioritize_task()

tbb::task & tbb::flow::interface11::internal::prioritize_task ( tbb::flow::interface10::graph g,
tbb::task arena_task 
)
inline

Non-preemptive priority pattern. The original task is submitted as a work item to the priority queue, and a new critical task is created to take and execute a work item with the highest known priority. The reference counting responsibility is transferred (via allocate_continuation) to the new task.

Non-preemptive priority pattern. The original task is submitted as a work item to the priority queue, and a new critical task is created to take and execute a work item with the highest known priority. The reference counting responsibility is transferred (via allocate_continuation) to the new task.

Definition at line 499 of file _flow_graph_impl.h.

499  {
500  task* critical_task = &t;
501  // TODO: change flow graph's interfaces to work with graph_task type instead of tbb::task.
502  graph_task* gt = static_cast<graph_task*>(&t);
503  if( gt->priority != no_priority ) {
508  critical_task = new( gt->allocate_continuation() ) priority_task_selector(g.my_priority_queue);
509  tbb::internal::make_critical( *critical_task );
510  g.my_priority_queue.push(gt);
511  }
512  return *critical_task;
513 }

References tbb::task::allocate_continuation(), tbb::internal::make_critical(), tbb::flow::interface10::graph::my_priority_queue, tbb::flow::internal::no_priority, tbb::flow::interface11::graph_task::priority, and tbb::interface5::concurrent_priority_queue< T, Compare, A >::push().

Referenced by enqueue_in_graph_arena(), and spawn_in_graph_arena().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spawn_in_graph_arena()

void tbb::flow::interface11::internal::spawn_in_graph_arena ( tbb::flow::interface10::graph g,
tbb::task arena_task 
)
inline

Spawns a task inside graph arena.

Definition at line 521 of file _flow_graph_impl.h.

521  {
522  if (is_graph_active(g)) {
523  graph::spawn_functor s_fn(prioritize_task(g, arena_task));
525  g.my_task_arena->execute(s_fn);
526  }
527 }

References __TBB_ASSERT, tbb::interface7::task_arena::execute(), tbb::interface7::task_arena::is_active(), is_graph_active(), tbb::flow::interface10::graph::my_task_arena, and prioritize_task().

Referenced by internal::function_input< Input, continue_msg, queueing, cache_aligned_allocator< Input > >::apply_body_impl_bypass(), internal::check_task_and_spawn(), tbb::flow::interface11::combine_tasks(), internal::join_node_FE< reserving, InputTuple, OutputTuple >::decrement_port_count(), internal::join_node_FE< queueing, InputTuple, OutputTuple >::decrement_port_count(), tbb::flow::interface11::buffer_node< T, cache_aligned_allocator< T > >::enqueue_forwarding_task(), internal::join_node_FE< key_matching< K, KHash >, InputTuple, OutputTuple >::fill_output_buffer(), tbb::flow::interface11::limiter_node< T, DecrementType >::forward_task(), internal::join_node_base< JP, InputTuple, OutputTuple >::handle_operations(), tbb::flow::interface11::limiter_node< T, DecrementType >::register_predecessor(), tbb::flow::interface11::limiter_node< T, DecrementType >::register_successor(), tbb::flow::interface11::overwrite_node< T >::register_successor(), tbb::flow::interface10::graph::reset(), internal::function_input_base< Input, queueing, cache_aligned_allocator< Input >, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, queueing, cache_aligned_allocator< Input > > >::spawn_forward_task(), tbb::flow::interface11::source_node< Output >::spawn_put(), tbb::flow::interface11::receiver< Output >::try_put(), and tbb::flow::interface11::buffer_node< T, cache_aligned_allocator< T > >::try_put_task().

Here is the call graph for this function:
Here is the caller graph for this function:
tbb::flow::interface11::internal::is_graph_active
bool is_graph_active(tbb::flow::interface10::graph &g)
Definition: _flow_graph_impl.h:494
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
tbb::flow::interface10::graph::my_reset_task_list
task_list_type my_reset_task_list
Definition: _flow_graph_impl.h:416
d
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d
Definition: ittnotify_static.h:109
tbb::flow::internal::no_priority
static const node_priority_t no_priority
Definition: _flow_graph_impl.h:64
tbb::flow::interface11::enforce_cl_retcode
void enforce_cl_retcode(cl_int err, std::string msg)
Definition: flow_graph_opencl_node.h:57
tbb::flow::interface11::internal::prioritize_task
tbb::task & prioritize_task(tbb::flow::interface10::graph &g, tbb::task &arena_task)
Definition: _flow_graph_impl.h:499
tbb::interface7::task_arena::is_active
bool is_active() const
Definition: task_arena.h:374
tbb::interface5::concurrent_priority_queue::push
void push(const_reference elem)
Pushes elem onto the queue, increasing capacity of queue if necessary.
Definition: concurrent_priority_queue.h:268
task
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task * task
Definition: ittnotify_static.h:119
tbb::flow::interface10::graph::my_is_active
bool my_is_active
Definition: _flow_graph_impl.h:415
tbb::interface7::task_arena::execute
internal::return_type_or_void< F >::type execute(F &f)
Definition: task_arena.h:423
p
void const char const char int ITT_FORMAT __itt_group_sync p
Definition: ittnotify_static.h:91
tbb::internal::make_critical
void make_critical(task &t)
Definition: task.h:1002
tbb::flow::interface10::graph::my_task_arena
tbb::task_arena * my_task_arena
Definition: _flow_graph_impl.h:424
tbb::flow::interface10::graph::my_priority_queue
tbb::flow::interface11::internal::graph_task_priority_queue_t my_priority_queue
Definition: _flow_graph_impl.h:427

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.