- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am new to TBB, my first attempts with parallel_for and parallel_scan have worked better than I could hope.
But now I try with a blocked_range2d and I cannot compile even the simplest code.
This compiles :
class FVoid1d {
public:
FVoid1d(){}
void operator () (const tbb::blocked_range<:SIZE_T>& r) const {}
};
tbb::parallel_for (tbb::blocked_range<:SIZE_T>(0,2,1),
FVoid1d());
This doesn't :
class FVoid2d {
public:
FVoid2d(){}
void operator () (const tbb::blocked_range2d<:SIZE_T>& r) const {}
};
tbb::parallel_for (tbb::blocked_range2d<:SIZE_T>(0,2,1,0,2,1),
FVoid2d());
Of course with this :
#include "tbb/parallel_for.h"
#include "tbb/blocked_range.h"
#include "tbb/blocked_range2d.h"
I must have missed something but I can not see what.
I am under Mac OS 10.6.7 (Intel Core 2 Duo), I tried with GCC 4.0 and 4.2
TBB 3.0 Update 7
log:
tbb/blocked_range.h:113:0 tbb/blocked_range.h:113: error: 'static Value tbb::blocked_range
tbb/blocked_range.h:108:0 tbb/blocked_range.h:108: error: 'long unsigned int tbb::blocked_range
...
Thanks,
AG
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You probably forgot a semi colon or curly brace somewhere in the code. You will have to most more of the code because it is difficult to tell what is happenening with those few lines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, thanks for the answer.
I found the problem is elsewhere. If I define the body of operator() inside the class or not :
This code was earlier in a header, I put all together to locate the problem :
This works :
#include "tbb/blocked_range.h"
#include "tbb/parallel_for.h"
class FFoo {
public:
FFoo () {}
void operator () (const tbb::blocked_range<:SIZE_T> &r);
};
#include "tbb/blocked_range2d.h"
void FFoo::operator () (const tbb::blocked_range<:SIZE_T> &r) {
std::size_t b = r.begin();
std::size_t e = r.end();
b; e;
}
This doesn't :
#include "tbb/blocked_range.h"
#include "tbb/parallel_for.h"
class FFoo {
public:
FFoo () {}
void operator () (const tbb::blocked_range<:SIZE_T> &r){
std::size_t b = r.begin();
std::size_t e = r.end();
b; e;
}
};
#include "tbb/blocked_range2d.h"
AG.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Order all #include statements before any code (especially in the second example), choose the files that are being referenced in that code (instead of mixing up blocked_range and blocked_range2d), and declare the operators const (put "const" after the closing parenthesis for the parameter and before the semicolon or opening brace, see the Reference manual; the range reference can also be non-const, although I don't see why this should be allowed, and it's safe to add the const as you did). Does that work (I don't see how the first example possibly could work as-is)?

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