master-openmp
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| master-openmp [June 11, 2026 at 11:08] – Ivan Janevski | master-openmp [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | # Master (OpenMP) | ||
| - | **Master** is an OpenMP directive that restricts execution of a block to thread 0. Unlike [[single-openmp|single]], | ||
| - | |||
| - | ```c | ||
| - | #pragma omp parallel | ||
| - | { | ||
| - | do_work(); | ||
| - | |||
| - | #pragma omp master | ||
| - | printf(" | ||
| - | |||
| - | do_more_work(); | ||
| - | } | ||
| - | ``` | ||
| - | |||
| - | Use `single` when the rest of the team must wait for the result; use `master` when the block is incidental and the team should not be held up. | ||
master-openmp.1781176131.md.gz · Last modified: by Ivan Janevski
