Intel® C++ Compiler 16.0 User and Reference Guide
Specifies the beginning of a code block that must be executed only once by the master thread of the team.
#pragma omp master |
structured-block
None.
This pragma allows the master thread to execute the structured-block. The other threads in the team skip the structured block and continue execution with the code following it. There is no implied barrier, either on entry to or exit from the master section.
Example: Showing the master thread logging a time during which a computational step is being done |
---|
#include <omp.h> double coefficient_step; #pragma omp parallel private(coefficient_step) { #pragma omp master { coefficient_step = omp_get_wtime(); output_timestamp(coefficient_step, “calculating coefficients”); } // parallel work to calculate coefficients } |
Since there is no barrier before or after the master construct, the time logged may not be assumed to be logged before the coefficient calculation starts.