Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

!$OMP SECTIONS

jim_dempsey
Beginner
337 Views
The OpenMP portion of the IVF manual has:

SECTIONS directives must be encountered by all threads in a team or by none at all. It must also be encountered in the same order by all threads in a team.

Just how does one control the ordering of the threads (re: same order by all threads)? Is this a misprint?

Jim

0 Kudos
2 Replies
Henry_G_Intel
Employee
337 Views

Hi Jim,

The OpenMP 2.5 specification doesn't say anything about an order dependence on the sections directive. This looks like a documentation error. I'll report it to the IVF team.

Henry

0 Kudos
ClayB
New Contributor I
337 Views

Jim -

I don't think this has to do with the threads or their order of execution.

This sounds like it is disallowing jumps into and out of the SECTIONS code ornesting some SECTIONS within a conditional. Thus, the following code is not legal:

Code:

!$OMP SECTIONS
!$OMP SECTION
    some stuff
    IF (some_condition) THEN
!$OMP SECTIONS
!$OMP SECTION
       conditional_stuff
!$OMP SECTION
       other_conditional_stuff
!OMP END SECTIONS
    ENDIF

!$OMP SECTION
    other_some_stuff_without_if
!$OMP END SECTIONS


In this example, not all threads would encounter the nested SECTIONS which violates the requirement inthe first sentence. (After writing this code, I realize that the nesting in superflous if the conditional was in a parallel region and if some threads would evaluate .TRUE. while others evalaute .FALSE. Nested SECTIONS, without a conditional, would also violate the requirements.)

As for encounter order, this just means that the same set of SECTIONS must be executed by each thread. I suppose this could be violated by some conditional code or selection logic.

--clay

0 Kudos
Reply