- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello together,
tbb::task_scheduler_init scheduler_init(2);
TaskItem& tmp = *new( tbb::task::allocate_root() ) TaskItem(NULL);
Ive got a strange problem. My Code here spawns 100 tasks. After all tasks are finished it creates another 100 tasks. For some reason my runtime observations found out, that my tasks run not parallel but serial since the 2nd 100 tasks. So just the first initial code (the first if) create parallel tasks. the recreated tasks later on seem to run quiete serial with no speed bonus. You also can see, that the tasks finish one by one in a very constant time interval.
I create my taskpool with:
tbb::task_scheduler_init scheduler_init(2);
my first task is created with:
TaskItem& tmp = *new( tbb::task::allocate_root() ) TaskItem(NULL);
tmp.addScheduler(m_Scheduler.get());
tbb::task::spawn_root_and_wait(tmp);
An here is my execute funtion:
Best regards
Matthias Thurau
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My guess is that your code is just not generating enough work. The example spawns individual tasks in a for-loop and each of the tasks has little to do. So there might not be much more than serial activity going on. And limiting the thread pool to 2 means there's not much in the way of resources to get above serial performance. What happens if you actually make these tasks do a little work and have some duration?

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