- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is it possible to pass a lambda function into 'parallel_for' instead of Body object?
This is an example of what I would like to do:
auto procEachRowL = [this, &imageOut, &imWB](const tbb::blocked_range &r){
for (size_t i=r.begin(); i this->ProcessEachRow(i, imageOut, imWB); };
parallel_for(blocked_range(0, yMax, 1), procEachRowL); // Syntax error here
Thanks.
This is an example of what I would like to do:
auto procEachRowL = [this, &imageOut, &imWB](const tbb::blocked_range
for (size_t i=r.begin(); i
parallel_for(blocked_range
Thanks.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Goran N
auto procEachRowL = [this, &imageOut, &imWB](const tbb::blocked_range &r){
for (size_t i=r.begin(); i this->ProcessEachRow(i, imageOut, imWB); };
parallel_for(blocked_range(0, yMax, 1), procEachRowL); // Syntax error here
Thanks.
for (size_t i=r.begin(); i
parallel_for(blocked_range
Thanks.
I used NQ example and it works fine for me.
[cpp]void solve() { auto forPar_For = [](const blocked_range&r){ for (size_t i = r.begin(); i != r.end(); ++i) { setQueen(new int[size], 0, (int)i); }; }; parallel_for(blocked_range (0, size, 1), forPar_For); } [/cpp]
I'm using the Parallel Composer update2-revised.
Jennifer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My syntax error was coming from:
parallel_for(blocked_range<int>...
instead of:
parallel_for(blocked_range<size_t>...
Now it works correctly. Thanks!
Quoting - Jennifer Jiang (Intel)
parallel_for(blocked_range<int>...
instead of:
parallel_for(blocked_range<size_t>...
Now it works correctly. Thanks!
Quoting - Jennifer Jiang (Intel)
I used NQ example and it works fine for me.
[cpp]void solve() {
auto forPar_For =
[](const blocked_range&r){
for (size_t i = r.begin(); i != r.end(); ++i) {
setQueen(new int[size], 0, (int)i);
};
};
parallel_for(blocked_range(0, size, 1), forPar_For);
}
[/cpp]
I'm using the Parallel Composer update2-revised.
Jennifer

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