# OpenMP and MPI learning materials

**URL:** <https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931>\
**Category:** Help\
**Created:** [March 10, 2022, 12:26am UTC](https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931 "2022-03-10T00:26:32Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![fortran4r](https://avatars.discourse-cdn.com/v4/letter/f/9de0a6/32.png) [@fortran4r](https://fortran-lang.discourse.group/u/fortran4r)\
**Post date:** [March 10, 2022, 12:26am UTC](https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931/1 "2022-03-10T00:26:32Z")

</div>

Are there any good OpenMP and MPI learning materials for Fortran users? Preferably in PDF format.

---

<div class="post-metadata">

**Author:** ![JohnCampbell](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@JohnCampbell](https://fortran-lang.discourse.group/u/JohnCampbell)\
**Post date:** [March 10, 2022, 1:27am UTC](https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931/2 "2022-03-10T01:27:59Z")

</div>

I have found the book “Using OpenMP” by Chapman, Jost & Van Der Pas (2008) to be a very useful reference, although the version I have is only to about OpenMP Ver 3+.

I would be interested to know of other more recent references.

Although [openmp.org](http://openmp.org) still exists, their forum is no longer there and may have been transferred to [stackoverflow.com](http://stackoverflow.com). It was a useful information source, but I can’t find their posts on stackoverflow.

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [March 10, 2022, 2:15am UTC](https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931/4 "2022-03-10T02:15:02Z")

</div>

> [@JohnCampbell](#):
>
> I have found the book “Using OpenMP” by Chapman, Jost & Van Der Pas (2008) to be a very useful reference, although the version I have is only to about OpenMP Ver 3+.
> 
> I would be interested to know of other more recent references.

There is

Mattson, Timothy G., Yun (Helen) He, and Alice E. Koniges (2019). [The OpenMP Common Core: Making OpenMP Simple Again](https://mitpress.mit.edu/books/openmp-common-core). MIT Press

The book uses C but the authors [write](http://ompcore.com/)

> For Fortran programmers, we’ve created a companion document, [Fortran Supplement](http://ompcore.com/wp-content/uploads/2022/01/fortran_supplement1.2.1.pdf) (ver. 1.2.1), which presents all the code from the Common Core book in Fortran instead of C. We hope this will let Fortran programmers extract maximum value from the book.

The book is in my [Fortran-related books list](https://github.com/Beliavsky/Fortran-related-books).

There are several hits when searching “openmp” at the [Fortran Wiki tutorials page](https://fortranwiki.org/fortran/show/Tutorials).

---

<div class="post-metadata">

**Author:** ![fortran4r](https://avatars.discourse-cdn.com/v4/letter/f/9de0a6/32.png) [@fortran4r](https://fortran-lang.discourse.group/u/fortran4r)\
**Post date:** [March 10, 2022, 4:40am UTC](https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931/5 "2022-03-10T04:40:43Z")

</div>

One thing that puzzles me is that most Fortran books don’t have chapters for OpenMP or MPI. I understand that they are not part of the standard, but they seem to be used much more than coarray based on the count of stack overflow questions.

---

<div class="post-metadata">

**Author:** ![JohnCampbell](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@JohnCampbell](https://fortran-lang.discourse.group/u/JohnCampbell)\
**Post date:** [March 10, 2022, 6:18am UTC](https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931/6 "2022-03-10T06:18:54Z")

</div>

I would estimate the reason for few books is that most Fortran authors, being proficient in the Fortran Standard, are not users of OpenMP.  
While I have become proficient in PARALLEL DO, I have little experience in WORKSHARE, so it may be a challenge to be able to cover the scope of OpenMP Ver 5.2 !

The scope of OpenMP is ever expanding and I have spent some time trying to understand just the memory management requirements. However having a compiler that supports the new features is a problem.  
The memory management features of Ver 5.1 are much more diverse than my requirements, so even these features would be a challenge to document and demonstrate.  
My solutions/understanding have been limited to the relationship between heap and stack for private vs shared array types, which in itself is significant for OpenMP performance.  
It is performance which is a key outcome/measure of OpenMP usage.

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [March 10, 2022, 12:20pm UTC](https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931/7 "2022-03-10T12:20:11Z")

</div>

> [@fortran4r](#):
>
> One thing that puzzles me is that most Fortran books don’t have chapters for OpenMP or MPI. I understand that they are not part of the standard, but they seem to be used much more than coarray based on the count of stack overflow questions.

[Introduction to Programming with Fortran (2018), 4th ed.](https://link.springer.com/book/10.1007/978-3-319-75502-1) by Chivers and Sleightholme has the following chapters and page numbers

31 Introduction to Parallel Programming . . . . . . . . . . . . . . . . . . . . . . 567-580  
32 MPI - Message Passing Interface . . . . . . . . . . . . . . . . . . . . . . . . . . 581-604  
33 OpenMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605-620  
34 Coarray Fortran . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621-632

---

<div class="post-metadata">

**Author:** ![fortran4r](https://avatars.discourse-cdn.com/v4/letter/f/9de0a6/32.png) [@fortran4r](https://fortran-lang.discourse.group/u/fortran4r)\
**Post date:** [March 10, 2022, 4:07pm UTC](https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931/8 "2022-03-10T16:07:04Z")

</div>

> [@Beliavsky](#):
>
> Introduction to Programming with Fortran (2018), 4th ed.

exactly what I have been looking for. the springer link website indicates that this book has been downloaded 4.9 million times. this is surprising because i only saw people talking about the Modern Fortran Explained book.

---

<div class="post-metadata">

**Author:** ![msz59](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@msz59](https://fortran-lang.discourse.group/u/msz59)\
**Post date:** [March 10, 2022, 8:26pm UTC](https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931/9 "2022-03-10T20:26:42Z")

</div>

> [@fortran4r](#):
>
> downloaded 4.9 million times

must be a _fake_. With EUR 72 price for ebook format, this would mean 350 million Euro for just one book. According to [Statista page](https://www.statista.com/statistics/272557/reveune-of-springer-science-and-business-media/) Springer yearly revenue oscillates around 580 million Euro.  
Well, unless they count the (free) downloads of _Front Matter_ (Contents) and _Back Matter_ (Appendices, Index)

---

<div class="post-metadata">

**Author:** ![fortran4r](https://avatars.discourse-cdn.com/v4/letter/f/9de0a6/32.png) [@fortran4r](https://fortran-lang.discourse.group/u/fortran4r)\
**Post date:** [March 10, 2022, 8:30pm UTC](https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931/10 "2022-03-10T20:30:39Z")

</div>

> [@msz59](#):
>
> With EUR 72 price for ebook format, this would mean 350 million Euro for just one book.

Most universities in the U.S. have subscribed to Springer Link. Most Springer Link ebooks, including this Fortran book, are free to subscribers. That being said, 4.9 million downloads still sounds unreal.

---

<div class="post-metadata">

**Author:** ![msz59](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@msz59](https://fortran-lang.discourse.group/u/msz59)\
**Post date:** [March 10, 2022, 10:13pm UTC](https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931/11 "2022-03-10T22:13:19Z")

</div>

Thx for the hint. I checked my non-US university and it also has it. I was able to download the book and it looks interesting, indeed.

---

<div class="post-metadata">

**Author:** ![msz59](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@msz59](https://fortran-lang.discourse.group/u/msz59)\
**Post date:** [March 10, 2022, 10:44pm UTC](https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931/12 "2022-03-10T22:44:38Z")

</div>

There is also a chapter on parallel programming in _[Modern Fortran in Practice](https://fortranwiki.org/fortran/show/Modern+Fortran+in+Practice)_ by Arjen Markus, covering OpenMP, MPI and Coarrays, with some sample code.

---

<div class="post-metadata">

**Author:** ![JohnCampbell](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@JohnCampbell](https://fortran-lang.discourse.group/u/JohnCampbell)\
**Post date:** [March 11, 2022, 12:14am UTC](https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931/13 "2022-03-11T00:14:18Z")

</div>

I am surprised that 15 pages on OpenMP is a solution to the OP !  
The book I quoted is over 300 pages, still with limited discussion on significant features I don’t use, such as WORKSHARE and SECTIONS.  
It is amaizing the breadth of OpenMP application.

---

<div class="post-metadata">

**Author:** ![cmaapic](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/cmaapic/32/659_2.png) [@cmaapic](https://fortran-lang.discourse.group/u/cmaapic)\
**Post date:** [March 11, 2022, 9:14am UTC](https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931/14 "2022-03-11T09:14:20Z")

</div>

The figure is for chapter downloads. In the university library sector Springer has deals that cover journals and books.

---

<div class="post-metadata">

**Author:** ![fortran4r](https://avatars.discourse-cdn.com/v4/letter/f/9de0a6/32.png) [@fortran4r](https://fortran-lang.discourse.group/u/fortran4r)\
**Post date:** [March 23, 2022, 9:32pm UTC](https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931/15 "2022-03-23T21:32:52Z")

</div>

I found this collection:  
[https://web.corral.tacc.utexas.edu/CompEdu/pdf/pcse/](https://web.corral.tacc.utexas.edu/CompEdu/pdf/pcse/)

---

<div class="post-metadata">

**Author:** ![msz59](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@msz59](https://fortran-lang.discourse.group/u/msz59)\
**Post date:** [March 23, 2022, 9:57pm UTC](https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931/16 "2022-03-23T21:57:54Z")

</div>

I have found a very extensive document (436 pp.) [OpenMP Application Programming Interface. Examples](https://www.openmp.org/wp-content/uploads/openmp-examples-5-0-1.pdf) on [openmp.org](http://openmp.org), with dozens of examples written both in C and Fortran. It is quite new (June 2020), covers version 5.0.1.

---

<div class="post-metadata">

**Author:** ![fortran4r](https://avatars.discourse-cdn.com/v4/letter/f/9de0a6/32.png) [@fortran4r](https://fortran-lang.discourse.group/u/fortran4r)\
**Post date:** [March 25, 2022, 4:27am UTC](https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931/17 "2022-03-25T04:27:01Z")

</div>

I noticed that you are the author of Introduction to Programming with Fortran. I have skimmed it and found it very useful. With all due respect, I feel like the first three chapters could be made a little bit more focused. For example, move chapter 1 to a preface + conventions section, move chapter 3 to the appendix, and use chapter 2 as chapter 1. Just some personal opinions.

---

<div class="post-metadata">

**Author:** ![cmaapic](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/cmaapic/32/659_2.png) [@cmaapic](https://fortran-lang.discourse.group/u/cmaapic)\
**Post date:** [March 25, 2022, 8:57am UTC](https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931/18 "2022-03-25T08:57:54Z")

</div>

Hi thanks for getting in touch. Springer currently have a minimum 20% content change requirement between editions. It is unlikely given this requirement that there will be a 5th edition, and that the 4th edition will be our last Fortran text book.

---

<div class="post-metadata">

**Author:** ![septc](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/septc/32/77_2.png) [@septc](https://fortran-lang.discourse.group/u/septc)\
**Post date:** [March 28, 2022, 9:48pm UTC](https://fortran-lang.discourse.group/t/openmp-and-mpi-learning-materials/2931/19 "2022-03-28T21:48:50Z")

</div>

Some time ago I bought this book (though I haven’t read it in detail yet…) The contents seem to cover MPI, OpenMP, OpenACC/GPU, etc… 🙂

> **[Parallel and High Performance Computing](https://www.manning.com/books/parallel-and-high-performance-computing)**
>
> Complex calculations, like training deep learning models or running large-scale simulations, can take an extremely long time. Efficient parallel programming can save hours—or even days—of computing time. Parallel and High Performance Computing shows...
