Book description
Using Fortran, early and accurate forecasts for hurricanes and other major storms have saved thousands of lives. Better designs for ships, planes, and automobiles have made travel safer, more efficient, and less expensive than ever before. Using Fortran, low-level machine learning and deep learning libraries provide incredibly easy, fast, and insightful analysis of massive data. Fortran is an amazingly powerful and flexible programming language that forms the foundation of high performance computing for research, science, and industry. And it's come a long, long way since starting life on IBM mainframes in 1956. Modern Fortran is natively parallel, so it's uniquely suited for efficiently handling problems like complex simulations, long-range predictions, and ultra-precise designs. If you're working on tasks where speed, accuracy, and efficiency matter, it's time to discover—or re-discover—Fortran..About the Technology
For over 60 years Fortran has been powering mission-critical scientific applications, and it isn't slowing down yet! Rock-solid reliability and new support for parallel programming make Fortran an essential language for next-generation high-performance computing. Simply put, the future is in parallel, and Fortran is already there.
About the Book
Modern Fortran teaches you to develop fast, efficient parallel applications using twenty-first-century Fortran. In this guide, you'll dive into Fortran by creating fun apps, including a tsunami simulator and a stock price analyzer. Filled with real-world use cases, insightful illustrations, and hands-on exercises, Modern Fortran helps you see this classic language in a whole new light.
What's Inside
- Fortran's place in the modern world
- Working with variables, arrays, and functions
- Module development
- Parallelism with coarrays, teams, and events
- Interoperating Fortran with C
About the Reader
For developers and computational scientists. No experience with Fortran required.
About the Author
Milan Curcic is a meteorologist, oceanographer, and author of several general-purpose Fortran libraries and applications.
Quotes
For the reader seeking proof of life for modern Fortran, Milan’s work provides ample evidence of the language’s ongoing role in technological modernity.
- From the Foreword by Damian Rouson, Sourcery Institute
An excellent introduction to the joys of modern Fortran; from polymorphism to parallelism. A must-read.
- Matthew Emmett, Computer Modelling Group
A unique book that builds on many real-life examples to show that Fortran is still alive and can be used productively even in the era of the web.
- Maurizio Tomasi, Università degli Studi di Milano
Compared to other programming books I have seen, this one is exceptionally pleasant to work through.
- Konrad Hinsen, Centre National de la Recherche Scientifique
Table of contents
- Modern Fortran
- Copyright
- contents
- front matter
- Part 1. Getting started with Modern Fortran
- 1 Introducing Fortran
-
2 Getting started: Minimal working app
- 2.1 Compiling and running your first program
- 2.2 Simulating the motion of an object
-
2.3 Implementing the minimal working app
- 2.3.1 Implementation strategy
- 2.3.2 Defining the main program
- 2.3.3 Declaring and initializing variables
- 2.3.4 Numeric data types
- 2.3.5 Declaring the data to use in our app
- 2.3.6 Branching with an if block
- 2.3.7 Using a do loop to iterate
- 2.3.8 Setting the initial water height values
- 2.3.9 Predicting the movement of the object
- 2.3.10 Printing results to the screen
- 2.3.11 Putting it all together
- 2.4 Going forward with the tsunami simulator
- 2.5 Answer key
- 2.6 New Fortran elements, at a glance
- 2.7 Further reading
- Summary
- Part 2. Core elements of Fortran
-
3 Writing reusable code with functions and subroutines
- 3.1 Toward higher app complexity
- 3.2 Don’t repeat yourself, use procedures
- 3.3 Modifying program state with subroutines
- 3.4 Writing pure procedures to avoid side effects
- 3.5 Writing procedures that operate on both scalars and arrays
- 3.6 Procedures with optional arguments
- 3.7 Tsunami simulator: Putting it all together
- 3.8 Answer key
- 3.9 New Fortran elements, at a glance
- 3.10 Further reading
- Summary
- 4 Organizing your Fortran code using modules
-
5 Analyzing time series data with arrays
- 5.1 Analyzing stock prices with Fortran arrays
-
5.2 Finding the best and worst performing stocks
- 5.2.1 Declaring arrays
- 5.2.2 Array constructors
- 5.2.3 Reading stock data from files
- 5.2.4 Allocating arrays of a certain size or range
- 5.2.5 Allocating an array from another array
- 5.2.6 Automatic allocation on assignment
- 5.2.7 Cleaning up after use
- 5.2.8 Checking for allocation status
- 5.2.9 Catching allocation and deallocation errors
- 5.2.10 Implementing the CSV reader subroutine
- 5.2.11 Indexing and slicing arrays
- 5.3 Identifying risky stocks
- 5.4 Finding good times to buy and sell
- 5.5 Answer key
- 5.6 New Fortran elements, at a glance
- 5.7 Further reading
- Summary
- 6 Reading, writing, and formatting your data
- Part 3. Advanced Fortran use
- 7 Going parallel with Fortran coarrays
-
8 Working with abstract data using derived types
- 8.1 Recasting the tsunami simulator with derived types
-
8.2 Defining, declaring, and initializing derived types
- 8.2.1 Defining a derived type
- 8.2.2 Instantiating a derived type
- 8.2.3 Accessing derived type components
- 8.2.4 Positional vs. keyword arguments in derived type constructors
- 8.2.5 Providing default values for derived type components
- 8.2.6 Writing a custom type constructor
- 8.2.7 Custom type constructor for the Field type
- 8.3 Binding procedures to a derived type
- 8.4 Extending tsunami to two dimensions
- 8.5 Answer key
- 8.6 New Fortran elements, at a glance
- 8.7 Further reading
- Summary
- 9 Generic procedures and operators for any data type
- 10 User-defined operators for derived types
- Part 4. The final stretch
-
11 Interoperability with C: Exposing your app to the web
- 11.1 Interfacing C: Writing a minimal TCP client and server
-
11.2 TCP server program: Receiving network connections
- 11.2.1 IP address data structures
- 11.2.2 Initializing the IP address structure
- 11.2.3 Checking IP address values
- 11.2.4 Intermezzo: Matching compatible C and Fortran data types
- 11.2.5 Creating a socket and listening for connections
- 11.2.6 Accepting incoming connections to a socket
- 11.2.7 Sending a TCP message to the client
- 11.2.8 Closing a connection
- 11.3 TCP client program: Connecting to a remote server
- 11.4 Some interesting mixed Fortran-C projects
- 11.5 Answer key
- 11.6 New Fortran elements, at a glance
- 11.7 Further reading
- Summary
- 12 Advanced parallelism with teams, events, and collectives
- appendix A. Setting up the Fortran development environment
- appendix B. From calculus to code
- appendix C. Concluding remarks
- index
Product information
- Title: Modern Fortran
- Author(s):
- Release date: November 2020
- Publisher(s): Manning Publications
- ISBN: 9781617295287
You might also like
video
Exploring Modern Fortran Basics
Reveal the amazing possibilities of modern Fortran, the natively parallel and dominant language of high-performance computing.
book
Discovering Modern C++, 2nd Edition
Write Powerful, Modern C++ Code for Scientific, Engineering, and Embedded Applications Discovering Modern C++, Second Edition, …
book
The C++ Programming Language, 4th Edition
The new C++11 standard allows programmers to express ideas more clearly, simply, and directly, and to …
book
Learning Perl, 8th Edition
If you're just getting started with Perl, this is the book you want—whether you're a programmer, …