This page is for linking to available Fortran libraries and source code repositories. See Software repositories for collections of libraries and see Library distribution for methods for packaging and distributing Fortran libraries. Modern Fortran Libraries and Awesome Fortran are other lists of libraries.
Libraries linked here are classified as follows:
When available, the above tags should link to the license page for a particular library.
Fortran Standard Library - Utilities (containers, strings, files, OS/environment integration, unit testing & assertions, logging, …) Algorithms (searching and sorting, merging, …) Mathematics (linear algebra, sparse matrices, special functions, fast Fourier transform, random numbers, statistics, ordinary differential equations, numerical integration, optimization, …)(OS: MIT)
BeFoR64 - Base64 encoding/decoding library for FoRtran poor men, is a pure Fortran (KISS) library for base64 encoding/decoding for modern (2003+) Fortran projects. (OS: GPL)
coretran - easy-to-follow library to make Fortran easier in general with wrapped interfaces, sorting routines, kD-Trees, and other algorithms to handle scientific data and concepts.
erloff - make error-handling in Fortran a bit more flexible (OS: MIT)
fdict - native Fortran 90 dictionary with hash tables for retaining any data-type in a Python-like dictionary. (OS: MPL-2)
ferror - library to assist with error handling in Fortran projects.
ffhash generic and fast hash table similar to khash in C, by Jannis Teunissen.
FGSL - Fortran interface to the GNU Scientific Library. (OS: GPL)
FIAT - Fortran Implementation of Abstract Types
flib - standard library, function library, a tridiagonal matrix solver, and code for a doubly linked list, optimization, and interpolation. (OS: GPL-3.0 License)
FLIBS - collection of Fortran modules by Arjen Markus and Michael Baudin. (OS: BSD)
flink - Flexible Fortran Modules and Subroutines for Scientific Computing. (OS: GPL-3.0 License)
Focal - modern Fortran module library which wraps calls to the OpenCL runtime API with a higher abstraction level appropriate to the Fortran language. (OS: MIT)
forpy - use Python in Fortran and vice versa. (OS:LGPL)
FortranCL - Fortran interface for OpenCL, allows to execute code on GPUs and accelerators directly from Fortran. (OS: LGPL)
FortCUDA - Fortran interface to the CUDA GPU library. Contains a Python pre-processor to parse the CUDA C headers and creates ISO_C_BINDING interfaces for the method calls. Comes with a fairly complex example. (OS: GPL)
Fortran exceptions library - provides exception handling for Fortran 2003 and later, based on the methodology of Poppe et al. 2012 (OS: MIT)
fortranlib - Collection of personal scientific routines in Fortran. (OS: BSD-2-Clause License)
Fortran-Library - Code for geometry transformations, nonlinear optimization, Fourier transforms, clustering, statistics, mathematics, linear algebra, strings, and chemistry. (OS: GPL-3.0 License)
fortran_notes - containers and advanced data structures, hash functions, and design patterns (OS: MIT)
Fortran Template Library (FTL) - generic containers, versatile algorithms, easy string manipulation, and more. (OS: GPL-3)
Fortran Template Library (FTL) - Object oriented implementation of generic containers similar to the C++ STL (Standard Template Library) in native Fortran 2003. (OS: LGPL-3)
fortran-utils - Various utilities for Fortran programs, including types, constants, sorting, saving/loading 2D arrays, meshes, cubic splines, saving/loading PPM images, Lapack interface, HDF5 interface, special functions, and optimization, by Ondrej Certik et al.
ForUtils - Fortran 2008 utility functions and reusable classes
FTObjectLibrary - provides a collection of reference counted Fortran 2003 classes to facilitate writing generic object oriented Fortran programs (OS: MIT)
functional-fortran - library for functional programming in modern Fortran. (OS: BSD)
fycollections - generic collection templates for Fortran
IMSL - most comprehensive mathematics and statistics library available. (C)
JAMS - collection of general Fortran modules offering miscellaneous functions in the categories Computational, Date and Time, Input / Output, Math / Numerics, Screening, Sensitivity Analysis and Optimising / Fitting, and Miscellaneous. Written by Matthias Cuntz, Juliane Mai and Stephan Thober. (OS: MIT)
jsonff - Fortran library for dealing with JSON data (OS: MIT)
json-fortran - Fortran 2003/2008 JSON API. (OS: BSD)
kdtree2 - kd-tree implementation in C++ (and Fortran) by Matthew B. Kennel
libGPF - General Purpose Fortran Collection. Updated at GitHub.(OS: MIT)
NAG - world’s largest collection of robust, documented, tested and maintained numerical algorithms for users of the Fortran programming language. (C)
NEC Numeric Library Collection - collection of mathematical libraries that powerfully supports the development of numerical simulation programs in a wide range of fields. The libraries are available on Vector Engine. (C)
NPY-for-Fortran allows the developer to save Fortran arrays in Numpy’s .npy format. (OS:MIT)
parff - (almost) functional style parser combinator library for Fortran (OS: MIT)
PENF - Fortran (standard 2003) module useful to achieve portable codes. The module makes available portable kind-parameters and some useful procedures to deal with them. (OS: GPL)
petaca - collection of modern Fortran modules that provide broadly useful capabilities – things that the author has found himself using repeatedly across many projects. A unifying feature of the modules is their object-oriented interfaces and implementation. (OS:MIT)
qContainers - container library for Fortran language. It enables to store any internal Fortran data type and any derived data type to the container. It implements containers for key/value pairs: tree table and hash table, and containers for objects: list and vector. (OS: BSD)
Processor - F95 compliant general purpose library version 1.8.6 with HTML documentation. Covers string/array manipulations, stacks, hashes, noise, interpolation, smoothing, physical constants, and dates. Includes wrapper modules for several OS/compiler combinations for specific system access functions.(OS: LGPL)
S-EXPTRAN - Fortran library for reading and writing S-expressions. (OS: MIT)
VectorClass Fortran 2003 dynamic memory array that functions similarly (but not identically) to the C++ Vector class, by Tyler Chang. (OS: MIT)
Fortran Character String Utilities - library of string manipulation routines by George Benthien
fortran_pcre - Fortran wrapper around the C PCRE regular expression library. (OS:MIT)
regex-fortran is a Fortran-based basic RegEx package
M_matchis a Fortran-based basic RegEx package
fortran-unix contains a RE interface
M_regex builds on the Wiki example to call Posix RE procedures
GTKcontains a RE interface
regexp provides a RE interface
iso_varying_string - implementation of the ISO standard for varying strings (OS: MIT)
M_strings - modules for processing strings. Routines for parsing, tokenizing, changing case, substituting new strings for substrings, locating strings with simple wildcard expressions, removing tabs and line terminators and other string manipulations are included. (OS)
strff - library of convenient string functions (OS: MIT)
fortran-regex is a full regex module implemented in modern Fortran, with no external dependencies. (OS: MIT)
afnl - Fortran 90 numerical library with modules for numerical types, constants, error handling, integration, optimization, linear algebra, sorting and search, special functions, statistics, polynomials, root-finding, Fourier transforms, and dates and times, by Alberto Ramos (OS: GPL-2.0 License)
ARPREC - C++/Fortran 90 library for arbitrary precision math. Includes a complete interactive high-precision arithmetic computing interpreter (“toolkit”) written in Fortran, that will integrate symbolic expressions etc. (OS: BSD)
CERNLIB - collection of FORTRAN 77 libraries and modules maintained by CERN. (OS: GPL)
datapac - Fortran 77 statistical library written by James Filliben (at NIST) (PD)
DATAPLOT - powerful and flexible program for performing scientific, engineering, statistical, mathematical, and graphical analysis. At GitHub
Emmix Fits a mixture model of multivariate normal or t-distributions to a user supplied data set via the EM algorithm. With gfortran, must be compiled with -std=legacy option.
faiNumber-Fortran - A fast, flexible, and secure numerical library for Fortran with fast number parsing as one of its features. (OS: MIT)
FMLIB - David M. Smith’s libraries for multiple precision computation. The package performs multiple-precision real, complex, and integer arithmetic, providing the intrinsic Fortran numerical functions, as well as many special functions. An existing Fortran program can be checked by converting it from double precision to FM arithmetic. (NC)
forSISL - Modern Fortran interfaces to the SINTEF Spline Library (SISL)
FURY - Fortran Units (environment) for Reliable phYsical math, by Stefano Zaghi
GMP Fortran library - Fortran binding for GNU Multiple Precision Arithmetic library.
HSL Mathematical Software Library - free for academic use.
lookup_table_fortran A module for linear lookup tables. Supports multiple columns and various ways to read values from the table.
MP - Fortran multiple-precision arithmetic package by Richard Brent.
MPFUN2020 - thread-safe arbitrary precision package by David H. Bailey
MPFUN90 (broken link) - a pure Fortran 90 library for arbitrary precision math. Includes a complete interactive high-precision arithmetic computing interpreter (“toolkit”) written in Fortran, that will integrate symbolic expressions etc. (OS: BSD)
Muesli - A free numerical and graphical Fortran 95 library written by Edouard Canot at Univ of Rennes (?)
National Wind Technology Center Subroutine Library - A library of general-use Fortran 2003 routines used in many NWTC computer-aided engineering tools (OS: GPL)
NumDiff - A modern Fortran numerical differentiation library by Jacob Williams (OS: BSD).
NumericalHUB - Set of modern Fortran numerical libraries covering: zeroes of Systems of Equations, Lagrange Interpolation, Finite Differences, Cauchy Problems, Boundary Value Problems, and Initial Boundary Value Problems, associated with book How to learn Applied Mathematics through modern FORTRAN
Numerical methods in Fortran - solving linear, nonlinear equations, integral, ordinary differential equations, … using numerical methods in Fortran, by Carlos Planelles Alemany
Numerical methods in Fortran - numerical analysis and statistics algorithms, by Murat Koptur.
Numerical Methods for Scientists and Engineers, code in Fortran 77 and C from book by H. M. Antia (OS: GPL-2.0 License)
Numerical Methods of Statistics, Fortran 95 code from book by John Monahan.
SLATEC - Common Mathematical Library: a comprehensive software library containing over 1400 general purpose mathematical and statistical routines written in Fortran 77. (PD)
SLATEC - Fortran 90 version by John Burkardt. (?)
SLICOT - The Control and Systems Library (GPL)
starpac, Standards Time Series and Regressions Package in Fortran 77(PD), translated to Fortran 90 here.
stspac, A Fortran 77 statistical library written by Charlie Reeves (at NIST) (PD)
TOMS - code from the journal Transactions on Mathematical Software. Many programs were translated to Fortran 90 by Alan Miller and John Burkardt
physunits - Automated Computation and Consistency Checking of Physical Dimensions and Units in Scientific Programs, by Grant Petty
quaff - A library for making math with units a lot easier and more convenient (OS: MIT)
SciFortran - A library of fortran modules and routines for scientific calculations (in a way just like scipy for python). (OS: LGPL-3.0 License)
Simfit - package for simulation, statistical analysis, curve fitting and graph plotting, using models from a compiled library or from ASCII text files supplied by the user. Source code for over two hundred NAG library subroutines called by the Academic version of the Simfit package is available.
Tensor Toolbox for Modern Fortran (ttb)(OS: MIT License)
Freely Available Software for Linear Algebra (September 2018)
arpack-ng is a collection of Fortran77 subroutines designed to solve large scale eigenvalue problems.
BLAP95 (broken link) - a Fortran 95 interface to the Level 3 BLAS routines and key LAPACK computational and driver routines. (?)
BLAS: Basic Linear Algebra Subprograms that provide standard building blocks for performing basic vector and matrix operations (PD). Also OpenBLAS
DBCSR - Distributed Block Compressed Sparse Row matrix library (OS: GPL-2.0 License)
ELPA - Eigenvalue Solvers for Petaflop Applications (OS: LGPL-3.0)
LAPACK is the standard package for numerical linear algebra. (OS: BSD)
LIBXSMM - library for specialized dense and sparse matrix operations as well as for deep learning primitives such as small convolutions.
linalg - linear algebra library that provides a user-friendly interface to several BLAS and LAPACK routines. (OS:GPL-3.0 License)
Fortran_Davidson - Modern Fortran implementation of the Davidson diagonalization algorithms. (OS:Apache-2.0 License)
fortran_lsp - Fortran routines from “Solving Least Squares Problems” by C. Lawson and R. Hanson, with improved interfaces.
JADAMILU - computes eigenvectors of large sparse symmetric matrices. Provided as a precompiled library
MUMPS - parallel sparse direct solver
NTPoly - massively parallel library for computing the functions of sparse matrices.(OS: MIT License)
PROPACK - set of functions for computing the singular value decomposition of large and sparse or structured matrices. GitHub
PSBLAS3 - Parallel Sparse Basic Linear Algebra Subroutines (OS: BSD)
qrupdate - library for fast updates of QR and Cholesky decompositions.
qr_mumps - package for the solution of sparse, linear systems on multicore computers
Sparskit - basic tool-kit for sparse matrix computations (Version 2)
UMFPACK Fortran interface - mUMFPACK module provides a Fortran-2003 implementation of the full UMFPACK interface closely corresponding to that defined in the UMFPACK User Guide.
Alan Miller’s Fortran Software for subset selection in regression, random number generation, logistic regression, linear least squares, and other topics.
apstat, a collection of subroutines (AS1 - AS319) published in the journal Applied Statistics 1968-1994. Most are Fortran. Personal favourites include AS319 and AS164. Many have been translated to Fortran 90 by John Burkardt and Alan Miller
BMSL mathematical and statistical libraries, geared toward environmental / hydrological applications, by Ben Renard.
Climate time series analysis by Manfred Mudelsee.
CONFINT - sample size calculation for confidence intervals
datapac, A Fortran 77 statistical library written by James Filliben (at NIST) (PD)
Fast Statistical Methods, by Rybicki and Press.
Fortran Programs for Global Optimization, etc programs for econometric analysis such as Non-linear Least Squares, Robust Regression, Robust Two-Stage Least Squares, Ordinal Canonical Correlation, Ordinal Principal Component Analysis, Hybridization of canonical correlation and principal component analysis, fitting origin-displaced logarithmic spiral to data, solving the nearest correlation matrix problem, completing the correlation matrix, construction of composite indices by linear aggregation, etc. some of which are based on global optimization.
Least squares approximations in Fortran 90 by J-P Moreau. Also statistical programs in Fortran
MCMC f90 library - do Markov chain Monte Carlo simulation from a posterior distribution of unknown model parameters defined by a likelihood function and prior
MISCLIB, a library of statistical and support routines, written by Barry Brown (M.D.Anderson Cancer Institute) - open source
Modified Burg Algorithms in Multivariate Subset Autoregressive Modeling by A. Alexandre Trindade
MultiNest - Bayesian inference tool which calculates the evidence and explores the parameter space which may contain multiple posterior modes and pronounced (curving) degeneracies in moderately high dimensions, by Farhan Feroz and Mike Hobson
Multiple stream Mersenne Twister pseudorandom number generator (OS: BSD)
Multitaper Spectrum Estimation Library by Germán A. Prieto.
Multivariate Data Analysis Software in Fortran (and C) by Fionn Murtagh
Nonsmooth Clustering by Napsu Karmitsa. Also codes for regression and imputation
Oak Leaf - robust statistical estimates by Filip Hroch
ParaMonte - Plain Powerful Parallel Monte Carlo and MCMC Library for Python, MATLAB, Fortran, C++, C (OS: MIT License)
Random by Richard Brent. ranut is a uniform pseudo-random number generator which uses recurrences based on primitive trinomials, or in some cases trinomials which have large primitive factors (over the field GF(2)). rannw is a Fortran 77 pseudo-random number generator which uses a variant of Chris Wallace’s method to generate normally distributed (i.e. Gaussian) numbers.
RANDLIB - routines for nonuniform random number generation
rng_fortran, Fast pseudorandom number generator based on Xoroshiro128+. Supports OpenMP.
SLICE, efficient N-Dimensional Monte Carlo inversion algorithm.
STATPACK - Fortran 95/2003 library for solving the most commonly occurring mathematical and statistical problems in the processing of (huge) climate model outputs and datasets, and more generally in data analysis
stspac, A Fortran 77 statistical library written by Charlie Reeves (at NIST) (PD)
SEQBIN - Bayesian/Frequentist Designs for Sequential/Group-Sequential Trials of a Single Binomial Parameter
STPLAN - performs power, sample size, and related calculations needed to plan frequentist studies
TIMSAC package for analysis, prediction and control of time series
Applied Statistics algorithm 298 Hybrid minimization routine using simulated annealing and a user-supplied local minimizer.
Applied Statistics algorithm 319 Variable metric unconstrained function minimization without derivatives.
cobyla.f90 Mike Powell’s routine for minimization of non-linear functions with smooth non-linear constraints, using local linear approximations to the constraints.
conmin.zip The classic CONMIN package for constrained minimization updated to Fortran 90.
CUTEst - Constrained and Unconstrained Testing Environment with safe threads for optimization software
DualSimplex Fortran 90 module for solving linear programs of the form max c^T x s.t. A x <= b where, c is a cost vector and A x <= b is a system of linear inequality constraints, by Tyler Chang.
FilterSD - Fortran 77 subroutines for solving nonlinear programming problems and linearly constrained problems in continuous optimization
GALAHAD is a library of modern Fortran modules for nonlinear optimization. (OS: lgpl-3.0)
global.f90 At Arnold Neumaier’s site, this is recommended as the most successful of the global optimization packages.
libga - genetic algorithm optimisation library by Alberto Ramos
lm.zip Levenberg-Marquardt algorithm for non-linear least squares (unconstrained). This is a translation of the MINPACK routines, LMDER & LMDIF.
minim.f90 The Nelder-Mead simplex algorithm for unconstrained minimization. It does NOT require or use derivatives.
MINPACK contains routines for solving nonlinear equations and nonlinear least squares problems. (OS: BSD)
minuit - Fortran 77 library for function minimization and error Analysis by F. James (OS: GPL-2.0)
NLopt - NLopt is a free/open-source library for nonlinear optimization, providing a common interface for a number of different free optimization routines available online as well as original implementations of various other algorithms. By Steven G. Johnson (OS: GNU LGPL)
NonSmooth Optimization (NSO) Software by Napsu Karmitsa and coworkers
Optimization codes by Andrei Neculai THREECG: A simple three-term conjugate gradient algorithm which satisfies both the descent and the conjugacy conditions. DESCON: Conjugate Gradient Algorithm with guaranteed descent and conjugacy conditions for large-scale Unconstrained Optimization. ASCALCG: Accelerated Scaled Conjugate Gradient Algorithms for Unconstrained Optimization. AHYBRIDM: Accelerated Hybrid Conjugate Gradient Algorithm with Modified Secant Condition for Unconstrained Optimization. CONMIN: Shanno Conjugate Gradient with Beale restart memoryless variable metric algorithm for Unconstrained Optimization. ASA: Anticipative Scalar Approximation of Hessian for Unconstrained Optimization. RELAXED: Relaxed Gradient Descent Method with Backtracking for Unconstrained Optimization. UNO Fortran subroutines library for unconstrained optimization using searching methods.SPENBAR Sparse PENalty BARrier package for solving general nonlinear programming problems with equality and inequality constraints and simple bounds on variables. All the constrained are penalized. Minimization of the penalty function is given by TN package of S. Nash. FIBO Fibonacci method for function minimization. MAXFUN Powell direct search method for function maximization. ZERO Simple algorithms for computing zeros of a nonlinear function of a variable in a given interval.
PCx - interior-point predictor-corrector linear programming package
pikaia - Modern Fortran Edition of the Pikaia Genetic Algorithm by Jacob Williams
Software by M. J. D. Powell and Powell’s Derivative-Free Optimization solvers (PDFO) by Zaikun Zhang
PowellOpt is a collection of derivative-free optimization algorithms by M.J.D. Powell.
qnstop suite of serial and parallel Fortran 95/2003 codes for deterministic global optimization and stochastic optimization by Layne Watson.
RALFit - non-linear least squares solver that is primarily developed by the Numerical Analysis group at STFC Rutherford Appleton Laboratory.
Roots of a real function in Fortran 90 by J-P Moreau
simulated-annealing - Simulated Annealing with Modern Fortran by Jacob Williams
tapenade - tool for automatic differentiation (forward/reverse) of Fortran and C programs
TENSOLVE contains both TOMS 739 (UNCMIN) for unconstrained minimization, and TOMS 768 (TENSOLVE) for the solution of sets of non-linear equations.
TOMS algorithm 778 solves bound-constrained optimization problems by using the compact formula of the limited memory BFGS updates.
TOMS algorithm 813 is for local minimization, with or without convex constraints. It requires the user to supply first derivatives. This version is in standard Fortran. It uses the so-called spectral projected gradient (SPG) method.
tn.zip Stephen Nash’s truncated-Newton code for the minimization of continuous functions. It can use differences instead of derivatives, and bounds may be imposed on the parameters.
tron.zip Newton’s method for large bound-constrained optimization problems by Chih-Jen Lin & Jorge More’, a MINPACK-2 project.
uobyqa.f90 Mike Powell’s package for unconstrained minimization when derivatives are not available.
VTDIRECT95: Fortran 95 implementation of D. R. Jones’ deterministic global optimization algorithm called DIRECT, which is widely used in many multidisciplinary design optimization problems
autofit is a Fortran code for fitting permutationally invariant polynomials (PIPs). (OS: Apache-2.0 License)
FortLearner - linear regression, logistic regression, stochastic gradient descent, decision trees, ensemble trees, boosting trees, and dimension reduction.
gpf - small Fortran library for Gaussian process regression. It currently implements value predictions with dense Gaussian processes, and projected-process approximate Gaussian processes. (OS: Apache-2.0 License)
neural-fortran is a parallel neural net microframework. (OS: MIT)
NN_MOD - Fortran 2008 Module/Class for training neural network regressors
accis - Fortran plotting and graphics library
cairo-fortran: Fortran bindings for libcairo. (GPL v3)
DISLIN - high-level scientific data plotting library. (NC)
EGGX/ProCALL - X11 graphics library for C and FORTRAN created to achieve extreme simplicity. Uses only (OS: GPL)
gtk-fortran - cross-platform library to build Graphical User Interfaces (GUI). It is a GTK / Fortran 2003 binding based on the ISO_C_BINDING module. (OS: GPL)
GNUFOR2 - Fortran 90 interface to Gnuplot which helps to plot graphs, surfaces, histograms and images. (?)
GnuplotFortran - Fortran Interface to Gnuplot. (OS: LGPL)
F03GL - Fortran 2003 bindings for OpenGL, GLU and GLUT (?)
F90GL - Fortran 90 bindings for OpenGL and the GL Utility Toolkit (GLUT) (PD)
ForColormap - A colormap fpm library independent of any graphical toolkit.
fortran-sdl2 - Fortran interface to Simple DirectMedia Layer 2.0 (SDL 2.0). It uses the ISO_C_BINDING module. (OS: ISC)
fortran-xlib - interface to (a subset) of Xlib. (OS: ISC)
g2 - easy to use, portable and powerful 2D graphics library. Currently supported devices: PostScript, X11, PNG and JPEG (using gd) and Win32 (xfig in development). g2 is written in C (ANSI) and has a Fortran interface. (OS: LGPL)
g95gl - alternate Fortran 95 (interop) bindings for OpenGL and the GL Utility Toolkit (GLUT)
giza - scientific plotting library for C/Fortran, meant as a replacement for pgplot, by Daniel Price
Graph2D - cross-platform scientific plotting library, backward compatible with the Tektronix “Plot 10” and “Advanced Graphing II” API. Usable in interactive and/or batch mode. (OS: LGPL V3.0)
grapheps - port of a very compact Postscript library
GrWin - Windows graphics library for FORTRAN and C.
libvogle - basic vector-based graphics library in C, but Fortran-callable
Lib_VTK_IO - pure Fortran library to write and read data conforming the VTK standard. This library is not a porting or a wrapper of the VTK code, but it is only an exporter/importer of VTK data format written in pure Fortran language (standard Fortran 2003). (OS: GPL)
MathGL - library for making high-quality scientific graphics under Linux and Windows via Qt, FLTK or OpenGL. (OS: GPL)
ogpf - object-based Fortran 2003/2008 code for 2D, 3D plotting and animation, implements an interface to gnuplot. On GitHub: ogpf (PD)
plotterf90 - graphics subroutine library producing Postscript written by Masao Kodama. (?)
pltFor - Fortran-Python interface library to plot figures directly in Fortran, by DamienMinenna
Pyplot-Fortran - simple module for generating plots from Fortran using Python’s matplotlib.pyplot.
text_viz - Text-mode 2D-Graphics for Fortran. (?)
Fortran and Matlab Codes for differential equations - from Ernst Hairer
FOODIE - Fortran Object-Oriented Differential-equations Integration Environment.
ODEPACK is a systematized collection of ODE solvers. (PD)
PETSc The Portable, Extensible Toolkit for Scientific Computation (PETSc, pronounced PET-see; the S is silent), is a suite of data structures and routines developed by Argonne National Laboratory for the scalable (parallel) solution of scientific applications modeled by partial differential equations.
PoisFFT - Free parallel fast Poisson solver.
numerical-anal boundary value problems and heat transfer.
Differential equations in Fortran by J-P Moreau
dop853 - Modern Fortran Edition of Hairer’s DOP853 ODE Solver, by Jacob Williams
ddeabm - Modern Fortran implementation of the DDEABM Adams-Bashforth algorithm, by Jacob Williams
INTEGRAL - routines for the integration of functions of various types and for integration of systems of ordinary differential equations (ODEs)
Quadrule - sets up a variety of quadrature rules, used to approximate the integral of a function over various domains in 1D, by John Burkardt. He has many other quadrature codes linked there
quadrature-fortran - Adaptive Gaussian Quadrature with Modern Fortran, by Jacob Williams
stroud - routines from the book Gaussian quadrature formulas by Stroud & Secrest (1966), translated to modern Fortran by Ivan Pribec
Fortran-parallel-sort Fortran library to perform parallel sorts using OpenMP, by Corentin Cadiou (OS: CC0-1.0 License)
hs-sort sorting routines in Fortran 77 by Houlsby & Sloan, with a modern Fortran wrappers by Ivan Pribec
ORDERPACK - library with routines for unconditional, unique, and partial ranking, sorting, and permutation. (?)
DelaunaySparse serial and parallel codes, written in FORTRAN 2003 with OpenMP 4.5, for performing interpolation in medium to high dimensions via a sparse subset of the Delaunay triangulation.
bspline-fortran - multidimensional B-spline interpolation of data on a regular grid, by Jacob Williams.
finterp - multidimensional linear interpolation with modern Fortran, by Jacob Williams.
WenOOF - WENO interpolation Object Oriented Fortran library
NIST Digital Library of Mathematical Functions has a software index for special functions
Special functions in Fortran 90 and Bessel programs in Fortran 90 by J-P Moreau
Special_Functions translated code from book “Computation of Special Functions” by Shanjie Zhang and Jian-Ming Jin to Fortran 90 by John Burkardt. Links to other codes for special functions are provided.
FFTPack provide an easily usable package of functions using FFTPack library (Fortran 77).
fftpack51 computes the Fast Fourier Transform, using double precision arithmetic, translated to Fortran 90 by John Burkardt
fortran-csv-module - read and write CSV Files using Modern Fortran.
csvio-f90, the CSVIO F90 module, is a Fortran 90 module for easily reading and writing CSV files. (OS: BSD)
WKML is based on FoX, and writes KML (Keyhole Markup Language). (OS: BSD)
xml (?)
xml-fortran (OS: BSD)
fortranposix - An implementation of some POSIX functions in Fortran 90/95. (OS: LGPL)
fortyxima/filesys - Modern Fortran wrappers around the file system interface of libc as part of the Fortyxima library: rename and remove files, recursively create and remove directories, obtain filenames in a directory, check whether a given file exists and if a directory or a symbolic link, obtain the current working directory and change to a directory, create hard links and symbolic links, resolve the target of symbolic links, canonize path names. Fortyxima/filesys replaces the old modfilesys library. (OS: BSD)
Posix90 - The Fortran 90 Posix interface project. (OS: GPLv2+)
Discussion of Fortran and Lua in Programming in Modern Fortran tutorial
IREP - tool for filling C/C++ or Fortran data structures from Lua input tables
fortran-lua53 - collection of ISO C binding interfaces to Lua 5.3 for Fortran 2003 and to call Lua from Fortran and vice versa, by interkosmos and zoziha
Aotus: Advanced Options and Tables in Universal Scripting - Fortran wrapper around the C-API of Lua, for usage as configuration
FortLua - simple set of Lua bindings for use in Fortran, tested to be compatible with Lua 5.2.3+, by Drew Dolgert
cafut A single-file object-oriented unit testing utility for Coarray Fortran.
Fortran Unit Test Framework (FRUIT)
Fortuno User friendly, flexible and extensible object-oriented Fortran unit testing framework for testing serial, MPI-parallelized and coarray-parallelized applications.
Fytest Note Fytest is deprecated, you should consider to use the Fortuno unit testing framework instead.
test-drive A simple and lightweight testing framework developed by the Fortran-lang community, entirely written in modern Fortran.
M_framework - is an aggregate of Fortran modules useful for creating terminal messages, comparing expected values to results, writing logfiles and playback journals and performing unit tests for Fortran.
toast - Testing Or ASsertion Toolkit - Fortran unit testing library
FortUTF - Unit Test framework written purely in Fortran to be compatible with as many projects as possible
XFunit - Native Fortran 2003 Unit Testing Framework
CMake and CTest - Minimalistic cmake/ctest environment for fortran unit tests, with cmake dependency management and CI examples.
The Fortran 2023 standard is sold at the ISO web site for CHF 216. The standards committee uses its Interpretation Document as a reference. The main new features are resumed in its introduction, pages xiii-xiv.
John Reid wrote The new features of Fortran 2023 and co-authored Modern Fortran Explained: Incorporating Fortran 2023, 6th ed.(2023), Oxford University Press
Jacob Williams listed some of the new features and his opinions of them in a post The New Features of Fortran 202x
Alam, Shahid (2014). Is Fortran Still Relevant? Comparing Fortran with Java and C++ International Journal of Software Engineering & Applications (IJSEA), Vol.5, No.3, May 2014.
Chin, L. S., D. J. Worth and C. Greenough (2006). Thoughts on using the Features of Fortran 95. Software Engineering Group Notes no. SEG-N-003.
Cohen, M. (1999). Object orientation and Fortran 2002: part II. ACM SIGPLAN Fortran Forum 18, 14–21.
Decyk, V. K., C. D. Norton, and B. K. Szymanski. (1997). Expressing Object-Oriented Concepts in Fortran 90. ACM SIGPLAN Fortran Forum 16, 13–18.
Diaz, Javier, Marco Pinna, Andrei V. Zvelindovsky, and Ignacio Pagonabarraga (2021). Parallel Hybrid Simulations of Block Copolymer Nanocomposites using Coarray Fortran. Macromolecular Theory and Simulations.
Erwig, Martin, et al. Parametric Fortran (3 papers)
Gray, M. G. and R. M. Roberts (1997). Object-based programming in Fortran 90. Computers in Physics 11, 355–361.
Haveraaen, M., et al. (2015) High-Performance Design Patterns for Modern Fortran Scientific Programming
Johnson, Seth R., Andrey Prokopenko, and Katherine J. Evans (2020). Automated Fortran–C++ Bindings for Large-Scale Scientific Applications Computing in Science & Engineering Sept.-Oct. 2020, pp. 84-94, vol. 22.
Kedward, L. et al. (2022) The State of Fortran Computing in Science & Engineering, doi: 10.1109/MCSE.2022.3159862.
Magnin, V., Alves, J., Arnoud, A., Markus, A., and Esposito Marzino, M., “Fortran… et puis quoi encore ?”, Bulletin 1024, no. 22, pp.143–161, November 2023, DOI:10.48556/SIF.1024.22.143, licence CC BY-NC-ND 4.0, also available in English: “Fortran… ok, and what’s next?” (hal-04448657 and arXiv:2402.07520).
Markus, A. (2001). Generic programming in Fortran 90. ACM SIGPLAN Fortran Forum 20(3), 20-23.
Markus, A. (2006). Design patterns and Fortran 90/95. ACM SIGPLAN Fortran Forum, 25(1), 13-29.
McCalpin, J. D. (1996). A Case Study of Some Issues in the Optimization of Fortran 90 Array Notation Scientific Programming.
McCormack, D. (2005). Generic programming in Fortran with Forpedo. ACM SIGPLAN Fortran Forum 24(2), 18-29.
McGavin, P. and R. Young (2001). A generic list implementation. ACM SIGPLAN Fortran Forum 20(1), 16-20.
Morris, K. (2015) Emulating Multiple Inheritance in Fortran 2003/2008 Scientific Programming.
Nanthaamornphong, A., and A. Leatongkam (2019) Extended ForUML for Automatic Generation of UML Sequence Diagrams from Object-Oriented Fortran Scientific Programming.
Ott, Jordan, et al. (2020). A Fortran-Keras Deep Learning Bridge for Scientific Computing Scientific Programming.
Padua, D. (2000). The Fortran I Compiler Computing in Science $ Engineering.
Poppe, K., R. Cools, and B. Vandewoestyne (2012). Error handling in Fortran 2003. Fortran Forum 31(2), 7-19. Updated article here
Pietzer, A., et al. (2008). Exposing Fortran Derived Types to C and Other Languages IEEE Explore.
Reid, J. (2003). The future of Fortran. Computing in Science & Engineering 5, 59–67.
Schonfelder, J.L. (2003) Variable Precision Arithmetic: A Fortran 95 Module Scientific Programming.
Singleterry, Robert C. (2018) Single Thread to Fortran Coarray Transition Process for the Control Algorithm in the Space Radiation Code HZETRN NASA-TP-2018-219811.
Sharma, A., and I. Moulitsas (2017) MPI to Coarray Fortran: Experiences with a CFD Solver for Unstructured Meshes Scientific Programming.
Shterenlikht, A. and L. Cebamanos (2018). Cellular automata beyond 100k cores: MPI vs Fortran coarrays Proceedings of the 25th European MPI Users’ Group Meeting.
Vanderbauwhede, Wim (2022). Making legacy Fortran code type safe through automated program transformation. The Journal of Supercomputing volume 78, pages 2988–3028.
Worth, D. J. (2008). State of the art in object oriented programming with fortran. Technical Report RAL-TR-2008-002.
Yue, S., and J. Gray (2014). SPOT: A DSL for Extending Fortran Programs with Metaprogramming Scientific Programming.
Dauptain, Antoine (2021). Screening the coding style of Large Fortran HPC Codes
Ehlert, Sebastian (2022). Using objects across language boundaries: Exploring the limits of language interoperability and consistent API design
Stulajter, Miko M., Ronald M. Caplan, and Jon A. Linker (2021). Can Fortran’s ‘do concurrent’ replace directives for accelerated computing?
Discovering and Enjoying Fortran(2023) by Simon Rowe
Why You Should Consider Using Fortran As A Data Scientist: An exploration of the benefits that Fortran can bring to Data Science and Machine Learning(2023) by Egor Howell
Why Fortran is a scientific powerhouse(2023), The Myths of Fortran(2022), and Why Fortran is Easy to Learn(2022) by Michael Wirth
Is Fortran “a dead language”? Some C++ folk seem to think so…(2022) by Jim Cownie
I enjoyed modern Fortran(2022) by Radek Gruchalski
Fast, Cheap, and Turbulent—Global Ocean Modeling With GPU Acceleration in Python(2021) by Dion Häfner, Roman Nuterman, and Markus Jochum. Discussed here
Computer Language Benchmarks Game - Which programming language is fastest?
On the Performance of GPU accelerated q-LSKUM based meshfree solvers in Fortran, C++, Python, and Julia(2021) by Nischay Ram Mamidi et al.
raytracer(2021) - raytracer benchmark in dozens of languages, by edin
Assessment of Programming Languages for Computational Numerical Dynamics(2021) by Arturo Burgos. Compares Fortran, Julia, Matlab, and Python
What Julia can and can’t replace about Fortran(2021), by Joshua Laughner
Testing Julia: Fast as Fortran, Beautiful as Python(2021) by Martin D. Maas. Code here. Also Why is Fortran still used?, Will Julia replace Fortran for high-performance computing?
What is the superiority of Fortran over alternative languages like Chapel or Julia?(2021) - discussion at Fortran Discourse
NetworkDynamics.jl – Composing and simulating complex networks in Julia(2021) by Michael Lindner et al. Discussed here. Network Dynamics Benchmarks comparing Fortran, Julia and Python here
This old programming language is suddenly getting more popular again(2021) by Liam Tung, ZDNet
Resurrecting Fortran(2021) by Ondrej Certik
Performance comparison R, Julia, Fortran for Bayesian binary probit(2021) by Dries Benoit
The Quest for Speed - An Indicative Survey in Improving Performance(2021) by Bryn Noel Ubald
A Comparative Study on the Efficiency of Compiled Languages and MATLAB/Simulink for Simulation of Highly Nonlinear Automotive Systems(2020) by Amir Hossein Pasdar, Shahram Azadi, and Reza Kazemi, Journal of Applied and Computational Mechanics. Discussed here
First year of Fortran-lang(2020) by Milan Curcic
Basic Comparison of Various Computing Languages: Python, Julia, Matlab, IDL, R, Java, Scala, C, Fortran(2020) by Jules Kouatchou and Alexander Medema
What does Fortran need in 2020 to survive?(2020) by zmiimz
The Linear Algebra Mapping Problem(2019) by Christos Psarras, et al
Programming languages and particle physics(2019) by Jim Pivarski
Why I chose C for backtesting: Lessons from a journey to build an intraday backtesting engine(2019) by M. Emmanuel
Is Julia the best language for quantitative finance?(2019) by M. Emmanuel
Why to Use Fortran For New Projects(2019) by John Pask and Ondřej Čertík
A Comparison of Programming Languages in Economics: An Update(2018) by S. Boragan Aruoba and Jesus Fernandez-Villaverde. original paper code at GitHub
The Need for Speed Part 2: C++ vs. Fortran vs. C(2018) by Avi. Part 1
Energy efficiency across programming languages: how do energy, time, and memory relate?(2017) by Rui Pereira et al.
Comparison of performance: Python NumPy and Numba, MATLAB, and Fortran(2017) by Charles Jekel
A Comparative Study of Programming Languages for Next-Generation Astrodynamics System(2016) by Helge Joachim Eichhorn, Frazer McLean, and Juan Luis Cano Rodríguez
Fortran is alive!(2016) from VORtech
Why physicists still use Fortran(2015) by Daniel C. Elton
Formula translation in Blitz++, NumPy and modern Fortran: A case study of the language choice tradeoffs(2014) by Sylwester Arabas, Dorota Jarecka, Anna Jaruga, and Maciej Fijałkowski, Scientific Programming 22 (2014) 201–222
Scientific computing’s future: Can any coding language top a 1950s behemoth? (2014) by Lee Phillips
Why (and Why Not) to Use Fortran Instead of C++, Matlab, Python etc.(2012) by Nick Maclaren
The Rise and Fall of High Performance Fortran(2011) by Ken Kennedy, Charles Koelbel, and Hans Zima, Communications of the ACM
Debunking the Myths About Fortran(2011) by Craig T. Dedo
C++ vs Fortran(2011) by lmf
C vs Fortran for scientific computing by Jannis Teunissen
The Joy of Fortran (2010) by Sam Urmy
Should Fortran be taught to Undergraduates? (2009) by Mike Croucher of NAG
Why Fortran? (2007) by Viktor K. Decyk, Charles D. Norton, and Henry J. Gardner, Computing in Science and Engineering
Scientific Programming in Fortran(2007) by W. Van Snyder, Scientific Programming 15 pp3–8
Fortran: A Modern Standard Programming Language For Parallel Scalable High Performance Technical Computing(2006) by David B. Loveman
Programming languages in economics: a comparison among Fortran77, C++, and Java(2005) by Vieira, Wilson da Cruz and Levi H. Santana de Lelis
The Importance Of Fortran In The 21st Century (2003) by Walt Brainerd, Journal of Modern Applied Statistical Methods.
Cloudy’s Journey from FORTRAN to C, Why and How(2000) - by G. J. Fernald, published in Astronomical Data Analysis Software and Systems IX, ASP Conference Proceedings, Vol. 216, edited by Nadine Manset, Christian Veillet, and Dennis Crabtree. Astronomical Society of the Pacific, ISBN 1-58381-047-1, 2000., p.32
On the Numerical Efficiency of C++ in Scientic Computing(1999) by Erlend Arge et al.
Fortran 90 subsets offer simplified environment for first-time users(1998) by Donald L. Shirer, Computers in Physics 12, 166; doi: 10.1063/1.168632
Using the F Programming Language in the Classroom(1997) by Bob Hancock
Portability and Power with the F Programming Language(1997) by Walt Brainerd, David Epstein, and Richard Hendrickson, Linux Journal.
Fortran 90 for Science Students(1995) by John Prentice
Should C Replace FORTRAN as the Language of Scientific Programming?(1995) by Linda Wharton
Retire Fortran?: a debate rekindled (1992) by David Cann. Communications of the ACM
Computing in Science: Fortran outlasts them all - While hardware technology proceeds apace, scientists still battle away with Fortran programming(1989) by Don Monro, New Scientist.
Has FORTRAN a Future?(1985) by Michael Metcalf, Computer Physics Communications Volume 38, Issue 2, October–November 1985, Pages 199-210
A debate: Retire FORTRAN?: Yes. New applicative languages, based on mathematical functions rather than FORTRAN‐like statements, will enhance our ability to decompose problems for concurrent processing.(1984) by James R. McGraw, Physics Today 37, 5, 66
A debate: Retire FORTRAN?: No. Supercomputers simply need supercompilers that automatically restructure programs for concurrent processing.(1984) David J. Kuck and Michael Wolfe, Physics Today 37, 5, 67
Keywords are specifically NOT reserved words as per the Fortran specifications (F03 section 2.52, F90 section 2.52, and F77 section 2.2).
The following keywords were defined in FORTRAN 77: assign, backspace, block data, call, close, common, continue, data, dimension, do, else, else if, end, endfile, endif, entry, equivalence, external, format, function, goto, if, implicit, inquire, intrinsic, open, parameter, pause, print, program, read, return, rewind, rewrite, save, stop, subroutine, then, write.
The following keywords were added in Fortran 90: allocatable, allocate, case, contains, cycle, deallocate, elsewhere, exit?, include, interface, intent, module, namelist, nullify, only, operator, optional, pointer, private, procedure, public, recursive, result, select, sequence, target, use, while, where.
The following keywords were added in Fortran 95: elemental, forall, pure.
The following features were added in Fortran 2003: abstract, associate, asynchronous, bind, class, deferred, enum, enumerator, extends, final, flush, generic, import (in interfaces), non_overridable, nopass, pass, protected, value, volatile, wait.
The following keywords were added in Fortran 2008: block, codimension, do concurrent, contiguous, critical, error stop, submodule, sync all, sync images, sync memory, lock, unlock, impure.
The following keywords were added in Fortran 2018: select rank, non_recursive, import (in block and contained procedures).
GFortran, the GNU Fortran compiler, is part of the GNU Compiler Collection (GCC) since 2005 (it was forked from G95 in January 2003), which is licensed under GPLv3+ with GCC Runtime Library Exception. In 2023, GFortran nearly implements all of the Fortran 2008 standard and partially Fortran 2018.
Since 2015 and GCC 5.1, a major version is published every year: the first stable 2022 version was therefore GFortran 12.1. Four subsequent minor versions are then published during the four next years (for example 11.2, 10.3, 9.4 and 8.5). It can be interesting to install several versions, the latest for bleeding edge features and older ones for their robustness. For example, it is not rare to see up to 10% variations in the CPU speed of your program depending on the GCC version, and the latest version is not always the fastest.
You will find here the basic information needed to install GFortran on Linux, macOS, FreeBSD and Windows systems. More details can be found at fortran-lang.
Just install with your package manager the GFortran package, named gfortran
in Debian-based distributions (Ubuntu, Mint…) or gcc-fortran
in RPM-based distributions (Fedora, Red Hat, CentOS, openSUSE…) and Arch-based (Arch Linux, Manjaro, EndeavourOS…) distributions.
If you have installed Homebrew, install its GCC package:
% brew install gcc
If you have conda, a gfortran package is available for macOS and Linux:
% conda install -c conda-forge gfortran
Just install the GCC package, for example for the latest GCC 12 release:
# pkg install gcc12
There are several ways to install GFortran on Windows. An easy way is to use the Quickstart Fortran application.
If you use MSYS2, GFortran packages are available for the latest release. For example, for the UCRT64 environment, type:
$ pacman -S mingw-w64-ucrt-x86_64-gcc-fortran
The basic usage of GFortran is
gfortran [options] file...
For example, if your project has a module and the main program, just type:
$ gfortran my_module.f90 my_main.f90
The default executable is named a.out
under Unix-like systems and a.exe
under Windows systems.
You can use both GCC options and the GFortran specific options. For example, the default name of the executable can be changed by adding the -o
GCC option:
$ gfortran my_module.f90 my_main.f90 -o my_exec
In this section, we present only a selection of useful options, as there are hundreds of them!
You can use the GCC debugging options:
-g
produces debugging information in the operating system’s native format.-p
and -pg
generate extra code to write profile information suitable for the analysis program prof (-p
) or gprof (-pg
).You can use also the Fortran specific options:
-fcheck=all
to enable all run-time test (array bounds, memory allocation, pointers…).-std
specifies the standard to which the program is expected to conform, which may be one of f95
, f2003
, f2008
, f2018
, gnu
(default), or legacy
. For example: -std=f2008
for the Fortran 2008 standard.-pedantic
issues warnings for uses of extensions to the language.-Wall
enables commonly used warning options.-Wextra
enables some warning options for usages of language features which may be problematic.GCC provides the link options -static-libgfortran
and -static-libquadmath
to force the use of the static versions.
You can use the GCC optimization options:
-O0
(default) reduces compilation time and make debugging produce the expected results.-O1
to reduce code size and execution time, without performing any optimizations that take a great deal of compilation time.-O2
to optimize even more. GCC performs nearly all supported optimizations that do not involve a space-speed tradeoff.-O3
to optimize yet more.-Ofast
enables all -O3
optimizations but also optimizations that are not valid for all standard-compliant programs.-Og
to optimize debugging experience. It should be the optimization level of choice for the standard edit-compile-debug cycle.-Os
to optimize for size. It enables all -O2
optimizations except those that often increase code size.-Oz
to optimize aggressively for size rather than speed.GCC offers also machine-specific options starting with -m
, especially:
-march=cpu-type
generates instructions for the machine type cpu-type. -march=native
enables all instruction subsets supported by the local machine. Further details in the GCC doc.-mtune=native
produces code optimized for the local machine.Parallel computation is achieved by exploiting different aspects of modern architectures: from vectorization instructions, multi-threading, message passing and offloading to GPU devices. The followings enable handling one or more of these aspects:
The first level of parallelism with vectorization can be achieved by the combination of -O3
and -march=native
which enables the compiler to exploit the local machine vector instructions (SSE, AVX, AVX2, AVX512, etc):
$ gfortran -O3 -march=native
Programmer-instructed vectorization can be achieved with OpenSIMD (part of OpenMP), for details see this OpenMP API Specification page.
Use the option -fopenmp
. You can specify the number of threads using the environment variable OMP_NUM_THREADS
, for example in a UNIX-like system type that command before running the executable:
$ export OMP_NUM_THREADS=4
You can also spawn threads dynamically at run time in two different ways:
within the directives
use omp_lib
!$omp paralel do num_threads(num_threads)
... parallel code
!$omp end parallel do
As a routine call
use omp_lib
call omp_set_num_threads(num_threads)
!$omp parallel do
... parallel code
!$omp end parallel do
OpenACC support was introduced in GCC 5. Depending on the target GPU architecture (Intel, Nvidia, AMD) different offloading backends are available, read here. For Nvidia PTX offloading, you need to install the following backend:
$ sudo apt install gcc-offload-nvptx
Now, you can compile your code with the flag -fopenacc
and test
!$acc parallel loop
do i = 1,n
... parallel code offloaded to GPU
end do
GFortran does not natively support coarrays (Fortran 2008) and the parallel programming features introduced by the 2018 standard. You need to install the OpenCoarrays software.
For example, in an Ubuntu Linux distribution type:
$ sudo apt install libcoarrays-dev libcoarrays-mpich-dev
$ git clone https://github.com/sourceryinstitute/OpenCoarrays.git
$ cd OpenCoarrays
$ ./install.sh
and accept the installation of the MPICH library (although OpenCoarrays can also work with Open MPI).
You need to define the environment variables in your terminal (you can add it in your ~/.bash_profile
):
$ source /home/my_login/OpenCoarrays/prerequisites/installations/opencoarrays/2.9.2/setup.sh
here for the 2.9.2 version.
Use the command caf
instead of gfortran
to compile your program, and cafrun -n
to run it with the number of images you want:
$ caf main.f90
$ cafrun -n 4 ./a.out
If you want to build OpenMPI locally follow these instructions.
You can also install a pre-built package (linux or WSL):
$ sudo apt-get update
$ sudo apt-get install openmpi-bin
Then include the header file in your Fortran program/modules:
include 'mpif.h' ! To be included in files calling MPI functions
call MPI_INIT(err) ! should be invoked just once at the beginning of your main program
... code ! N instances of your program with specific communication steps
call MPI_FINALIZE(err) ! should be invoked just once at the end of your main program
Compile and run the code:
$ mpif90 main.f90 -o main.exe
$ mpirun -np 4 main.exe
This is a useful link with a concise Hello world for starters.
GFortran is free software developed by volunteer users and any help is welcome.
You can report bugs in the GCC Bugzilla system: first, update your major GFortran version to its latest release, then search if the bug was already reported, then file the bug. You can also use the GFortran mailing list fortran@gcc.gnu.org if you are uncertain on how to handle Bugzilla.
Anyone interested in joining the GFortran developers team should send an email to gfortran@gcc.gnu.org or jvdelisle@gcc.gnu.org to receive an invitation to join the GFortran Mattermost workspace (now hosted by the Oregon State University Open Source Lab), which was created in December 2022 to facilitate chat, patch discussions, mentoring new folks, etc. See also that January 2023 message by Paul Richard Thomas to comp.lang.fortran. And that 2008 message by Tobias Burnus to comp.lang.fortran contains advice that are still pertinent.
See the Quickstart Guide to Hacking Gfortran. The GNU Fortran Compiler Internals documents the internals of GFortran.
You can also contribute to GFortran at the Google Summer of Code: https://gcc.gnu.org/wiki/SummerOfCode.
You can read the GCC sources by cloning that read-only git repository:
$ git clone git://gcc.gnu.org/git/gcc.git
or if you have firewall problems:
$ git clone https://gcc.gnu.org/git/gcc.git
Concerning Fortran, the sub-directories are gcc/fortran
, libgfortran
, gcc/testsuite/gfortran.dg
and gcc/testsuite/gfortran.fortran-torture
.
To build GCC, you also need to install the libraries GMP, MPFR and MPC.
Unofficial GFortran 32-bit and 64-bit binary packages based on the current development source code can be found on http://gcc.gnu.org/wiki/GFortranBinaries. For example, to install the latest 64-bit nightly binary in a Linux system, download and install the latest GCC trunk build:
$ cd /tmp
$ wget https://gfortran.meteodat.ch/download/x86_64/nightlies/gcc-trunk.tar.xz
$ cd /opt
$ sudo tar -xJf /tmp/gcc-trunk.tar.xz
$ /opt/gcc-trunk/bin/gfortran --version
GNU Fortran (GCC) 13.0.1 20230227 (experimental) [master r13-6353-g529e03b988]
Then set LD_LIBRARY_PATH
and PATH
: see that GFortran wiki page for details on bash and csh/tcsh. For zsh, this will work for both the x86_64 and i386 versions:
# Determine platform
ARCH=`uname -m`
# GFortran
export PATH=/opt/gcc-trunk/bin:${PATH}
if [[ ${ARCH} == "x86_64" ]]; then
LIB64="64"
fi
if [ -z "$LD_LIBRARY_PATH" ]; then
LD_LIBRARY_PATH="/opt/gcc-trunk/lib${LIB64}"
else
LD_LIBRARY_PATH="/opt/gcc-trunk/lib${LIB64}:$LD_LIBRARY_PATH"
fi
export LD_LIBRARY_PATH
Metcalf, M., J. Reid, M. Cohen, and R. Bader (2018). Modern Fortran Explained: Incorporating Fortran 2023 Oxford University Press.
Curcic, Milan (2019). Modern Fortran: Building Efficient Parallel Applications. Manning Publications.
Metcalf, M., J. Reid, and M. Cohen (2018). Modern Fortran Explained: Incorporating Fortran 2018. Oxford University Press.
Ray, Subrata (2019). Fortran 2018 with Parallel Programming CRC
Brainerd, Walter S. (2015). Guide to Fortran 2008 Programming. Springer.
Chivers, Ian D. and Jane Sleightholme (2018) Introduction to Programming with Fortran (4th Edition). See also the Wiki page Introduction to Programming with Fortran (3rd Edition). Springer.
Chapman, Stephen J. (2018). Fortran for Scientists and Engineers (Fourth Edition). McGraw-Hill Education.
Hanson, R. J. and Hopkins, T. (2013). Numerical Computing With Modern Fortran. SIAM.
Metcalf, M., J. Reid, and M. Cohen (2011). Modern Fortran Explained. Oxford University Press.
Numrich, Robert W. (2018). Parallel Programming with Co-Arrays. Chapman & Hall/CRC.
Adams, J. C., W. S. Brainerd, R. A. Hendrickson, R. E. Maine, J. T. Martin, and B. T. Smith (2008). The Fortran 2003 Handbook. Springer.
Brainerd, Walter S. (2009) Guide to Fortran 2003 Programming. Springer.
Metcalf, M., J. Reid, and M. Cohen (2004). Fortran 95/2003 Explained. Oxford University Press.
Chapman, S. J. (2007). Fortran 95 and 2003 for Scientists and Engineers. McGraw-Hill Education.
Adams, Brainerd, Martin, Smith and Wagener (1997). Fortran 95 Handbook. MIT.
Akin, E. (2003). Object-Oriented Programming Via Fortran 90 and 95. Cambridge University Press. (pdf)
Chapman, S. J. (1997). Introduction To Fortran 90 and 95. McGraw-Hill College.
Chapman, S. J. (2004). Fortran 90 and 95 for Scientists and Engineers. 2nd ed. McGraw Hill. (Publisher’s site)
Lemmon, D. R. and J. L. Schafer. (2005). Developing Statistical Software in Fortran 95. Springer.
McCormack, D. (2009). Scientific Software Development with Fortran. Lulu.
Ellis, T.M.R., Ivor R. Phillips, and Thomas M. Lahey (1994) Fortran 90 Programming Addison Wesley
Landau, Rubin (2005) A First Course in Scientific Computing: Symbolic, Graphic, and Numeric Modeling Using Maple, Java, Mathematica, and Fortran90. Princeton University Press
Akaike, Hirotsugu (1975). TIMSAC-74, a time series analysis and control program package Institute of Statistical Mathematics. R package timsac: Time Series Analysis and Control has Fortran code.
Akin, J. E. (1994). Finite Elements for Analysis and Design Academic Press
Alexandrou, Andreas N. (2001). Principles of Fluid Mechanics Prentice-Hall
Algazin, Sergey D., and Igor A. Kijko (2015). Aeroelastic Vibrations and Stability of Plates and Shells De Gruyter
Allen, Michael P. and Dominic J. Tildesley (2017). Computer Simulation of Liquids, 2nd. ed. Oxford University Press. code at GitHub
Anagnostopoulos, Konstantinos (2016). Computational Physics freely available in Fortran and C++ versions
Angell, Ian O., and Gareth Griffith (1987). High-resolution Computer Graphics Using FORTRAN 77 Palgrave Macmillan
Antia, H.M. (2012). Numerical methods for scientists and engineers, 3rd ed. Hindustan Book Agency.
Bartschat, Klaus (Ed.) (1996). Computational Atomic Physics: Electron and Positron Collisions with Atoms and Ions Springer
Bathe, Klaus-Jurgen (2014). Finite Element Procedures, 2nd ed. Prentice Hall. Text here Related code ADINA, OpenSTAP, and STAP90
Beer, Gernot, Ian Smith, and Christian Duenser (2008). The Boundary Element Method with Programming For Engineers and Scientist Springer
Beer, Gernot (2001). Programming the Boundary Element Method: An Introduction for Engineers Wiley
Berg, Bernd A (2004). Markov Chain Monte Carlo Simulations and Their Statistical Analysis – With Web-Based Fortran Code World Scientific
Bestehorn, Michael (2018). Computational Physics With Worked Out Examples in FORTRAN and MATLAB De Gruyter
Bhatt, Prab (2003). Programming the Dynamic Analysis of Structures CRC
Bierman, Gerald J. (1977). Factorization Methods for Discrete Sequential Estimation Academic Press (contains Fortran pseudo-code for numerically stable Kalman filters)
Blazek, Jiri (2015). Computational Fluid Dynamics: Principles and Applications, 3rd ed. Butterworth-Heinemann
Bloomfield, Peter (1976). Fourier Analysis of Time Series, 1st ed. First edition has Fortran code, the 2nd edition, published in 2000, has S-PLUS code.
Boor, Carl de (1978). A Practical Guide to Splines Springer. PPPACK Fortran 90 code here
Bose, Sujit Kumar (2019). Numerical Methods of Mathematics Implemented in Fortran Springer. reviewed here
Boyd, John P. (2001). Chebyshev and Fourier Spectral Methods Dover. Modified code here
Brandt, Siegmund (1999). Data Analysis: Statistical and Computational Methods for Scientists and Engineers Springer
Brent, Richard (1973). Algorithms for Minimization without Derivatives Prentice-Hall
Britz, Dieter, and Jörg Strutwolf (2016). Digital Simulation in Electrochemistry Springer. Appendix E describes a number of example programs in Fortran.
Burden, Richard, L., J. Douglas Faires and Annette M. Burden (2016). Numerical Analysis, 10th ed. Cengage. FORTRAN 77 code here
Chandra, Rohit, Ramesh Menon, Leo Dagum, David Kohr, Dror Maydan, and Jeff McDonald (2000). Parallel Programming in OpenMP Morgan Kaufmann
Chapman, Barbara et al. (2007). Using OpenMP - Portable Shared Memory Parallel Programming. MIT Press.
Cheney, Ward and David Kincaid (2012). Numerical Mathematics and Computing, 7th ed. Brooks/Cole: Cengage Learning
Chung, T. J. (2010). Computational Fluid Dynamics, 2nd ed. Cambridge University Press
Clerman, Norman S. and Spector, Walter (2011). Modern Fortran - Style and Usage. Cambridge University Press. reviewed in the Journal of Statistical Software
Coker, A. Kayode (1995). Fortran Programs for Chemical Process Design, Analysis, and Simulation Gulf Professional
Crawley, Stanley W., and Robert M. Dillon (1993) Steel Buildings: Analysis and Design, 4th ed. Wiley
Cullum, Jane K. and Ralph A. Willoughby (1985) Lanczos Algorithms for Large Symmetric Eigenvalue Computations: Vol. I: Theory Birkhauser. Code and text of 2nd volume at Netlib
Curotto, Emanuele (2009). Stochastic Simulations of Clusters: Quantum Methods in Flat and Curved Spaces CRC
Dagpunar, John (1988). Principles of Random Variate Generation Oxford University Press. Related Fortran 90 code from Alan Miller.
Davies, R.G. (1971). Computer Programming in Quantitative Biology Academic Press
Davis, Mark E. (1984). Numerical Methods & Modeling for Chemical Engineers Wiley
Davis, Philip J., and Philip Rabinowitz (1984). Methods of Numerical Integration, 2nd. ed. Academic Press
Day, A. Colin (1972). Fortran Techniques with Special Reference to Non-numerical Applications Cambridge University Press
De Gooijer, Jan G. (2017). Elements of Nonlinear Time Series Analysis and Forecasting Springer
Dennis, Jr., J.E., and Robert B. Schnabel (1996). Numerical Methods for Unconstrained Optimization and Nonlinear Equations SIAM. Fortran 90 code for UNCMIN at Alan Miller’s site
Deutsch, C.V. and A.G. Journel (1997). GSLIB: Geostatistical Software Library and Users Guide, 2nd. ed. Oxford University Press. Code here
DeVries, Paul L. (1994). A First Course in Computational Physics Wiley. reviewed here
Devroye, Luc (1986). Non-Uniform Random Variate Generation Springer. Devroye says“Alan Miller … programmed most algorithms” from the book.
Dierckx, Paul (1993). Curve and Surface Fitting with Splines Oxford. code here
Engeln-Müllges, Gisela and Uhlig, Frank (2013). Numerical Algorithms with Fortran. Springer.
Epps, Thomas W. (2007). Pricing Derivative Securities, 2nd. ed. World Scientific
Evensen, Geir (2009). Data assimilation, The Ensemble Kalman Filter, 2nd ed. Springer
Farrashkhalvat, M., and J.P. Miles (2003). Basic Structured Grid Generation, with an introduction to unstructured grid generation Butterworth-Heinemann
Fehr, Hans and Kindermann, Fabian (2018). Introduction to Computational Economics Using Fortran. Oxford University Press.
Fenner, D. N. (1987). Engineering stress analysis: A finite element approach with FORTRAN 77 software Ellis Horwood
Fenner, Roger T. (2013). Finite Element Methods For Engineers, 2nd ed. Imperial College Press
Fenton, Gordon A., and D. V. Griffiths (2008). Risk Assessment in Geotechnical Engineering Wiley
Ferziger, Joel H., Peric, Milovan, and Street, Robert L. (2002). Computational Methods for Fluid Dynamics Springer
Finlayson, Bruce A. (1980). Nonlinear Analysis in Chemical Engineering McGraw-Hill.
Fletcher, C. A. J. (1998). Computational Techniques for Fluid Dynamics 1: Fundamental and General Techniques Springer
Fletcher, C. A. J. (1991). Computational Techniques for Fluid Dynamics 2: Specific Techniques for Different Flow Categories Springer
Fletcher, C. A. J. (1984). Computational Galerkin Methods Springer
Fletcher, R. (2000). Practical Methods of Optimization, 2nd Edition Wiley
Fornberg, Bengt (1998). A Practical Guide to Pseudospectral Methods Cambridge University Press.
Forsythe, George E., Michael A. Malcolm, and Cleve B. Moler (1977). Computer Methods for Mathematical Computations Prentice-Hall. Code at Netlib
Francq, Christian and Jean‐Michel Zakoian (2019). GARCH Models: Structure, Statistical Inference and Financial Applications, 2nd. ed. Wiley. Code at Francq’s site
Fuller, W. R. (1977). FORTRAN Programming: A Supplement for Calculus Courses Springer
Garcia, Alejandro L. (1994). Numerical Methods for Physics Prentice Hall
Gibbs, B. P. (2011). Advanced Kalman Filtering, Least-Squares, and Modeling, A Practical Handbook Wiley. The software is included in a single zip file (Gibbs_Software_1_2.zip) located at web site ftp://ftp.wiley.com/public/sci_tech_med/least_squares/
Gill, Philip E., Walter Murray, Margaret H. Wright (1981). Practical Optimization Academic Press
Giordano, Nicholas J., and Hisao Nakanishi (2005). Computational Physics Prentice-Hall
Golub, Gene, and Charles Van Loan (2013). Matrix Computations, 4th ed. Johns Hopkins
Gonin, Rene, and Arthur H. Money (1989). Nonlinear Lp-Norm Estimation CRC
Green, Peter J., Nils Lid Hjort, and Sylvia Richardson (2003). Highly Structured Stochastic Systems Oxford University Press. Related code at Green’s site
Greenspan, Donald (2005). Molecular and Particle Modelling of Laminar and Turbulent Flows World Scientific
Greenspan, Donald (1991). Quasimolecular Modelling World Scientific
Griffiths, P., and Ian D. Hill (1985). Applied Statistics Algorithms Ellis Horwood. Applied statistics codes here.
Griffiths, D. Vaughan, and I.M. Smith (2006). Numerical Methods for Engineers, 2nd ed. CRC. Code at Griffiths’ site
Gropp, William, Torsten Hoefler, Rajeev Thakur and Ewing Lusk (2014). Using Advanced MPI: Modern Features of the Message-Passing Interface. MIT Press.
Gropp W., Lusk, E. and Skjellum, A. (1999). Using MPI - Portable Parallel Programming with the Message Passing Interface. The MIT Press.
Gu, Chong (2013). Smoothing Spline ANOVA Models, 2nd ed.
Hageman, L. and D. M. Young (1981). Applied Iterative Methods Academic Press. Related package: NSPCG
Hager, Georg and Gerhard Wellein (2010). Introduction to High Performance Computing for Scientists and Engineers CRC
Hairer, Ernst, Syvert P. Nørsett, and Gerhard Wanner (1993). Solving Ordinary Differential Equations I: Nonstiff Problems Springer. code at Hairer’s site
Hairer, Ernst, and Gerhard Wanner (1996). Solving Ordinary Differential Equations II: Stiff and Differential-Algebraic Problems Springer. code at Hairer’s site
Hartigan, J. A. (1975). Clustering Algorithms Wiley. Code in the Cluster section of CMLIB.
Hinton, E, and D. Owen (1979). Finite Element Programming Academic Press
Hjorth-Jensen, Morton (2008). Computational Physics
Hock, W., and Klaus Schittkowski (1981). Test Examples for Nonlinear Programming Codes Springer. Code here
Huang, Haibo, Michael C. Sukop, and Xi-Yun Lu (2015). Multiphase Lattice Boltzmann Methods: Theory and Application Wiley
Hughes, Thomas J. R. (1987). The Finite Element Method: Linear Static and Dynamic Finite Element Analysis Prentice-Hall. Related code DLEARN
Itkin, A. L., and E. G. Kolesnichenko (1997). Microscopic Theory of Condensation in Gases and Plasma World Scientific
Izaac, Joshua, and Jingbo Wang (2018). Computational Quantum Mechanics Springer
Javanbakht, Zia, and Andreas Öchsner (2017). Advanced Finite Element Simulation with MSC Marc: Application of User Subroutines Springer
Jeppson, Roland W. Jeppson (1976). Analysis of Flow in Pipe Networks Butterworth-Heinemann. Modernization of codes discussed in Recovery of Jeppson Pipe Network Analysis Software by Bob Apthorpe
Jones, Russell K., and Tracy Crabtree (1988). FORTRAN Tools for VAX/VMS and MS-DOS Wiley
Kagiwada, Harriet, Robert Kalaba, Nima Rasakhoo, and Karl Spingarn (1986). Numerical Derivatives and Nonlinear Analysis
Kahaner, David, Cleve Moler, and Stephen Nash (1998). Numerical Methods and Software Prentice Hall. Fortran 90 code here
Kampf, Jochen (2010). Advanced Ocean Modelling: Using Open-Source Software Springer
Kantz, Holger, and Thomas Schreiber (2010). Nonlinear Time Series Analysis Cambridge University Press. Associated software: TISEAN
Katz, Joseph and Allen Plotkin (2001). Low-Speed Aerodynamics Cambridge University Press. Code at GitHub
Kearfott, R. Baker (1996). Rigorous Global Search: Continuous Problems Kluwer
Kernighan, Brian W. and Pike, Rob (1999). The Practice of Programming. Addison-Wesley.
Kincaid, David and Ward Cheney (2002). Numerical Analysis: Mathematics of Scientific Computing, 3rd ed. American Mathematical Society. Code here
Kitagawa, Genshiro (2020). Introduction to Time Series Modeling with Applications in R CRC. Associated R package TSSS: Time Series Analysis with State Space Model has Fortran code.
Klein, Andi, and Alexander Godunov (2006). Introductory Computational Physics Cambridge University Press. codes in Fortran and C++
Koonin, Steven E., and Dawn C. Meredith (1990). Computational Physics: Fortran Version Westview Press
Kopriva, David (2009). Implementing Spectral Methods for Partial Differential Equations: Algorithms for Scientists and Engineers Springer. Has Fortran-friendly pseudo-code. The author has contributed routines to the HORSES2D high-order spectral element solver in Fortran.
Kuester, James L., and Joe H. Mize (1973). Optimization Techniques with Fortran McGraw-Hill
Land, A., and S. Powell (1973). Fortran codes for mathematical programming: linear, quadratic and discrete Wiley
Lau, Hang Tong (1989). Algorithms on Graphs Tab Books. Fortran 90 version of code at Burkardt’s site
Lau, Hang Tong (1986). Combinatorial Heuristic Algorithms with FORTRAN Springer
Lawson, Charles L., and Richard J. Hanson (1995). Solving Least Squares Problems SIAM original code at Netlib, modernized code at GitHub. Bounded Variable Least Squares Solver here, Nonnegative Least Squares here.
LeVeque, Randall J. (2012). Finite Volume Methods for Hyperbolic Problems Cambridge University Press
Lee, H.J., and W.E. Schiesser (2003). Ordinary and Partial Differential Equation Routines in C, C++, Fortran, Java, Maple, and MATLAB Chapman and Hall/CRC
Lee, Wen Ho (2018). Computational Solid Mechanics for Oil Well Perforator Design World Scientific
Lucquin, Brigitte, and Olivier Pironneau (1998). Introduction to Scientific Computing Wiley. Fortran and C code at Pironneau’s site
Marazzi, Alfio (1993). Algorithms, Routines, and S-Functions for Robust Statistics Chapman and Hall/CRC. FORTRAN 77 code available in robeth R package
Markus, Arjen (2012). Modern Fortran in Practice Cambridge University Press. Reviewed here
Marple, S. Lawrence (1987). Digital Spectral Analysis with Applications Prentice-Hall. Reviewed here. Second edition has Matlab code.
Mattson, Timothy G., Yun (Helen) He, and Alice E. Koniges (2019). The OpenMP Common Core: Making OpenMP Simple Again MIT Press
Mielke, Jr., Paul W., and Kenneth J. Berry (2007). Permutation Methods: A Distance Function Approach Springer. code at Mielke’s site
Miller, Alan (2002). Subset Selection in Regression, 2nd ed. Chapman and Hall/CRC. code at Miller’s site
Monahan, John F. (2011). Numerical Methods of Statistics, 2nd ed. Cambridge University Press
Moran, Jack (1984). An Introduction to Theoretical and Computational Aerodynamics Wiley. Reviewed here
Moré, Jorge J. and Stephen J. Wright (1993). Optimization Software Guide SIAM. Wright helped create the NEOS Guide
Moursund, David G., and Charles S. Duris (1988). Elementary Theory and Application of Numerical Analysis Dover
Nazareth, J.L. (2001). DLP and Extensions: An Optimization Model and Decision Support System Springer. DLPEDU code here
Neculai, Andrei (2020). Nonlinear Conjugate Gradient Methods for Unconstrained Optimization Springer. Fortran codes at author’s site
Newton, H. Joseph (1988). Timeslab: A Time Series Analysis Laboratory Wadsworth & Brook/Cole. Timeslab code at author’s site
Nguyen, Duc Thai (2002). Parallel-Vector Equation Solvers for Finite Element Engineering Applications Springer
Nocedal, Jorge, and Stephen J. Wright (2006). Numerical Optimization Springer. Related code at Nocedal’s site
Oliveira, Suely and Stewart, David (2006). Writing Scientific Software - A Guide to Good Style. Cambridge University Press.
Olver, Frank W. J., Daniel W. Lozier, Ronald F. Boisvert, and Charles W. Clark (2010). NIST Handbook of Mathematical Functions Cambridge University Press. Associated with the NIST Digital Library of Mathematical Functions
Orfanidis, Sophocles J. (1988). Optimum Signal Processing Wiley
Osyczka, Andrzej (1984). Multicriterion Optimization in Engineering with FORTRAN Programs Halsted/Wiley
Pang, Tao (2006). An Introduction to Computational Physics, 2nd Edition Cambridge University Press
Pao, Yen-Ching (1998). Engineering Analysis: Interactive Methods and Programs with FORTRAN, QuickBASIC, MATLAB, and Mathematica CRC Press
Pozrikidis, C. (2017). Fluid Dynamics: Theory, Computation, and Numerical Simulation, 3rd ed. Springer
Pozrikidis, C. (2008). Numerical Computation in Science and Engineering, 2nd. ed. Oxford University Press
Pozrikidis, C. (2011). Introduction to Theoretical and Computational Fluid Dynamics, 2nd. ed. Oxford
Pozrikidis, C. (1999). Little Book of Streamlines Academic Press
Prausnitz, J., T. Anderson, E. Grens, C. Eckert, R. Hsieh, and J. O’Connell, (1980). Computer Calculations for Multicomponent Vapor-Liquid and Liquid-Liquid Equilibria Prentice-Hall.
Press, Flannery, Teukolsky, and Vetterling (1992). Numerical Recipes in Fortran 77. Cambridge University Press.
Press, Teukolsky, Vetterling and Flannery (1996). Numerical Recipes in Fortran 90 - The Art of Parallel Scientific Computing. Cambridge University Press
Rabiner, Lawrence R., and Bernard Gold (1975). Theory and Application of Digital Signal Processing Prentice Hall
Ramkarthik, M.S., and Payal D. Solanki (2021) Numerical Recipes in Quantum Information Theory and Quantum Computing: An Adventure in FORTRAN 90 CRC Press
Ramos, Juan Antonio Hernandez, and Lopez, Javier Escoto (2020). How to learn Applied Mathematics through modern FORTRAN. Independently published code and text
Reddy, J. N. (2005). An Introduction to the Finite Element Method, 3rd ed. McGraw-Hill. Code here
Robey, Robert and Yuliana Zamora (2021). Parallel and High Performance Computing Manning
Roe, Byron P. (2001). Probability and Statistics in Experimental Physics Springer
Røed, Lars Petter (2019). Atmospheres and Oceans on Computers: Fundamental Numerical Methods for Geophysical Fluid Dynamics Springer. Has appendix Introduction to Fortran 2003 via Examples
Rouson, D., J. Xia, and X. Xu (2011). Scientific Software Design - The Object-Oriented Way. Cambridge University Press.
Ruetsch, Gregory and Fatica, Massimiliano (2013). CUDA Fortran for Scientists and Engineers. Morgan Kaufmann.
Saad, Yousef (2003). Iterative Methods for Sparse Linear Systems, 2nd Edition SIAM
Saad, Yousef (2011). Numerical Methods for Large Eigenvalue Problems - 2nd Edition SIAM
Salmi, Tapio, Johan Wärnå , José Rafael Hernández Carucci and César A. de Araújo Filho (2020). Chemical Reaction Engineering: A Computer-Aided Approach De Gruyter
Santner, Thomas J., Brian J. Williams, and William I. Notz (2003). The Design and Analysis of Computer Experiments Springer
Schittkowski, Klaus (2002). Numerical Data Fitting in Dynamical Systems - A Practical Introduction with Applications and Software Kluwer
Schittkowski, Klaus (1987). More Test Examples for Nonlinear Programming Codes Springer. Code here
Schittkowski, Klaus (1980). Nonlinear Programming Codes: Information, Tests, Performance Springer
Schmidt, Bernd (1987). Model Construction with GPSS-FORTRAN Version 3 Springer.
Scott, L. Ridgway, Terry Clark, and Babak Bagheri (2005). Scientific Parallel Computing Princeton University Press
Sewell, Granville (2018). Solving Partial Differential Equation Applications with PDE2D Wiley
Sewell, Granville (2015) The Numerical Solution of Ordinary and Partial Differential Equations, 3rd Ed. World Scientific
Sewell, Granville (2014). Computational Methods of Linear Algebra, 3rd ed. World Scientific
Shampine, Lawrence, and Marilyn Gordon (1975). Computer Solution of Ordinary Differential Equations: The Initial Value Problem Freeman. Code translated to Fortran 90 by John Burkardt.
Singh, Nathi (2017). Computational Methods for Physics and Mathematics: With Fortran and C Programmes Alpha Science
Sinha, Mihir K., and Larry R. Padgett (1985). Reservoir Engineering Techniques Using Fortran Springer
Siouris, George M. (1996). An Engineering Approach to Optimal Control and Estimation Theory Wiley
Smetana, Frederick O. (1997). Introductory Aerodynamics and Hydrodynamics of Wings and Bodies: A Software-Based Approach American Institute of Aeronautics & Astronautics
Smetana, Frederick O. (1981). Fortran Codes for Classical Methods in Linear Dynamics McGraw-Hill
Smith, I.M., D. V. Griffiths, and L. Margetts (2013). Programming the Finite Element Method, 5th Edition Wiley. Code at Griffiths’ site
Smylie, D. E. (2013). Earth Dynamics: Deformations and Oscillations of the Rotating Earth Cambridge University Press
Snir, Marc and Gropp, William (1998). MPI - The Complete Reference. The MIT Press.
Späth, Helmuth (1995). Two Dimensional Spline Interpolation Algorithms CRC
Späth, Helmuth (1995). One Dimensional Spline Interpolation Algorithms CRC
Späth, Helmuth (1991). Mathematical Algorithms for Linear Regression Academic Press. Fortran 90 code at John Burkardt’s site
Späth, Helmuth (1980). Cluster Analysis Algorithms Halsted Press. Fortran 90 code at John Burkardt’s site
Stearns, Samuel D., and Ruth A. David (1992). Signal Processing Algorithms in Fortran and C Prentice-Hall
Tanizaki, Hisashi (2004). Computational Methods in Statistics and Econometrics CRC Press
Thompson, William J. (1997). Atlas for Computing Mathematical Functions: An Illustrated Guide for Practitioners with Programs in FORTRAN and Mathematica Wiley
Tikhonov, A.N., Goncharsky, A., Stepanov, V.V., and Yagola, A.G. (1995). Numerical Methods for the Solution of Ill-Posed Problems Springer
Trapp, Michael, and Andreas Öchsner (2018). Computational Plasticity for Finite Elements: A Fortran-Based Introduction Springer
Villadsen, John, and Michael L. Michelsen (1978). Solution of Differential Equations Models by Polynomial Approximation Prentice-Hall
Vowels, Robin A. (1998). Algorithms and Data Structures in F and Fortran Unicomp
Walker, Darren (2016). Computational Physics Mercury Learning. Code at GitHub.
Wang, H. F., and M. P. Anderson (1982). Introduction to groundwater modeling: Finite difference and finite element methods Freeman. Code at Wang’s site
Watson, Neville, and Jos Arrillaga (2003). Power Systems Electromagnetic Transients Simulation Institution of Engineering and Technology
Wesseling, Pieter (1992). An Introduction to Multigrid Methods Wiley. Code by Wesseling here
Weiland, Claus (2010). Computational Space Flight Mechanics Springer
Willé, David R. (1995). Advanced Scientific Fortran Wiley
White, Robert E. (2016). Computational Mathematics Models, Methods, and Analysis with MATLAB® and MPI, 2nd ed. CRC
Yanushevsky, Rafael (2019). Modern Missile Guidance, 2nd ed. CRC
Zubairi, Omair and Fridolin Weber (2018). Introduction to Computational Physics for Undergraduates Morgan & Claypool
In object-oriented languages such as C++, one can define classes that contain both data and methods which operate on that data. One can then create separate instances of the class, each with its own data. A method called from an instance of the class will work on the data held by that particular instance.
In Fortran, modules may contain data, but there is no notion of separate instances of a module. In order to obtain class-like behavior, one can combine a module, which contains the methods that operate on the class, with a derived type containing the data. There can be separate “instances” of the type in that we can allocate many variables of that type which can be passed as parameters to the methods contained in the module.
To illustrate these points consider a simple Circle class, based on an example in Akin (2003, p. 34):
module class_Circle
implicit none
private
public :: Circle, circle_area, circle_print
real :: pi = 3.1415926535897931d0 ! Class-wide private constant
type Circle
real :: radius
end type Circle
contains
function circle_area(this) result(area)
type(Circle), intent(in) :: this
real :: area
area = pi * this%radius**2
end function circle_area
subroutine circle_print(this)
type(Circle), intent(in) :: this
real :: area
area = circle_area(this) ! Call the circle_area function
print *, 'Circle: r = ', this%radius, ' area = ', area
end subroutine circle_print
end module class_Circle
program circle_test
use class_Circle
implicit none
type(Circle) :: c ! Declare a variable of type Circle.
c = Circle(1.5) ! Use the implicit constructor, radius = 1.5.
call circle_print(c) ! Call a class subroutine
end program circle_test
NOTE: circle_print
and circle_area
could be made accessible through generic procedure names print
and area
, respectively. That gets closer to a standard OOP language, because print
can be defined for multiple “sub-classed” objects.
New features in Fortran 2003 allow us to improve upon the object-oriented approach above by using type-bound procedures which allow us to write
a = c%area
call c%print
instead of the more verbose
a = circle_area(c)
call circle_print(c)
If the above example is modified to provide print
and area
as generic interfaces, it is more concise, even though it does not follow modern OOP syntax:
a = area(c)
call print(c)
The program above, modified to use type-bound procedures, looks like this
module class_Circle
implicit none
private
real :: pi = 3.1415926535897931d0 ! Class-wide private constant
type, public :: Circle
real :: radius
contains
procedure :: area => circle_area
procedure :: print => circle_print
end type Circle
contains
function circle_area(this) result(area)
class(Circle), intent(in) :: this
real :: area
area = pi * this%radius**2
end function circle_area
subroutine circle_print(this)
class(Circle), intent(in) :: this
real :: area
area = this%area() ! Call the type-bound function
print *, 'Circle: r = ', this%radius, ' area = ', area
end subroutine circle_print
end module class_Circle
program circle_test
use class_Circle
implicit none
type(Circle) :: c ! Declare a variable of type Circle.
c = Circle(1.5) ! Use the implicit constructor, radius = 1.5.
call c%print ! Call the type-bound subroutine
end program circle_test
Note that we have changed the dummy parameters from type(Circle)
to class(Circle)
. We can then call the class functions in an object-oriented fashion as a = c%area
and call c%print
, where the type is passed to the first argument of the functions circle_area
and circle_print
automatically. See Metcalf, Reid, and Cohen (2004, p. 279) for additional information.
Akin, E. (2003). Object-Oriented Programming Via Fortran 90 and 95. Cambridge University Press. (pdf)
Bader, Reinhold (2007). Object-Oriented Features in Fortran 2003. Slides.
Chin, L. S., D. J. Worth and C. Greenough (2006): Thoughts on using the Features of Fortran 95, Software Engineering Group Notes SEG-N-003 (html | pdf )
Clerman, Norman S. and Spector, Walter (2012). Modern Fortran: Style and Usage. Cambridge University Press.
Cohen, M. (1999): Object orientation and Fortran 2002: part II, ACM SIGPLAN Fortran Forum, 18, 14–21.
Decyk, V. K., C. D. Norton, and B. K. Szymanski: Object Oriented Fortran 90 Programming
Decyk, V. K., and H. Gardner, Object-Oriented Design Patterns in Fortran 90/95: mazev1, mazev2 and mazev3, Computer Physics Communications, 178, pp 611-620 (2008).
Gray, M. G. and R. M. Roberts (1997): Object-based programming in Fortran 90 (PDF, 183K). Computers in Physics, 11, 355–361.
Holcomb, K. (2000): Object-oriented programming in Fortran 95 (PDF, 90K).
Lemmon, D. R. and J. L. Schafer. (2005). Developing Statistical Software in Fortran 95. Springer.
Markus, A. (2006): Design patterns and Fortran 90/95, ACM SIGPLAN Fortran Forum, 25, 13–29.
Markus, A. (2012). Modern Fortran in Practice. Cambridge University Press.
Metcalf, M., J. Reid, and M. Cohen (2004). Fortran 95/2003 Explained. Oxford University Press.
Rouson, D., H. Adalsteinsson, and J. Xia (2010). Object-Oriented Design Patterns for Multiphysics Modeling in Fortran 2003 and C++. ACM Transactions on Mathematical Software.
Worth, D. J. (2008). State of the art in object oriented programming with fortran. Technical Report RAL-TR-2008-002.
The Fortran Wiki is an open venue for discussing all aspects of the Fortran programming language and scientific computing. See the mission statement for more details.
You can edit this website using the Edit Page link at the bottom of each page. Feel free to use the Sandbox to experiment. The HowTo contains more information on getting started. For questions, see Fortran Wiki discussion.
El Fortran Wiki es un lugar abierto para discutir todos los aspectos del lenguaje de programación Fortran y la computación científica. Vea la declaración de la misión para más detalles.
Puede editar este sitio web utilizando el enlace Editar página en la parte inferior de cada página. Siéntase libre de usar el Sandbox para experimentar. El HowTo contiene más información sobre cómo empezar. Para preguntas, vea Fortran Wiki discusión.
Noticias - noticias y actualizaciones sobre el wiki y la Comunidad Fortran. HowTo - cómo puede contribuir al Fortran Wiki Código - cargar y descargar el código Fortran Preguntas más frecuentes sobre Fortran
Essential Lahey Fortran 90 (ELF90) is a dialect of Fortran 90 designed for for students, teachers, scientists, and engineers who want to write programs using the modern features of Fortran 90. It removes many of the obsolete features of Fortran 90 and simplifies some of its syntax.