- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What is the difference between these two loop?
tbb::concurrent_vector<T> list;
tbb::parallel_for(tbb::blocked_range<size_t>(0, list.size()),
[&](const tbb::blocked_range<size_t>& r)
{
for(size_t i = std::begin(r); i != std::end(r); ++i)
{
//Do something with list
}
}
);
tbb::parallel_for(tbb::blocked_range<size_t>(0, list.size()),
[&](const tbb::blocked_range<size_t>& r)
{
for(auto& l : list)
{
//Do something with l
}
}
);
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is this a quiz or what ?
Pretty obvious second loop won't give expected parallelism and is incorrect.
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