- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1) A B C
2) D E F
I want to complete tasks A, B and C first.
Somthing like this:
paralell_for(A,C, do_something());
After the first three have completed, I want to run the next
three.
parallel_for(D, F, do_something_else());
Any ideas about how to proceed.
Just running the two parallel_for statements in serial obviously does not work here.
I need to somehow wait until the first three tasks are completed to begin the final three tasks?
Thanks.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Even I'm new to TBB, but from what I know, in your case, it would probably not be best to use parallel_for.
Your tasks A, B and C, if they are bunches of lines of code that can be executed independent of each other, or if they're functions, they can be executed with the concept of \\"tasks\\" which is different from parallel_for.
Have a look at section 11 of the TBB tutorial. You can execute functions (sections of code, literally) concurrently by creating tasks with the 'new' keyword.
My knowledge in this area is limited...you'll receive much more experienced replies soon :) If my reply is wrong, I'm open to corrections. It'll help me learn too.
In the meantime, it'd help if you'd explain your problem in a little more detail. With a code sample if possible.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your tasks A, B and C, if they are bunches of lines of code that can be executed independent of each other, or if they're functions, they can be executed with the concept of \\\\\\\\\\\\\\"tasks\\\\\\\\\\\\\\" which is different from parallel_for.
That's basically right, except that direct use of tasks is not recommended, and instead we suggest parallel_invoke or task_group in TBB 2.2. E.g.
[bash]parallel_invoke(A,B,C); parallel_invoke(D,E,F); [/bash]
should just do what you want. For the usage of task_group (which is little bit more complex but also more powerful), see the reference manual.

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