Final and mergeable tasks

Discussion of the OpenMP 3.1 draft specifications closed May 1, 2011. (Read only)
Locked
jakub
Posts: 74
Joined: Fri Oct 26, 2007 3:19 am

Final and mergeable tasks

Post by jakub »

In section 1.2.3, final task is described as task that forces all descendant tasks to become included tasks, where descendant tasks are transitive, but in section 2.7.1 the wording talks just about all task constructs encountered during execution of that task. So, is the final task property propagated to all descendant tasks?

Regarding merged tasks, does that mean that e.g. omp_in_final () in the merged tasks can return info about the parent task?

I mean, for:

Code: Select all

void
foo ()
{
#pragma omp task if (0) mergeable
  printf ("%d\n", omp_in_final ());
}
can it print 0, if the task calling foo is not a final nor included task? While the merged task is certainly omp_in_final (), if it uses complete data environment of the parent task, does the data environment also include the fact whether a thread is final or not etc.?

Federico

Re: Final and mergeable tasks

Post by Federico »

Hi Jakub,
yes, all descendants of a final tasks are included. The wording in 2.7.1 does not explicitly contradict this fact, but it's misleading, good catch.

By no means omp_in_final() can return info about the parent task. The property of being an "included task" is not represented in an ICV, so it's not part of the data environment. Moreover, it would be nonsensical, as you noted.

jakub
Posts: 74
Joined: Fri Oct 26, 2007 3:19 am

Re: Final and mergeable tasks

Post by jakub »

Ok, is omp_in_final () the only thing that is currently a user visible difference between a merged task compared to execution in the parent task?
Also, what is the difference between if(0) tasks and included tasks? The draft says if(0) tasks are just undeferred tasks, but can they be
considered included tasks if they are executed right away (i.e. can omp_in_final () return true for them)? Task scheduling constraints
say that if(0) tasks must be scheduled right away if task scheduling constraint 2. is already met, which is usually the case.
Non-if(0) tasks created by an if(0) tasks that isn't final (nor any of its parent are final) could not be included tasks, so
parent task may return omp_in_final () non-zero, while child returns omp_in_final () zero, right?

Federico

Re: Final and mergeable tasks

Post by Federico »

jakub wrote:Ok, is omp_in_final () the only thing that is currently a user visible difference between a merged task compared to execution in the parent task?
No, side effects on parent envoironment could be observable, if the task is merged.
jakub wrote:Also, what is the difference between if(0) tasks and included tasks? The draft says if(0) tasks are just undeferred tasks, but can they be
considered included tasks if they are executed right away (i.e. can omp_in_final () return true for them)? Task scheduling constraints
say that if(0) tasks must be scheduled right away if task scheduling constraint 2. is already met, which is usually the case.
included tasks unconditionally undergo immediate execution, there is no check for a constraint. An if(0) task does not, so it is not an included task.

If you have a use case in favor of making if(0) tasks included tasks, wed be glad if you could provide it.
jakub wrote:Non-if(0) tasks created by an if(0) tasks that isn't final (nor any of its parent are final) could not be included tasks, so
parent task may return omp_in_final () non-zero, while child returns omp_in_final () zero, right?
See above, both would return zero.

Locked