tasks-openmp
Differences
This shows you the differences between two versions of the page.
| tasks-openmp [June 11, 2026 at 07:42] – created - external edit 127.0.0.1 | tasks-openmp [June 11, 2026 at 11:07] (current) – Ivan Janevski | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| # Tasks (OpenMP) | # Tasks (OpenMP) | ||
| - | **Tasks** are the OpenMP mechanism for irregular parallelism. `parallel for` only handles loops with a known iteration count. For work like recursive algorithms, tree traversals, and producer-consumer patterns, `#pragma omp task` packages a unit of work that any idle thread in the current team can pick up and execute. Tasks are created inside a `single` region so only one thread generates them while the rest execute them. | + | **Tasks** are the OpenMP mechanism for irregular parallelism. `parallel for` only handles loops with a known iteration count. |
| + | |||
| + | For work like recursive algorithms, tree traversals, and producer-consumer patterns, `#pragma omp task` packages a unit of work that any idle thread in the current team can pick up and execute. Tasks are created inside a `single` region so only one thread generates them while the rest execute them. | ||
| ```c | ```c | ||
tasks-openmp.txt · Last modified: by Ivan Janevski
