- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
I am trying to run the parallel_find_prime sample code in QT. I have MinGW 4.6 compiler. First I got an error
I am trying to run the parallel_find_prime sample code in QT. I have MinGW 4.6 compiler. First I got an error
_GLIBCXX_ATOMIC_BUILTINS_4 not defined. So I went to the c++config.h and put#define _GLIBCXX_ATOMIC_BUILTINS_4 1
Then program compiled.
But when I run it I get a segmentation fault error. when I debug it i found that it comes when list = 58.
I would like to know whether MinGW 4.6 is compatible for TBB and what might be the problem?
My system is windows 7 intel core2duo 2.2GHz.
Any help is highly appreciated.
Thanks.
Asanka
Link Copied
11 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for detailing the other parts of the configuration, but what TBB version is this, where exactly does the error occur, including the #include history? You should not need the built-in atomics, which are a suboptimal implementation of last resort only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the reply. TBB I used is tbb30_20110427oss_src. when I run it gave me this error (this is without _GLIBCXX_ATOMIC_BUILTINS_4 defined
# error This platform does not support exception propagation.
and segmentation fault is comming from parallel_find_prime function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Would it be possible to try the latest stable release instead of dwelling on the past? We're at tbb40_20111003oss now, 3 stable releases and half a year later.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried that one too. but it is failing. I think mingw4.6 could not handle lambda functions well. When I tried examples which use function objects they ran fine. GCC 4.5 says that they support C++11.
another thing I noticed is that sample code is made for visual studio. wonder that has to do anything with this error.
another thing I noticed is that sample code is made for visual studio. wonder that has to do anything with this error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"I tried that one too. but it is failing. I think mingw4.6 could not
handle lambda functions well. When I tried examples which use function
objects they ran fine. GCC 4.5 says that they support C++11."
Try to formulate a better test for __TBB_LAMBDAS_PRESENT in src/test/harness.h, examples/concurrent_priority_queue/shortpath/shortpath.cpp and examples/task_group/sudoku/sudoku.cpp. I'm successfully using TBB with several pre-lambda g++ compilers, so it is possible. If you prefer to let somebody else come up with a better test, just set it to 0 for now.
"another thing I noticed is that sample code is made for visual studio. wonder that has to do anything with this error."
At first sight that code seems to be bypassed c/o UNIXMODE, but just try again with a new __TBB_LAMBDAS_PRESENT value for now.
Try to formulate a better test for __TBB_LAMBDAS_PRESENT in src/test/harness.h, examples/concurrent_priority_queue/shortpath/shortpath.cpp and examples/task_group/sudoku/sudoku.cpp. I'm successfully using TBB with several pre-lambda g++ compilers, so it is possible. If you prefer to let somebody else come up with a better test, just set it to 0 for now.
"another thing I noticed is that sample code is made for visual studio. wonder that has to do anything with this error."
At first sight that code seems to be bypassed c/o UNIXMODE, but just try again with a new __TBB_LAMBDAS_PRESENT value for now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Raf,
Thanks for your reply. I will try to run those examples. But what about the error I get "this platform does not support exepction propargation". This is comming from exception_ptr.h. The #error is in c++config.h.
Thanks for your reply. I will try to run those examples. But what about the error I get "this platform does not support exepction propargation". This is comming from exception_ptr.h. The #error is in c++config.h.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please use the latest release instead, following my suggestion in #5 to allow you to do so.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found this. This is the parallel version of find_primes
void parallel_find_primes(int *&my_array, int *& prime_array){
void parallel_find_primes(int *&my_array, int *& prime_array){
parallel_for (blocked_range(0, list_count),
[=](const blocked_range& r) {
int prime, factor, limit;
for (int list=r.begin(); list != r.end(); list++){
prime = 1;
int test = my_array
- ;
if ((my_array
- % 2) ==1) {
limit = (int) sqrt((float)my_array
- ) + 1;
factor = 3;
while (prime && (factor <=limit)) {
if (my_array
- % factor == 0) prime = 0;
factor += 2;
}
}
else prime = 0;
if (prime)
prime_array
- = 1;
else
prime_array
- = 0;
}
});
}
[=] means that we can use variable declaired out side of the lambda functions within the lambda function. So my_array and prime_array should have meaning full values. But wen I debug this I can see __my_array and __prime_array variables with some garbage values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you now using the latest TBB version (please provide the name of the distribution file)? What modifications have you made to it? What does g++ --version say?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
TBB is tbb40_20111003oss_src
GCC is 4.6.1
I have not made any modification. [=] doesn't work so I have to put my variables inside [], like [x,y,z]
GCC is 4.6.1
I have not made any modification. [=] doesn't work so I have to put my variables inside [], like [x,y,z]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Now we're talking: you have the latest commercially aligned/stable release of TBB (there is a more recent development release, but only by about a month), and a GCC version that purportedly supports lambdas (since 4.5).
However, I don't see any code in that TBB version (tbb40_20111003oss is presented as having the same files as tbb40_258oss that I'm looking at, and I see no reason not to trust that) like what you posted in #8. Is this your code, and does TBB by itself (including tests and examples) build OK?
If it is a matter of incomplete lambda support, then maybe you can help TBB by selectively disabling some of its lambda code for a clean build. Otherwise I'm not sure what the problem is other than your ambition with the compiler at your disposal, so maybe you should instead talk to GNU about this.
Am I missing something?
However, I don't see any code in that TBB version (tbb40_20111003oss is presented as having the same files as tbb40_258oss that I'm looking at, and I see no reason not to trust that) like what you posted in #8. Is this your code, and does TBB by itself (including tests and examples) build OK?
If it is a matter of incomplete lambda support, then maybe you can help TBB by selectively disabling some of its lambda code for a clean build. Otherwise I'm not sure what the problem is other than your ambition with the compiler at your disposal, so maybe you should instead talk to GNU about this.
Am I missing something?
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