- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'd welcome getting some insight into why this example doesn't work: http://mypage.iu.edu/~heiland/tbb/
It compiles & runs, but produces incorrect results.
thanks, Randy
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - rheiland
I'd welcome getting some insight into why this example doesn't work: http://mypage.iu.edu/~heiland/tbb/
It compiles & runs, but produces incorrect results.
thanks, Randy
Yes, the global variable vp is being shared and incremented by different processors; this is completely not thread safe. Also, Sum is not atomic meaning that it can be read and updated at different times by different processors. Also, you're resetting sum everytime that UpdateSum's () operator is called. Also, you should be using parallel_reduce.

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