tester.cpp: In function ‘int main()’:
tester.cpp:7: error: invalid controlling predicate
Line 7 being the one with for(...).
I've googled, but to no avail. Seems to be only people submitting bugs, but chances are it's something stupid I'm doing. Does anyone have any idea? I have g++-4.2, which supports OpenMP, I'm using the -fopenMP flag, and my example is verbatim from a working one. I honestly have no idea what to do. I'll try when I go home tonight on a linux machine.
Well, very strange. I did the same exact thing on my home computer (a linux machine) and it gave me the same error. Then I just tried it again, and it worked..? Here is the code that's working now, compiling with the same command:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
usingnamespace std;
#include <iostream>
#include <omp.h>
int main(){
#pragma omp parallel for
for(int i=0;i<1000000;i++){
if(i%10000==0)
cout << endl << i << " from thread : " << omp_get_thread_num();
}
return 0;
}
(ignore the omp.h, it was working fine before. I need that to use omp_get_thread().)
Now I get:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
[mlorp@arch testopenmp]$ ./runme
0500000 from thread : from thread : 10
510000 from thread : 1
10000 from thread : 0
520000 from thread : 1
20000 from thread : 0
530000 from thread : 1
30000 from thread : 0
540000 from thread : 1
40000 from thread : 0
550000 from thread : 1
50000 from thread : 0
560000 from thread : 1
And so on. But what the hell? I didn't change anything!
guestgulkan, by jeebus, you're right. That's the problem. What the hell? Can you not use that form in loops? Hmmm, I just checked. It works fine normally, but when you have the OpenMP #pragma, it doesn't like things of the form 3e8! Weird.
Phantom139, no. aex is a*10^x. It wouldn't be very handy if it was the way you said.