- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm a beginner with intel TBB and to understand the principles of parallel_reduce a tried a simple maximum search on a ten-elements vector. Strangely the results I get are sometimes false (on the same entry I can have either the max or the second with about the same probability) I don't get what I messed up and I think that I missed an important point.
Could you please take a look.
Thank you in advance
Alex
I'm a beginner with intel TBB and to understand the principles of parallel_reduce a tried a simple maximum search on a ten-elements vector. Strangely the results I get are sometimes false (on the same entry I can have either the max or the second with about the same probability) I don't get what I messed up and I think that I missed an important point.
Could you please take a look.
Thank you in advance
Alex
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you studied the examples in the Tutorial? In both constructors, initialise the member variables to neutral values. You must also not assume that operator() is called exactly once for Max: assume it already contains an intermediate result from any number of previous calls. Note that I have not verified the rest of the code, but this should already make a difference.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Raf Schietekat
You must also not assume that operator() is called exactly once for Max: assume it already contains an intermediate result from any number of previous calls.

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