Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenMP parallel for - what is default schedule?

What schedule algorithm is used when no schedule clause is specified? I.e.:

#pragma omp parallel for
for (int i = 0; i < n; ++i)
    Foo(i);
like image 659
Mixer Avatar asked Jan 22 '14 18:01

Mixer


1 Answers

Start from the documentation that you have linked to. Section 2.7.1.1 Determining the Schedule of a Worksharing Loop reads:

If the loop directive does not have a schedule clause then the current value of the def-sched-var ICV determines the schedule.

The sentence preceding the quoted one refers to Section 2.3.1 which reads:

  • def-sched-var - controls the implementation defined default scheduling of loop regions. There is one copy of this ICV per device.

The table in Section 2.3.2 ICV Initialization states that the initial value of def-sched-var is implementation defined and that there is no environment variable that affects that value. Therefore the default loop schedule is implementation defined. Q.E.D.

like image 81
Hristo Iliev Avatar answered Oct 13 '22 17:10

Hristo Iliev