Skip to main content

Unit 4.6.2 Summary

Subsubsection The week in pictures

Subsubsection OpenMP basics

OpenMP is a standardized API (Application Programming Interface) for creating multiple threads of execution from a single program. For our purposes, you need to know very little:

  • There is a header file to include in the file(s):

    #include <omp.h>

  • Directives to the compiler (pragmas):

    #pragma omp parallel 
    #pragma omp parallel for

  • A library of routines that can, for example, be used to inquire about the execution environment:


  • Environment parameters that can be set before executing the program:

    export OMP_NUM_THREADS=4

    If you want to see what the value of this environment parameter is, execute