OMP_DYNAMIC and OMP_SCHEDULE : difference?

General OpenMP discussion

OMP_DYNAMIC and OMP_SCHEDULE : difference?

Postby myusrnam » Mon Sep 29, 2008 6:43 am

Hi. I am confused as to whether there is, or should be, any difference doing the following:

Assume you have some C++ for loop and you put a parallel pragma around it:

#pragma omp parallel for
for (int i = 0; etc.....) {
........some code.... }

What is, or should be, the difference in scheduling behavior between the following two cases:

case (1), using OMP_DYANMIC:

In this case, you just set OMP_DYNAMIC to "true" before running the program.

case (2), using OMP_SHARED

In this case, you set OMP_SHARED to "dynamic" and insert a "schedule(runtime)" clause in the parallel pragma, like this:

#pragma omp paralle for schedule(runtime)

Here are a couple of side questions : does case matter when setting OMP_DYANMIC? Is TRUE the same as true? And, does it matter whether you put quotes around 'dynamic' for OMP_SHARED?

Anyways, from my reading of the 2.5 spec, I think the 2 cases ought to behave the same. Do they?


Re: OMP_DYNAMIC and OMP_SCHEDULE : difference?

Postby ejd » Mon Sep 29, 2008 8:32 am

Do me a favor and edit your post and change OMP_SHARED to OMP_SCHEDULE so people (like me) don't get confused.

OMP_DYNAMIC "controls dynamic adjustment of the number of threads to use for executing parallel regions". Note that it has no effect on the schedule used for a worksharing construct - only the number of threads used. OMP_SCHEDULE "controls the schedule type and chunk size of all loop directives that have the schedule type runtime". So the two are quite different in what they control.

As for your last questions, see Chapter 4 Environment Variables.
Does case matter when setting OMP_DYANMIC?

Yes. See p113, 5: The names of the environment variables must be uppercase.

Is TRUE the same as true?

Yes. See p113, 6-7: The values assigned to the environment variables are case insensitive and may have leading and trailing white space.

Does it matter whether you put quotes around 'dynamic' for OMP_SCHEDULE?

Yes and no. The examples in the specification show quotes around it in all cases. However, they are really only needed in the case where you are specifying a chunk, so that the value is what is in the quotes ("type,chunk"). Without the quotes Unix would break this into separate parts at the comma.
Posts: 1025
Joined: Wed Jan 16, 2008 7:21 am

Return to Using OpenMP

Who is online

Users browsing this forum: No registered users and 2 guests