- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I wonder what would be the best way to split tree to perform parallel reduce. I used the following. But, doesn't work. Thanks in advance.
class Range {
private:
int mygs; // local grainsize
public:
TreeNode *mytree;
Range(TreeNode *t, int grainsize) :mytree(t), mygs(grainsize) {}
Range(SearchByNameRange &r, split) {
if (r.mytree->left) {
mytree = r.mytree->left;
}
else if (r.mytree->right) {
mytree = r.mytree->right;
}
}
bool empty() const {
return (mytree == NULL);
}
bool is_divisible() const {
if(size() > mygs) return true;
return false;
}
int size() const {
return mytree->size();
}
};
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why does the splitting constructor take a different type? And of course the splitting constructor has to actually split, i.e., r has to be affected as well. Note that TBB assumes associativity, so I wonder whether parallel_reduce would work for a reduction that has to visit subtrees first.
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