Starting OpenMP

This commit is contained in:
Anthony Scemama 2021-11-21 17:38:50 +01:00
parent a2c3f22f1d
commit cfa07e07ca

View File

@ -1525,7 +1525,7 @@ Result = 3.1415926535901777
#+LATEX: \end{column}
#+LATEX: \end{columns}
* Multi-threading
* Multi-threading :noesport:
** Processes /vs/ threads
*** Process
@ -1550,7 +1550,7 @@ Result = 3.1415926535901777
- Concurrent programming
- Graphical user interfaces (progress bars, ...)
- Asynchronous I/O
- Standard library: POSIX threads (pthreads)
- Standard library: POSIX threads (=pthreads=)
#+LATEX: \end{column}
#+LATEX: \end{columns}
@ -1676,6 +1676,23 @@ if __name__ == '__main__':
* OpenMP
** OpenMP
- OpenMP is an extension of programming languages that enable the use of
multi-threading to parallelize the code using directives.
- The OpenMP library may be implemented using =pthreads=
- Extensions in OpenMP5 to offload code execution to GPUs
- The same source code can be executed with/without OpenMP
#+begin_src fortran
!$OMP PARALLEL DEFAULT(SHARED) PRIVATE(i)
!$OMP DO
do i=1,n
A(i) = B(i) + C(i)
end do
!$OMP END DO
!$OMP END PARALLEL
#+end_src
* Exercises