- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all -
I hope someone can help me with this issue. I'm using the tbb::task library to perform a parallel post-order traversal. The problem I'm facing is that I need to generate random numbers as part of my traversal process. I already have a class to perform the calculations (SFMT derived), and I've used it in threaded programming before. The problem is that when using tbb::task, there is no access to a per-thread memory (at least not that I've found). Any ideas?
Thanks!
I hope someone can help me with this issue. I'm using the tbb::task library to perform a parallel post-order traversal. The problem I'm facing is that I need to generate random numbers as part of my traversal process. I already have a class to perform the calculations (SFMT derived), and I've used it in threaded programming before. The problem is that when using tbb::task, there is no access to a per-thread memory (at least not that I've found). Any ideas?
Thanks!
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think what would be ideal for me from a performance standpoint would be to have an array of N (N is # running threads) SFMT states which can be referenced in the task. Then if I could get a thread index during traversal, I could use the appropriate SFMT state for that thread. Can this be done?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Brian Budge
Hi all -
I hope someone can help me with this issue. I'm using the tbb::task library to perform a parallel post-order traversal. The problem I'm facing is that I need to generate random numbers as part of my traversal process. I already have a class to perform the calculations (SFMT derived), and I've used it in threaded programming before. The problem is that when using tbb::task, there is no access to a per-thread memory (at least not that I've found). Any ideas?
Thanks!
I hope someone can help me with this issue. I'm using the tbb::task library to perform a parallel post-order traversal. The problem I'm facing is that I need to generate random numbers as part of my traversal process. I already have a class to perform the calculations (SFMT derived), and I've used it in threaded programming before. The problem is that when using tbb::task, there is no access to a per-thread memory (at least not that I've found). Any ideas?
Thanks!
Look at enumerable_thread_specific and combinable classes in TBB 2.2; they are designed to help in cases like yours.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the answer Alexey. In the past when I've used tls with boost threads, the overhead was very large. Should I expect much overhead when using the enumerable tls data in tbb?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Brian Budge
Thanks for the answer Alexey. In the past when I've used tls with boost threads, the overhead was very large. Should I expect much overhead when using the enumerable tls data in tbb?
I did only one program with enumerable_thread_specific, up to now, but there was no noticable difference with respect to compiler-specific API for the TLS. technically there must be some overhead, but it seems negligible.

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