Skip main navigation

Data environment

Data environment
network connection
© Shutterstock
There are additional clauses that are available with the task directive:

  • untied

If the task is tied, it is guaranteed that the same thread will execute all the parts of the task. So, the untied clause allows code to be executed by more than one thread.

  • default (shared | none | private | firstprivate)

Default defines the default data scope of a variable in each
task. Only one default clause can be specified on an OpenMP task directive.

  • shared (list)

Shared declares the scope of the comma-separated data variables in
list to be shared across all threads.

  • private (list)

Private declares the scope of the data variables in list to be
private in each thread.

  • firstprivate (list)

Firstprivate declares the scope of the data variables to be private
in each thread. Each new private object is initialized with the value
of the original variable.

  • if (scalar expression)

Only if the scalar expression is true will the task be started, otherwise a normal sequential execution will be done. Useful for a good load balancing but limiting the parallelization overhead by doing a limited number of the tasks in total.

© PRACE and University of Ljubljana
This article is from the free online

Introduction to Parallel Programming

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now