I was trying to compile the following code:
#pragma omp parallel shared (j)
{
#pragma omp for schedule(dynamic)
for(i = 0; i != j; i++)
{
// do something
}
}
but I got the following error: error: invalid controlling predicate.
The OpenMP standard states that for parallel for
constructor it "only" allows one of the following operators: <
, <=
, >
>=
.
I do not understand the rationale for not allowing i != j
. I could understand, in the case of the static schedule
, since the compiler needs to pre-compute the number of iterations assigned to each thread. But I can't understand why this limitation in such case for example. Any clues?
EDIT: even if I make for(i = 0; i != 100; i++)
, although I could just have put "<" or "<=" .