Parallel Programming in Fortran using OpenMP
Most Fortran programmers still create programs that run serially. This means that one program statement (a command) is processed after the other in a single thread. And this despite the fact that they now work with PCs that have multi-core processors.
Since Fortran 95, Fortran itself has offered commands that can be used to parallelize parts of a program. To name a few: FORALL, WHERE, DO CONCURRENT.
And, since the arrival of Fortran 2003 one can also use Co-Arrays. However the possiblities are limited.
With OpenMP, a programming language extension has been continuously developed for 3 decades, which provides a remedy and is also integrated in some Fortran compiler systems. Details can be found at https://www.openmp.org/.
For example, Intel’s Fortran compilers allow OpenMP to be used with the help of so-called directives that are “packed” in comment lines. Example:
!$OMP PARALLEL DO
do i = 1, N
a(i) = i*2
end do
!$OMP END PARALLEL DO
Various book references, tutorials, etc. can also be found on the aforementioned OpenMP website ( https://www.openmp.org/resources/tutorials-articles/) , with which you can learn how to use OpenMP yourself. We found the video tutorials by Tim Mattson, a scientist employed at Intel who was involved in the development of OpenMP, to be very helpful:
Tim Mattson’s (Intel) “Introduction to OpenMP” (2013) on YouTube.
+ Slides: Intro_To_OpenMP_Mattson.pdf
+ Exercise files: Mattson_OMP_exercises.zip
Since most of the examples presented there are written in C/C++, we programmed them in Fortran:
https://polyhedron.com/wp-content/uploads/2023/06/qtOpenMP.zip
In addition to the Fortran source code files, project files (.vproj) are also included for users of Microsoft Visual Studio, which allow the programs to be conveniently created and tested via ‘Build’.
They are free for customers who purchased an Intel oneAPI license or a support service renewal (SSR) from us in 2023. If this applies to you, send us an email with the serial number (licence key) and you will receive the password for unzipping.
Note: The OpenMP name and the OpenMP logo are registered trademarks of the OpenMP Architecture Review Board