skip to content
Ivan's wiki
Site Tools
Search
Tools
Show pagesource
Backlinks
Recent Changes
Media Manager
Sitemap
>
Recent Changes
Media Manager
Sitemap
openmp-master
This page is read only. You can view the source, but not change it.
# OpenMP master **[Master](https://hpc-tutorials.llnl.gov/openmp/master_directive/)** is an OpenMP directive that restricts execution of a block to thread 0. Unlike [\`single\`](/openmp-single), there is no implicit barrier. Other threads skip the block entirely and continue immediately, making it suitable for non-critical side effects like printing progress or updating a log counter where stalling the whole team would be wasteful. ```c #pragma omp parallel { do_work(); #pragma omp master printf("iteration %d done\n", iter); // thread 0 only; no barrier do_more_work(); // all threads, including thread 0, continue here } ``` 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.
Page Tools
Show pagesource
Backlinks
Back to top