- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We were looking for a way combining TBB templates with Tasks and didn't find any useful material on the web.
What we want to know is whether we can call a template from another template and expect them to be treated equally (in a sense that all the tasks will be in the same task pool).
Also, the same questionabout creating Tasks in a template. Let's say we create few tasks in a parallel_for(), will they be scheduled together(with the otherfortasks) fairly.
Thanks inAdvance.
We were looking for a way combining TBB templates with Tasks and didn't find any useful material on the web.
What we want to know is whether we can call a template from another template and expect them to be treated equally (in a sense that all the tasks will be in the same task pool).
Also, the same questionabout creating Tasks in a template. Let's say we create few tasks in a parallel_for(), will they be scheduled together(with the otherfortasks) fairly.
Thanks inAdvance.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"We were looking for a way combining TBB templates with Tasks and didn't find any useful material on the web."
Let's call those (built-in) "algorithms", not "templates".
"What we want to know is whether we can call a template from another template and expect them to be treated equally (in a sense that all the tasks will be in the same task pool)."
Algorithms can be nested freely, which, like recursive parallelism, is often a very good way to create scalabilty, as long as it doesn't imply too much parallel overhead in the inner loops (outer loops are where you get the most benefit). So don't call a parallel algorithm just because it looks sophisticated: make sure it has enough work to do. The scheduler will execute all tasks in the dynamic dependency graph according to its own scheduling algorithm, which heavily discriminates between tasks based on nesting depth, but that's intentional.
"Also, the same questionabout creating Tasks in a template. Let's say we create few tasks in a parallel_for(), will they be scheduled together(with the otherfortasks) fairly."
Algorithms create tasks internally, and the scheduler sees only tasks. For TBB, "fair" is a dirty word (performance is most likely obtained by not being fair), but there is no discrimination between tasks created implicitly (by using the higher-level built-in algorithms) or explicitly in user code.
Let's call those (built-in) "algorithms", not "templates".
"What we want to know is whether we can call a template from another template and expect them to be treated equally (in a sense that all the tasks will be in the same task pool)."
Algorithms can be nested freely, which, like recursive parallelism, is often a very good way to create scalabilty, as long as it doesn't imply too much parallel overhead in the inner loops (outer loops are where you get the most benefit). So don't call a parallel algorithm just because it looks sophisticated: make sure it has enough work to do. The scheduler will execute all tasks in the dynamic dependency graph according to its own scheduling algorithm, which heavily discriminates between tasks based on nesting depth, but that's intentional.
"Also, the same questionabout creating Tasks in a template. Let's say we create few tasks in a parallel_for(), will they be scheduled together(with the otherfortasks) fairly."
Algorithms create tasks internally, and the scheduler sees only tasks. For TBB, "fair" is a dirty word (performance is most likely obtained by not being fair), but there is no discrimination between tasks created implicitly (by using the higher-level built-in algorithms) or explicitly in user code.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page