OpenMP is a parallelization framework that allows the programmer to easily do thread-level parallelization. It provides simple compiler directives, with which you mark up the parts of the code, which you want to execute in parallel.


The simplest compiler directive is the #pragma omp parallel, which opens a parallel region, where the same code is executed on all threads. You can find all the important directives in the quick reference. Additional details can be found in the full OpenMP specification. For details on OpenMP compiler directives see section 2.


Use the omp parallel pragma to print the thread number of multiple threads.