sections directive provides a means by which different
threads can run different parts of the program in parallel. Copy
the code from the appropriate link below to create the executable
Try running the executable
omp_sections using different values of
In this example, there are three functions,
long_loop. These three functions are called from within an OpenMP sections
directive, where each function is placed into a separate OpenMP section.
This tells the compiler that these three functions can be called in parallel,
and a thread from the team can be assigned to each section. Note that if
there are more sections than threads, then each section is queued until a
thread is available to run it, while if there are more threads than sections,
then the extra threads will have nothing to do. Note that there is no
guarantee as to the order in which sections are executed.