2
#pragma omp parallel for reduction(+ : numOfVecs)
for(itc=clus.begin() ; itc!=clus.end() ; itc++)
{
    numOfVecs += (*itc)->getNumOfVecs();

}

I have a couple of codes like the code above where I need iterators in the loop. But I get the error 'invalid controlling predicate'. Is there any way to overcome this?

Thanks in advance


By the way I'm using the latest versions of code::blocks and mingw. I'm new to this but I think they support openmp3.0 by default after -fopenmp. The iterator I'm using is list iterator.

1
  • 2
    The problem is that the current OpenMP specification doesn't allow the operator "!=". The Intel compiler currently does allow "!=", so there is an example that this can be implemented. In a future OpenMP spec, it will most likely be changed. Until then you are going to be limited to <, <=, >, and >= as the relational operators you can use. Commented Jun 8, 2011 at 1:07

1 Answer 1

2

std::list<T>::iterator is a bidirectional iterator. Afaik, openmp3 parallel for loop works with random access iterators only (and no !=, as ejd mentioned). Maybe you can use a std::vector instead.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.