- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear TBB experts,
Relating to my previous post, "Thread ID as index from zero to thread number",
I would like to prepare some data pool, cache data, per each thread (or task?) in RAII (construction) step before massive iterative computations,
so as not to bring about data race between each running thread (or task?). Currently, I prepare it as std::vector which contains thread number elements.
As an alternative way, I suppose that thread local storage (tbb::combinable, or tbb::enumerable_thread_specific) will work well,
but I do not know they are assigned and referred in one-to-one correspondence, which is prepared before the parallel loop.
### I explain what I meant by psuedocode,
tbb::enumerable_thread_specific tls_data;
// data pool is prepared in RAII step
tbb::paralle_for_each(preparator.begin(), preparator.end(),
[](::iterator iter){
// HERE, tls_data is prepared per each thread (or task? )
}
);
// some massive computation step
tbb::paralle_for_each(preparator.begin(), preparator.end(),
[](::iterator iter){
// HERE, tls_data would be used without data race, is it guranteed?
}
);
)
I would appreciate it if you could tell me my question.
Kind regards
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear @Nishikawa__Mitsuru,
Apologies for a lack of response. Please let us know if the question is still actual or not.
Thanks, Mariya
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page