# Asking for suggestions about books on modern Fortran

**URL:** <https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738>\
**Category:** Help\
**Created:** [November 5, 2023, 7:06am UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738 "2023-11-05T07:06:31Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![diosium](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@diosium](https://fortran-lang.discourse.group/u/diosium)\
**Post date:** [November 5, 2023, 7:06am UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/1 "2023-11-05T07:06:31Z")

</div>

I have been using F77 and Fortran 90 for years. Now for the project I am currently working on, I would like to try the more recent Fortran (so-called modern Fortran?). Can you please suggest books that go through the modern features? I am particularly interested in the OOP paradigm included in these new versions. I know, derived types had been introduced since Fortran90 but from what I saw on some occasions, there seems to be more features associated with derived types that are added in these later Fortran versions, and I would like to learn the formal way. I am not entirely new to OOP, I have been using C++ and Python up to some degree, but

---

<div class="post-metadata">

**Author:** ![snano](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@snano](https://fortran-lang.discourse.group/u/snano)\
**Post date:** [November 5, 2023, 8:29am UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/2 "2023-11-05T08:29:45Z")

</div>

Welcome @diosium to the Fortran discourse. I am not an expert in OOP concepts in Fortran.  
But here are a few suggestions including an online course at the University of Virginia.  
1.[Modern Fortran Explained](https://academic.oup.com/book/26799)  
2. Online course at the University of Virginia, specifically see the classes part in there: [RC Learning Portal](https://learning.rc.virginia.edu/courses/fortran-introduction/classes/)

May be someone expert in OOP in Fortran can provide the best suggestions!!

best of luck on a new journey!!

---

<div class="post-metadata">

**Author:** ![Harper](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@Harper](https://fortran-lang.discourse.group/u/Harper)\
**Post date:** [November 5, 2023, 8:30am UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/3 "2023-11-05T08:30:17Z")

</div>

Modern Fortran Explained (0xford 2018) by Metcalf, Reid and Cohen. A new edition is due out soon.

---

<div class="post-metadata">

**Author:** ![conradoat](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/conradoat/32/1537_2.png) [@conradoat](https://fortran-lang.discourse.group/u/conradoat)\
**Post date:** [November 5, 2023, 9:18am UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/4 "2023-11-05T09:18:35Z")

</div>

When I joined this discourse group I heard about Milan Curcic’s “Modern Fortran: Building Efficient Parallel Applications” from Manning Books. Milan is very active in this group.

---

<div class="post-metadata">

**Author:** ![mhulsen](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@mhulsen](https://fortran-lang.discourse.group/u/mhulsen)\
**Post date:** [November 5, 2023, 10:00am UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/5 "2023-11-05T10:00:12Z")

</div>

New edition now listed at OUP: 07 December 2023 (Estimated)  
[Modern Fortran Explained](https://global.oup.com/academic/product/modern-fortran-explained-9780198876588)  
New color, new author.

---

<div class="post-metadata">

**Author:** ![rwmsu](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@rwmsu](https://fortran-lang.discourse.group/u/rwmsu)\
**Post date:** [November 5, 2023, 2:24pm UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/6 "2023-11-05T14:24:52Z")

</div>

Modern Fortran Explained is a good book for someone who already knows the basics of Fortran. For someone who has no prior experience with Fortran I prefer a true college level textbook. The only one of those I recommend is Stephen Chapman’s book,

> **[FORTRAN FOR SCIENTISTS &amp; ENGINEERS: Chapman, Stephen: 9780073385891:...](https://www.amazon.com/FORTRAN-SCIENTISTS-ENGINEERS-Stephen-Chapman/dp/0073385891)**
>
> FORTRAN FOR SCIENTISTS & ENGINEERS \[Chapman, Stephen\] on Amazon.com. \*FREE\* shipping on qualifying offers. FORTRAN FOR SCIENTISTS & ENGINEERS

Unlike MFE, the information is presented in a logical and consistent order suitable for classroom teaching.

Unfortunately is very pricey at least here in the U.S. I assume there is an international edition thats a lot cheaper.

I would consider Milan’s book a second choice. Once you are comfortable with the basics, I would also recommend Clerman and Spectors book, Modern Fortran - Style and Usage

> **[Modern Fortran: Style and Usage: Clerman, Norman S., Spector, Walter:...](https://www.amazon.com/Modern-Fortran-Style-Norman-Clerman/dp/052173052X)**
>
> Modern Fortran: Style and Usage \[Clerman, Norman S., Spector, Walter\] on Amazon.com. \*FREE\* shipping on qualifying offers. Modern Fortran: Style and Usage

Edit

I would add that Chapman’s book has (for me) the best explanation of Fortran OOP I’ve seen so far (at least in a book). Prior to reading his OOP chapter, I struggled with some of the basic OOP concepts since most of the examples of OOP were in other languages. Seeing these concepts expressed in Fortran suddenly made them understandable to my old Fortran centric brain.

I would also advise to not restrict yourself to just a book, there are several on-line courses, on-line books etc that might serve you just as well as a book will.

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [November 5, 2023, 2:39pm UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/7 "2023-11-05T14:39:26Z")

</div>

> [@diosium](#):
>
> I know, derived types had been introduced since Fortran90 but from what I saw on some occasions, there seems to be more features associated with derived types that are added in these later Fortran versions,

Welcome on the Discourse @diosium !

Yes, OOP was introduced in the [Fortran 2003](https://j3-fortran.org/doc/year/04/04-007.pdf) standard. Many of the books published since will therefore have a chapter about OOP. At the bottom of the page [Learn — Fortran Programming Language](https://fortran-lang.org/learn/) you will find many online ressources and a list of books.

If you want a book to quickly update your knowledge about latest Fortran standards, Milan Curcic’s [Modern Fortran: Building Efficient Parallel Applications](https://www.manning.com/books/modern-fortran) is a good choice. It can be read by beginners but also by confirmed Fortran developers not aware of the 21th century features.

And once your knowledge is updated, _Modern Fortran Explained_ is an excellent reference book.

A more expert book on OOP is:  
Rouson, D., Xia, J., and Xiaofeng, X. 2014 [Scientific Software Design: The Object-Oriented Way](https://www.cambridge.org/gb/academic/subjects/engineering/engineering-general-interest/scientific-software-design-object-oriented-way) 2nd ed Cambridge. Cambridge University Press

---

<div class="post-metadata">

**Author:** ![gak](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/gak/32/146_2.png) [@gak](https://fortran-lang.discourse.group/u/gak)\
**Post date:** [November 5, 2023, 6:59pm UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/8 "2023-11-05T18:59:01Z")

</div>

[Introduction to Programming with Fortran](https://link.springer.com/book/10.1007/978-3-319-75502-1) by Ian Chivers and Jane Sleightholme seems like a tour de force intro to programming with modern Fortran. (If you’re an experienced programmer, much can be skimmed over.) But they cover a lot of Fortran in depth.

---

<div class="post-metadata">

**Author:** ![diosium](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@diosium](https://fortran-lang.discourse.group/u/diosium)\
**Post date:** [November 6, 2023, 1:01am UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/9 "2023-11-06T01:01:34Z")

</div>

> [@snano](#):
>
> Welcome @diosium to the Fortran discourse.

Thanks! I was a bit surprised I found this forum, when I started programming in Fortran intensively6 years ago, my only go-to-places for help was only StackOverflow and intel’s Fortran forum. I don’t remember seeing a Fortran-specific forum.

---

<div class="post-metadata">

**Author:** ![diosium](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@diosium](https://fortran-lang.discourse.group/u/diosium)\
**Post date:** [November 6, 2023, 1:03am UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/10 "2023-11-06T01:03:07Z")

</div>

The link does not work. It says “page not found”.

---

<div class="post-metadata">

**Author:** ![milancurcic](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/milancurcic/32/2_2.png) [@milancurcic](https://fortran-lang.discourse.group/u/milancurcic)\
**Post date:** [November 6, 2023, 1:19am UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/11 "2023-11-06T01:19:07Z")

</div>

There have been great suggestions already. Though I appreciate people recommending my book (thank you!), @diosium, you should be aware that my book only scratches the surface regarding OOP. For example, it doesn’t cover `extends` and `abstract` features which are important elements of Fortran OOP.

---

<div class="post-metadata">

**Author:** ![RonShepard](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@RonShepard](https://fortran-lang.discourse.group/u/RonShepard)\
**Post date:** [November 6, 2023, 4:39am UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/12 "2023-11-06T04:39:55Z")

</div>

I think a new version of Modern Fortran Explained that includes the new f2023 features is due to be available shortly.

---

<div class="post-metadata">

**Author:** ![diosium](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@diosium](https://fortran-lang.discourse.group/u/diosium)\
**Post date:** [November 6, 2023, 6:58am UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/13 "2023-11-06T06:58:11Z")

</div>

I appreciate your transparency regarding what your book doesn’t cover @milancurcic. It does seem to be among the popular ones on Amazon US though, I will see which one I am going to get.

---

<div class="post-metadata">

**Author:** ![rwmsu](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@rwmsu](https://fortran-lang.discourse.group/u/rwmsu)\
**Post date:** [November 6, 2023, 12:19pm UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/14 "2023-11-06T12:19:54Z")

</div>

I would also add that people should obtain a copy of Milan’s book for his excellent coverage of co-arrays. Now if the compiler developers can just get co-arrays to work as well on a 8-16-32 core workstation as it does on a 100K plus core Cray then all the work thats been put into co-arrays in the recent standards will be worth it. Unfortunately, I’ve not been able to get it to perform any better than MPI if it runs at all.

---

<div class="post-metadata">

**Author:** ![Shahid](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/shahid/32/3672_2.png) [@Shahid](https://fortran-lang.discourse.group/u/Shahid)\
**Post date:** [November 7, 2023, 5:25pm UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/15 "2023-11-07T17:25:10Z")

</div>

I find this one

> **[Object-Oriented Programming via Fortran 90/95: Akin, Ed: 9780521524087:...](https://www.amazon.com/Object-Oriented-Programming-via-Fortran-90/dp/0521524083)**
>
> Object-Oriented Programming via Fortran 90/95 \[Akin, Ed\] on Amazon.com. \*FREE\* shipping on qualifying offers. Object-Oriented Programming via Fortran 90/95

---

<div class="post-metadata">

**Author:** ![m\_b\_metcalf](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@m\_b\_metcalf](https://fortran-lang.discourse.group/u/m_b_metcalf)\
**Post date:** [November 8, 2023, 9:13am UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/16 "2023-11-08T09:13:02Z")

</div>

That is true. The new edition should be published on 7 December and is available for pre-ordering on the OUP and some Amazon websites already. The text has been completely revised and reordered. It contains two completely new chapters on the F2023 features. Further, the extended examples will be downloadable. This applies not only to the extisting OOP example, but also to three complete, new examples of coarray code. And, of course, we are joined by Reinhold Bader as a fourth author.

Mike Metcalf

---

<div class="post-metadata">

**Author:** ![Shahid](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/shahid/32/3672_2.png) [@Shahid](https://fortran-lang.discourse.group/u/Shahid)\
**Post date:** [November 11, 2023, 6:02pm UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/17 "2023-11-11T18:02:28Z")

</div>

One of the main features of modern Fortran is `do concurrent`. Somehow it is missing in its entirety in all books. Intel’s Fortran compiler now supports the `reduce` clause. This is significant!

The new version [Modern Fortran Explained 2023](https://global.oup.com/academic/product/modern-fortran-explained-9780198876588?q=modern%20Fortran&lang=en&cc=kr#) has two chapters (17 and 18) on the Coarrays but not on `do concurrent`. Perhaps a chapter on `concurrent programming` would be great as we have on `Object-oriented Programming` (chapter 15) and `generic programming` (chapter 22). Maybe its importance is hidden again in `chapter 7` on the array features (as in the previous edition).

---

<div class="post-metadata">

**Author:** ![Harper](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@Harper](https://fortran-lang.discourse.group/u/Harper)\
**Post date:** [November 12, 2023, 4:42am UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/18 "2023-11-12T04:42:30Z")

</div>

Modern Fortran Explained (2018) did not hide `do concurrent`: the index tells you where to look (pages 137, 435, 436). It also mentions the `reduce` clause (page 432). Presumably the authors thought those topics didn’t need a whole chapter. Next month will reveal what the 2023 edition says.

---

<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:** [November 12, 2023, 3:33pm UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/19 "2023-11-12T15:33:14Z")

</div>

Jane and I only have one do concurrent example. Here is the source

include ‘integer\_kind\_module.f90’  
include ‘precision\_module.f90’  
include ‘timing\_module.f90’

program ch3305

use timing\_module  
use precision\_module  
use omp\_lib

use iso\_fortran\_env

implicit none

integer, parameter :: n = 100000000  
integer, parameter :: loop\_count = 10  
integer, parameter :: n\_types = 4  
integer :: i  
integer :: j  
integer :: nthreads

real (dp), allocatable, dimension (🙂 :: x  
real (dp), allocatable, dimension (🙂 :: y  
real (dp), allocatable, dimension (🙂 :: z

real, dimension (n\_types, loop\_count) :: timing\_details = 0.0  
real, dimension (n\_types) :: t\_sum = 0.0  
real, dimension (n\_types) :: t\_average = 0.0  
real :: reset = 0.0

character (15), dimension (n\_types) :: heading\_1 = &  
[ ’ Whole array ', &  
’ Do loop ', &  
’ Do concurrent ', &  
’ openmp ’ ]

print \* , ’ ’  
print \*,compiler\_version()  
print \*,compiler\_options()  
print \*, ’ ’  
call start\_timing()  
print \* , ’ ’

nthreads = omp\_get\_max\_threads()  
open (unit=20, file=‘ch3305.dat’)  
print 100, nthreads  
100 format (’ Nthreads = ', i3)

!  
! Dynamic allocation

allocate (x(n))  
allocate (y(n))  
allocate (z(n))

!  
! Initialisation  
!

call random\_number(x)  
call random\_number(y)  
z = 0.0\_dp

print 110, time\_difference()  
110 format (’ Initialise time = ', f9.6)  
write (20, 120) x(1), y(1), z(1)  
120 format (3(2x,f6.3))  
print \*, ’ ’

do j = 1, loop\_count

```
print 130, j
130 format (' Iteration = ', i3)

```

!  
! Whole array syntax  
!

```
z = x + y
timing_details(1, j) = time_difference()
write (20, 120) x(1), y(1), z(1)
z = 0.0_dp
reset = time_difference()

```

!  
! Simple traditional do loop  
!

```
do i = 1, n
  z(i) = x(i) + y(i)
end do
timing_details(2, j) = time_difference()
z = 0.0_dp
reset = time_difference()

```

!  
! do concurrent loop  
!

```
do concurrent (i=1:n)
  z(i) = x(i) + y(i)
end do
timing_details(3, j) = time_difference()
write (20, 120) x(1), y(1), z(1)
z = 0.0_dp
reset = time_difference()

```

!  
! OpenMP parallel loop  
!

!$omp parallel do  
do i = 1, n  
z(i) = x(i) + y(i)  
end do  
!$omp end parallel do  
timing\_details(4, j) = time\_difference()  
write (20, 120) x(1), y(1), z(1)  
z = 0.0\_dp  
reset = time\_difference()

end do

close (20)  
print 140  
140 format (15x, ’ Sum Average’)

do i = 1, n\_types  
t\_sum(i) = sum(timing\_details(i,1:loop\_count))  
t\_average(i) = t\_sum(i)/loop\_count  
print 150, heading\_1(i), t\_sum(i), t\_average(i)  
150 format (a, 2(3x,f9.6))  
end do

print \*, ’ ’  
call end\_timing()

end program

The program compares the performance of whole array syntax, traditional  
do loops, openmp and do concurrent.

Here are results from a Dell 5820 workstation  
for Intel, Nag and gfortran.

C:\document\fortran\4th\_edition\_update\examples\>ch3305\_gfortran.exe

GCC version 13.2.0  
-mtune=generic -march=x86-64 -mthreads -O2 -fopenmp

2023/11/12 15:17:40 731

Nthreads = 36  
Initialise time = 0.998391

Iteration = 1  
Iteration = 2  
Iteration = 3  
Iteration = 4  
Iteration = 5  
Iteration = 6  
Iteration = 7  
Iteration = 8  
Iteration = 9  
Iteration = 10  
Sum Average  
Whole array 1.871372 0.187137  
Do loop 1.852208 0.185221  
Do concurrent 1.745150 0.174515  
openmp 0.468791 0.046879

2023/11/12 15:17:49 836  
Total time = 9.104781

NAG Fortran Compiler Release 7.1(Hanzomon) Build 7110  
-O4 -openmp

2023/11/12 15:25:44 840

Nthreads = 36  
Initialise time = 0.671898

Iteration = 1  
Iteration = 2  
Iteration = 3  
Iteration = 4  
Iteration = 5  
Iteration = 6  
Iteration = 7  
Iteration = 8  
Iteration = 9  
Iteration = 10  
Sum Average  
Whole array 3.873122 0.387312  
Do loop 1.951388 0.195139  
Do concurrent 1.794080 0.179408  
openmp 0.477791 0.047779

2023/11/12 15:25:55 808  
Total time = 10.966643

Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel  
(R) 64, Version 2021.10.0 Build 20230609\_000000  
/O2 /openmp /o:ch3305\_ifort.exe

2023/11/12 15:26:38 621

Nthreads = 36  
Initialise time = 14.672000

Iteration = 1  
Iteration = 2  
Iteration = 3  
Iteration = 4  
Iteration = 5  
Iteration = 6  
Iteration = 7  
Iteration = 8  
Iteration = 9  
Iteration = 10  
Sum Average  
Whole array 1.889000 0.188900  
Do loop 1.718000 0.171800  
Do concurrent 0.386000 0.038600  
openmp 0.389000 0.038900

2023/11/12 15:26:59 402  
Total time = 20.781000

Ian

---

<div class="post-metadata">

**Author:** ![aledinola](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@aledinola](https://fortran-lang.discourse.group/u/aledinola)\
**Post date:** [November 12, 2023, 9:16pm UTC](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738/20 "2023-11-12T21:16:24Z")

</div>

Very interesting thread!  
I have found Chapman book on Fortran for engeneers (already mentioned above) to be the best reference as a manual covering modern Fortran, from the very beginning up to Coarrays.

I have learnt quite a lot from “Modern Fortran in practice” by Arjen Markus, link: [Modern Fortran in Practice](https://www.cambridge.org/core/books/modern-fortran-in-practice/BC5BD23B2E478B4D457C5D6265BA9363)  
Compared to Chapman, it is much shorter and tailored for programmers who know Fortran already but want to improve and learn new features of the modern versions. In my opinion, a little gem.

Recently I came across “CUDA Fortran for Scientists and Engineers: Best Practices for Efficient CUDA Fortran Programming 1st Edition”, available on amazon. I would like to learn how to use gpu parallelization with Fortran, is this a good source? Does anyone recommend it?  
Thanks!!

[Next page](https://fortran-lang.discourse.group/t/asking-for-suggestions-about-books-on-modern-fortran/6738.md?page=2)
