OpenMP sections are for somewhat unrelated bits of code that can be executed in parallel. The idea is that within your algorithms, there are different parts which aren't super organized, but which could be executed in any order and even in parallel. This is a very ad-hoc way of parallelizing, which you don't expect to see much in a code.
Anyway, your code isn't standard compliant since all blocks within a sections
construct must be enclosed inside a section
block (but the first for which this is optional as it is implicitly enclosed in a first section
block). Here, if you where to add this implicit #pragma omp section
right before your for
loop, you'd see how little sense the code would have: the loop is in a section and the body into another...
Here, since you have a for
loop, this structures your code very well and should permit you to use a omp parallel for
directive. You only need to rewrite a bit your for
such as to explicit better the loop boundaries.