- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear TBB experts,
I am now thinking of parallel efficient algorithm by using TBB.
Thus, I would like to prepare some pool data (std::vector container) per each thread in RAII phase,
and make each thread to access by their own id (thread id, I meant).
Currently, I initialized scheduler as tbb::task_scheduler.initialize(thread_num),
and prepared std::vector<PoolDataStructure> _pool(thread_num),
then, for accessing it, I use the return value of tbb::task_arena::current_thread_index() as their thread id.
Seemingly, it works well, but I wonder this is whether correct or not as specification.
(When I run the program based on the above, I encountered different numerical result with serial or parallel.
I am afraid that there is some data race due to the above implementation, or others)
I would appreciate it if you could consider it.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
P.S.
I know that there is a procedure unit, "thread" and "task", and tbb adopt task as the minimum unit for its parallelization.
I wonder how tbb could differentiate thread and task as index (in my context, between thread id & task id).
that tbb::task_arena::current_thread_index() might return the thread id as named,
but I am afraid that when the same thread deals with different tasks, the pool data I prepared will be violated by them in data-race manner.
If you know how to think about handling&differentiating thread & task,
I sincerely hope to understand it.
Kind regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Apologize for a long response time. The main use programming model in TBB is task based programming. The idea is to abstract out hardware and OS specific concepts such as threads and focus on the tasks instead. You can certainly limit the amount of threads to be used. But beyond that, instead of working with the individual threads the likely more successful strategy will be to focus on tasks instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Due to no response from customer, the Intel support for this ticket is closed.
![](/skins/images/D3C0B914909A6564BBB97F4AD1ED1973/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page