Unit 4.6.2 Summary
¶Subsubsection 4.6.2.1 The week in pictures
¶Subsubsection 4.6.2.2 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:
omp_get_max_threads() omp_get_num_threads() omp_get_thread_num()
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, executeecho $OMP_NUM_THREADS