1
votes

If I do this it works fine:

#pragma omp parallel for
for (int i = 1; i <= 200; i++) { ... }

this still works fine

#pragma omp parallel for
for (unsigned long long i = 1; i <= 200; i++) { ... }

but this isnt working

#pragma omp parallel for
for (unsigned long long i = 1; i <= LLONG_MAX; i++) { ... }

-> compiler error: invalid controlling predicate

LLONG_MAX is coming from

#include <limits.h>

g++ --version -> g++ (tdm64-1) 5.1.0

it is said that openmp 3.0 can handle unsigned integer - types.

I searched alot for this issue, without success. They all use int as iteration-variable. Someone knows a solution?

1
What is LLONG_MAX on your platform? That's the problem here, not OpenMP type issues. - Jeff Hammond
cout << LLONG_MAX << endl; -> 9223372036854775807, I also tried with the ULLONG_MAX value 18...ULL, same error - Sneedlewoods

1 Answers

0
votes

i changed the program to:

unsigned long long n = ULLONG_MAX;
#pragma omp parallel for
for (unsigned long long i = 1; i < n; i++) { ... }

it seems to work now. Thank you Jeff for the hint.

i tried before with:

for (auto i = 1; i < n; i++) { ... }

-> no error, but loop didnt produce an output, very strange.