skip to content
Ivan's wiki
Site Tools
Search
Tools
Show pagesource
Backlinks
Recent Changes
Media Manager
Sitemap
>
Recent Changes
Media Manager
Sitemap
openmp-barrier
This page is read only. You can view the source, but not change it.
# OpenMP barrier **[Barrier](https://hpc-tutorials.llnl.gov/openmp/barrier_directive/)** is a synchronisation point where all threads in a team wait until every member has arrived. OpenMP inserts an implicit barrier at the end of every `parallel`, `for`, and `sections` region. All threads wait there until every member of the team has arrived. An explicit `#pragma omp barrier` adds a synchronisation point mid-region, which is needed when one group of threads produces data that another group will consume in the same parallel block. ```c #pragma omp parallel { fill(omp_get_thread_num()); // each thread fills its slice #pragma omp barrier // wait for all threads to finish filling read(omp_get_thread_num()); // now safe to read any slice } ```
Page Tools
Show pagesource
Backlinks
Back to top