Reputation: 49
There is a similar question here for parallel sections instead of tasks: OpenMP and C++: this pointer, but I don't see anything in the standard (currently 5.2) which would confirm that 'this' should be shared.
Here is a member function:
long long kdnode::searchkdtree(kdnode *q, int p,
long long cut, long long cut2,
int depth, int depthmax)
{
long long xij, yij, zij, wij, r2, count, countL, countH;
// ...
#pragma omp task shared(countH) if(depth < depthmax) \
firstprivate(q, p, cut, cut2, depth, depthmax)
{
countH = hi->searchkdtree(q, p+1, cut, cut2, depth+1, depthmax);
}
// ...
}
"hi" is a member of kdnode, will be reached by using 'this': this->hi->...
.
The only thing I can find in standard (5.1.1, p.99):
• In an orphaned task generating construct, if no default clause is present, formal arguments passed by reference are firstprivate.
Technically, 'this' pointer will be passed to the member function as a hidden parameter, by value - but I strongly suspect that the desired effect is 'shared' 'this'. Can somebody point me to a place in the standard please?
Upvotes: 0
Views: 154