- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
In the TBB book it shows that concurrent_vector has a function named range(size_t grainsize).
I want to iterate over a concurrent_vector, applying an operation to each element. However, I would prefer to use the auto partitioner. Currently, I am passing this for range type in a parallel_for:
Is there a better way, that uses the auto partitioner?
Thanks!
AJ
In the TBB book it shows that concurrent_vector has a function named range(size_t grainsize).
I want to iterate over a concurrent_vector, applying an operation to each element. However, I would prefer to use the auto partitioner. Currently, I am passing this for range type in a parallel_for:
tbb::blocked_range<:CONCURRENT_VECTOR>::iterator>(v.begin(), v.end())
Is there a better way, that uses the auto partitioner?
Thanks!
AJ
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should be able to use the blocked_range as youcreated above together with auto_partitioner.
You could also use the method range(size_t grainsize)of concurrent_vector with auto_partitioner; just specify grainsize of 1 for it. This method will do for you what you did manually, i.e. construct a blocked_range over iteration space [ v.begin(), v(end) ) with a given grainsize. The value of 1 is the default grainsize value for blocked_range; we should have made it the default value in the concurrent_vector's range method as well.
Both ways are essentially the same.

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