Fortran 2008 is a minor revision of Fortran 2003.
The final draft of the Fortran 2008 standard, ISO/IEC JTC 1/SC 22/WG 5/N1830, was released on June 7, 2010 and is available from the WG5’s FTP server at ftp://ftp.nag.co.uk/sc22wg5/N1801-N1850/N1830.pdf.
For compiler support, see Fortran 2008 status.
New features include:
do concurrent
constructcontiguous
attributeexit
statementerror stop
statementnewunit=
in open
statementg0
edit descriptorChanges to existing intrinsic procedures:
back=
argument.radix=
argument.New intrinsic procedures:
contiguous
attribute: is_contiguous?.Additions to intrinsic modules:
compiler_version
and compiler_options
.ieee_selected_real_kind
now has a radix=
argument.c_sizeof
returns the size of an array element in bytes.Declared Obsolete:
entry
(Fortran 77 and later)J3 Documents:
Latest draft accepted by the ISO Secretariat:
Previous drafts of the standard:
ISO/IEC JTC 1/SC 22/WG 5/N1826 (April 20, 2010)
ISO/IEC JTC 1/SC 22/WG 5/N1791 (August 28, 2009)
ISO/IEC JTC 1/SC 22/WG 5/N1776 (March 25, 2009)
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)
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
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+)
pFUnit is a Fortran unit testing framework created by developers from NASA and TASC. It is implemented in Fortran and C and can use MPI.
pFUnit SourceForge project (not updated anymore)
Scientific expert at BPA (Rouen, France), helping our customers describe and document their R&D activities.
Engineer from École Centrale de Nantes, majored in “mechanical engineering & computing”
PhD in Industrial Computing
Trying to apply Clifford algebras (more specifically the Geometric Algebra variant by Prof. David Hestenes) to numerical computation for the modeling and simulation of continuous media (fluids in particular)
I have been prototyping my stuff in Python but now requires more powerful hardware (GPUs) that Fortran should be able to use more efficiently. Hence my renewed interest in Fortran (specifically for HPC) and parallel/distributed computation.
I am affiliated (“chercheur associé”) with Institut Pascal, a CNRS lab in Clermont-Ferrand.
(for communicating with people)
If you are new to the wiki, here is one way to introduce yourself:
Edit this page by clicking the “Edit” link at the bottom and add your name to the list below surrounded by square brackets to create a wiki link.
Type your name again in the “Submit as” field at the bottom of the page and save your changes by clicking the “Submit” button.
When the page reloads, your name should appear in the list followed by a question mark, indicating a link to a page which doesn’t exist yet. Follow this link to create your user page.
Edit and save your user page, optionally adding some information about yourself such as how you use Fortran or a link to your homepage.
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 2023: https://gcc.gnu.org/wiki/SummerOfCode (deadline April 4, 2023).
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
This interface illustrates how wrapper functions can simplify the user API, and handle C header declarations that are not readily accessible in Fortran.
Below are sources for the main Fortran module, the C support/wrapper code, and a small example program.
This is only a preliminary version, It would be nice to automatically handle the match array, but the maximum number of matches must still be declared by the caller.
PCRE is a much more powerful pattern library, and may be a better choice than POSIX regex. You may find some wrappers in the projects here: fortran_pcre fregex ftlRegex
module regex_module
!-------------------------------------------------------------------
! Fortran interface to POSIX regex, using ISO_C_BINDING.
!
! Regex is defined as an API using C headers. It does not define the
! exact value of flag tokens, just the names. It also uses an opaque
! data structure and a declared numeric type for the match array.
! Therefore, the code must either be generated for each target
! platform, or it use wrapper functions written in C.
!
! Fortran wrapper functions are also required to present a normal
! Fortran API, ant not require C conversions by the caller.
!
! The interface here is not strictly correct, because it does not
! explicitly convert Fortran strings to the C character kind.
! Fortran only supports conversion of string kinds by assignment,
! or by a rather slow internal WRITE. For now, the easiest approach
! is to assume that C and Fortran default character kinds are the
! same. This is generally true, but UTF-8 strings are likely to
! cause problems.
!-------------------------------------------------------------------
! API:
!
! Compile a regex into a regex object
! subroutine regcomp(this,pattern,flags,status)
! type(regex_type), intent(out) :: this ! new regex object
! character(len=*), intent(in) :: pattern ! regex pattern string
! character(len=*), intent(in), &
! optional :: flags ! flag characters:
! ! x = extended regex (REG_EXTENDED)
! ! m = multi-line (REG_NEWLINE)
! ! i = case-insensitive (REG_ICASE)
! ! n = no MATCH required (REG_NOSUB)
! integer, intent(out), optional :: status ! If absent, errors are fatal
! end subroutine regcomp
!
! Execute a compiled regex against a string
! function regexec(this,string,matches,flags,status) result(match)
! logical :: match ! .TRUE. if the pattern matched
! type(regex_type), intent(in) :: this ! regex object
! character(len=*), intent(in) :: string ! target string
! character(len=*), intent(in), &
! optional :: flags ! flag characters (for partial lines):
! ! b = no beginning-of-line (REG_NOTBOL)
! ! e = no end-of-line (REG_NOTEOL)
! integer, intent(out), optional :: matches(:,:) ! match locations,
! ! dimension(2,nmatches)
! integer, intent(out), optional :: status ! If absent, errors are fatal
! end function
!
! Get the string message for a status error value
! subroutine regerror(this,errcode,errmsg,errmsg_len)
! type(regex_type), intent(in) :: this
! integer, intent(in) :: errcode
! character, intent(out) :: errmsg
! integer, intent(out) :: errmsg_len
! errmsg_len = C_regerror(int(errcode,C_int), this%preg, &
! errmsg, int(len(errmsg),C_size_t))
! end subroutine regerror
!
! Release
! subroutine regfree(this)
! type(regex_type), intent(inout) :: this
! end subroutine regfree
!-------------------------------------------------------------------
! TODO:
! * More documentation.
! * Implement allocatable-length strings when commonly available.
! * Maybe store the matches array inside the regex_type structure?
!-------------------------------------------------------------------
use ISO_C_Binding, only: C_ptr, C_int, C_size_t, C_char, &
C_NULL_char, C_NULL_ptr
use ISO_Fortran_Env, only: ERROR_UNIT
! Fortran regex structure holds a pointer to an opaque C structure
type regex_type
type(C_ptr) :: preg
end type regex_type
interface
subroutine C_regalloc(preg_return) &
bind(C,name="C_regalloc")
import
type(C_ptr), intent(out) :: preg_return
end subroutine C_regalloc
subroutine C_regcomp(preg,pattern,flags,status) &
bind(C,name="C_regcomp")
import
type(C_ptr), intent(in), value :: preg
character(len=1,kind=C_char), intent(in) :: pattern(*)
character(len=1,kind=C_char), intent(in) :: flags(*)
integer(C_int), intent(inout) :: status
end subroutine C_regcomp
subroutine C_regexec(preg,string,nmatch,matches,flags,status) &
bind(C,name="C_regexec")
import
type(C_ptr), intent(in), value :: preg
character(len=1,kind=C_char), intent(in) :: string(*)
integer(C_int), intent(in), value :: nmatch
integer(C_int), intent(out) :: matches(2,nmatch)
character(len=1,kind=C_char), intent(in) :: flags(*)
integer(C_int), intent(out) :: status
end subroutine C_regexec
function C_regerror(errcode, preg, errbuf, errbuf_size) &
result(regerror) bind(C,name="regerror")
import
integer(C_size_t) :: regerror
integer(C_int), value :: errcode
type(C_ptr), intent(in), value :: preg
character(len=1,kind=C_char), intent(out) :: errbuf
integer(C_size_t), value :: errbuf_size
end function C_regerror
subroutine C_regfree(preg) bind(C,name="regfree")
import
type(C_ptr), intent(in), value :: preg
end subroutine C_regfree
end interface
contains
subroutine regcomp(this,pattern,flags,status)
type(regex_type), intent(out) :: this
character(len=*), intent(in) :: pattern
character(len=*), intent(in), optional :: flags
integer, intent(out), optional :: status
! local
integer(C_int) :: status_
character(len=10,kind=C_char) :: flags_
! begin
flags_=' '
if (present(flags)) flags_=flags
this%preg = C_NULL_ptr
call C_regalloc(this%preg)
call C_regcomp(this%preg, trim(pattern)//C_NULL_char, &
trim(flags)//C_NULL_char, status_)
if (present(status)) then
status=status_
else if (status_/=0) then
stop 'Regex runtime error: regcomp failed.'
end if
end subroutine regcomp
logical function regexec(this,string,matches,flags,status) &
result(match)
type(regex_type), intent(in) :: this
character(len=*), intent(in) :: string
character(len=*), intent(in), optional :: flags
integer, intent(out), optional :: matches(:,:)
integer, intent(out), optional :: status
! local
integer(C_int) :: status_, matches_(2,1)
character(len=10,kind=C_char) :: flags_
! begin
flags_=' '
if (present(flags)) flags_=flags
write(*,*) 'calling C, nmatches=',nmatches
if (present(matches)) then
call C_regexec(this%preg, trim(string)//C_NULL_char, &
size(matches,2),matches, &
trim(flags_)//C_NULL_char, status_)
else
call C_regexec(this%preg, trim(string)//C_NULL_char, &
int(0,C_int),matches_, &
trim(flags_)//C_NULL_char, status_)
end if
match = status_==0
if (present(status)) then
status=status_
else if (status_/=0.and.status_/=1) then
stop 'Regex runtime error: regexec failed.'
end if
end function regexec
function regmatch(match,string,matches)
integer, intent(in) :: match, matches(2,*)
character(len=*), intent(in) :: string
character(len=matches(2,match)-matches(1,match)) :: regmatch
regmatch = string(matches(1,match)+1:matches(2,match))
end function regmatch
subroutine regerror(this,errcode,errmsg,errmsg_len)
type(regex_type), intent(in) :: this
integer, intent(in) :: errcode
character, intent(out) :: errmsg
integer, intent(out) :: errmsg_len
errmsg_len = C_regerror(int(errcode,C_int), this%preg, &
errmsg, int(len(errmsg),C_size_t))
end subroutine regerror
subroutine regfree(this)
type(regex_type), intent(inout) :: this
call C_regfree(this%preg)
this%preg = C_NULL_ptr
end subroutine regfree
end module regex_module
#include <sys/types.h>
#include <regex.h>
#include <string.h>
#include <stdlib.h>
void C_regalloc(regex_t **preg_return) {
*preg_return = malloc(sizeof(**preg_return));
}
/* pattern must be NUL terminated. */
void C_regcomp(regex_t *preg, const char *pattern,
const char *flags, int *status_return) {
int i, cflags=0;
for (i=0;flags[i];i++) {
switch (flags[i]) {
case 'i': cflags |= REG_ICASE; break;
case 'm': cflags |= REG_NEWLINE; break;
case 'x': cflags |= REG_EXTENDED; break;
case 'n': cflags |= REG_NOSUB; break;
case ' ': break;
default: *status_return=-2; return;
}
}
*status_return = regcomp(preg,pattern,cflags);
}
void C_regexec(const regex_t *preg, const char *string, int nmatch,
int matches[nmatch][2], const char *flags,
int *status_return) {
int i, eflags=0;
regmatch_t *pmatch;
for (i=0;flags[i];i++) {
switch (flags[i]) {
case 'b': eflags |= REG_NOTBOL; break;
case 'e': eflags |= REG_NOTEOL; break;
case ' ': break;
default: *status_return=-2; return;
}
}
if (nmatch>0 && sizeof(pmatch->rm_so)!=sizeof(matches[0][0])) {
pmatch = malloc(sizeof(regmatch_t)*nmatch);
*status_return = regexec(preg,string,nmatch,pmatch,eflags);
for (i=0;i<nmatch;i++) {
matches[i][0]=pmatch[i].rm_so;
matches[i][1]=pmatch[i].rm_eo;
}
free(pmatch);
} else {
*status_return = regexec(preg,string,nmatch,(regmatch_t*)&(matches[0][0]),eflags);
}
}
A simple example program
program test_program
use regex_module
logical match
integer status, matches(2,1)
type(regex_type) :: regex
call regcomp(regex,"\(a..\)")
match=regexec(regex,"what the?",matches)
write(*,*) 'match=',match,', status=',status
write(*,*) 'match="',regmatch(1,"what the?",matches),'"'
call regfree(regex)
end program test_program
Hello!, I am new to this Fortran Wiki, I do not know how to post a comment so I am editing the page. My apologies if this messes up your great work. I did small modification which I think it is an improvement. I hope it helps.
#include <sys/types.h>
#include <regex.h>
#include <string.h>
#include <stdlib.h>
void C_regalloc(regex_t **preg_return) {
*preg_return = malloc(sizeof(**preg_return));
}
/* pattern must be NUL terminated. */
void C_regcomp(regex_t *preg, const char *pattern,
const char *flags, int *status_return) {
int i, cflags=0;
for (i=0;flags[i];i++) {
switch (flags[i]) {
case 'i': cflags |= REG_ICASE; break;
case 'm': cflags |= REG_NEWLINE; break;
case 'x': cflags |= REG_EXTENDED; break;
case 'n': cflags |= REG_NOSUB; break;
case ' ': break;
default: *status_return=-2; return;
}
}
*status_return = regcomp(preg,pattern,cflags);
}
void C_regexec(const regex_t *preg, const char *string, int nmatch,
int matches[nmatch][2], const char *flags,
int *status_return) {
int i, eflags=0;
int j=0;
const char * p = string;
regmatch_t *pmatch;
int start;
int finish;
for (i=0;flags[i];i++) {
switch (flags[i]) {
case 'b': eflags |= REG_NOTBOL; break;
case 'e': eflags |= REG_NOTEOL; break;
case ' ': break;
default: *status_return=-2; return;
}
}
// Added by Trurl The Constructor
// Elkin Arroyo
pmatch = malloc(sizeof(regmatch_t)*nmatch);
while(1 && j<=nmatch) {
int no_match;
*status_return = regexec(preg,p,nmatch,pmatch,eflags);
if (status_return[0]) {
break;
}
if (pmatch[0].rm_so == -1) {
break;
}
start = pmatch[0].rm_so + (p - string);
finish = pmatch[0].rm_eo + (p - string);
matches[j][0]=start;
matches[j][1]=finish;
p += pmatch[0].rm_eo;
j=j+1;
}
free(pmatch);
}
This is my modified simple test program
program test_program
use regex_module
logical match
integer nmatch
integer status, matches(2,10)
type(regex_type) :: regex
nmatch=10
call regcomp(regex,"([0-9\.\-\*\/]+)+",'xm')
match=regexec(regex,"30*0 250*1 5 6 7",matches)
DO i=1,nmatch
write(*,*) 'match="',regmatch(i,"30*0 250*1 5 6 7",matches),'"'
ENDDO
call regfree(regex)
end program test_program
This is the results of the program once it ran
match="30*0"
match="250*1"
match="5"
match="6"
match="7"
match=""
match=""
match=""
match=""
match=""
M.M.: This is what I was looking for and tried it out and discovered slight problems on some test and tried to fix it. I like to contribute with the revised sources:
regexp_module: init of matches is included
regex.c: iteration to find more than 1 matches is cleaned up
test_program: allows for input of rep and text to make test more flexible…
module regex_module
!-------------------------------------------------------------------
! Fortran interface to POSIX regex, using ISO_C_BINDING.
!
! Regex is defined as an API using C headers. It does not define the
! exact value of flag tokens, just the names. It also uses an opaque
! data structure and a declared numeric type for the match array.
! Therefore, the code must either be generated for each target
! platform, or it use wrapper functions written in C.
!
! Fortran wrapper functions are also required to present a normal
! Fortran API, ant not require C conversions by the caller.
!
! The interface here is not strictly correct, because it does not
! explicitly convert Fortran strings to the C character kind.
! Fortran only supports conversion of string kinds by assignment,
! or by a rather slow internal WRITE. For now, the easiest approach
! is to assume that C and Fortran default character kinds are the
! same. This is generally true, but UTF-8 strings are likely to
! cause problems.
!-------------------------------------------------------------------
! API:
!
! Compile a regex into a regex object
! subroutine regcomp(this,pattern,flags,status)
! type(regex_type), intent(out) :: this ! new regex object
! character(len=*), intent(in) :: pattern ! regex pattern string
! character(len=*), intent(in), &
! optional :: flags ! flag characters:
! ! x = extended regex (REG_EXTENDED)
! ! m = multi-line (REG_NEWLINE)
! ! i = case-insensitive (REG_ICASE)
! ! n = no MATCH required (REG_NOSUB)
! integer, intent(out), optional :: status ! If absent, errors are fatal
! end subroutine regcomp
!
! Execute a compiled regex against a string
! function regexec(this,string,matches,flags,status) result(match)
! logical :: match ! .TRUE. if the pattern matched
! type(regex_type), intent(in) :: this ! regex object
! character(len=*), intent(in) :: string ! target string
! character(len=*), intent(in), &
! optional :: flags ! flag characters (for partial lines):
! ! b = no beginning-of-line (REG_NOTBOL)
! ! e = no end-of-line (REG_NOTEOL)
! integer, intent(out), optional :: matches(:,:) ! match locations,
! ! dimension(2,nmatches)
! integer, intent(out), optional :: status ! If absent, errors are fatal
! end function
!
! Get the string message for a status error value
! subroutine regerror(this,errcode,errmsg,errmsg_len)
! type(regex_type), intent(in) :: this
! integer, intent(in) :: errcode
! character, intent(out) :: errmsg
! integer, intent(out) :: errmsg_len
! errmsg_len = C_regerror(int(errcode,C_int), this%preg, &
! errmsg, int(len(errmsg),C_size_t))
! end subroutine regerror
!
! Release
! subroutine regfree(this)
! type(regex_type), intent(inout) :: this
! end subroutine regfree
!-------------------------------------------------------------------
! TODO:
! * More documentation.
! * Implement allocatable-length strings when commonly available.
! * Maybe store the matches array inside the regex_type structure?
!-------------------------------------------------------------------
use ISO_C_Binding, only: C_ptr, C_int, C_size_t, C_char, &
C_NULL_char, C_NULL_ptr
use ISO_Fortran_Env, only: ERROR_UNIT
integer, parameter :: NO_MATCH = -1
! Fortran regex structure holds a pointer to an opaque C structure
type regex_type
type(C_ptr) :: preg
end type regex_type
interface
subroutine C_regalloc(preg_return) &
bind(C,name="C_regalloc")
import
type(C_ptr), intent(out) :: preg_return
end subroutine C_regalloc
subroutine C_regcomp(preg,pattern,flags,status) &
bind(C,name="C_regcomp")
import
type(C_ptr), intent(in), value :: preg
character(len=1,kind=C_char), intent(in) :: pattern(*)
character(len=1,kind=C_char), intent(in) :: flags(*)
integer(C_int), intent(inout) :: status
end subroutine C_regcomp
subroutine C_regexec(preg,string,nmatch,matches,flags,status) &
bind(C,name="C_regexec")
import
type(C_ptr), intent(in), value :: preg
character(len=1,kind=C_char), intent(in) :: string(*)
integer(C_int), intent(in), value :: nmatch
integer(C_int), intent(out) :: matches(2,nmatch)
character(len=1,kind=C_char), intent(in) :: flags(*)
integer(C_int), intent(out) :: status
end subroutine C_regexec
function C_regerror(errcode, preg, errbuf, errbuf_size) &
result(regerror) bind(C,name="regerror")
import
integer(C_size_t) :: regerror
integer(C_int), value :: errcode
type(C_ptr), intent(in), value :: preg
character(len=1,kind=C_char), intent(out) :: errbuf
integer(C_size_t), value :: errbuf_size
end function C_regerror
subroutine C_regfree(preg) bind(C,name="regfree")
import
type(C_ptr), intent(in), value :: preg
end subroutine C_regfree
end interface
contains
subroutine regcomp(this,pattern,flags,status)
type(regex_type), intent(out) :: this
character(len=*), intent(in) :: pattern
character(len=*), intent(in), optional :: flags
integer, intent(out), optional :: status
! local
integer(C_int) :: status_
character(len=10,kind=C_char) :: flags_
! begin
flags_=' '
if (present(flags)) flags_=flags
this%preg = C_NULL_ptr
call C_regalloc(this%preg)
call C_regcomp(this%preg, trim(pattern)//C_NULL_char, &
trim(flags)//C_NULL_char, status_)
if (present(status)) then
status=status_
else if (status_/=0) then
stop 'Regex runtime error: regcomp failed.'
end if
end subroutine regcomp
logical function regexec(this,string,matches,flags,status) &
result(match)
type(regex_type), intent(in) :: this
character(len=*), intent(in) :: string
character(len=*), intent(in), optional :: flags
integer, intent(out), optional :: matches(:,:)
integer, intent(out), optional :: status
! local
integer(C_int) :: status_, matches_(2,1)
character(len=10,kind=C_char) :: flags_
! begin
matches = NO_MATCH !! m.m. added to allow for the extension nmatch > 1
flags_=' '
if (present(flags)) flags_=flags
! write(*,*) 'calling C, nmatches=',size(matches,2)
if (present(matches)) then
call C_regexec(this%preg, trim(string)//C_NULL_char, &
size(matches,2),matches, &
trim(flags_)//C_NULL_char, status_)
else
call C_regexec(this%preg, trim(string)//C_NULL_char, &
int(0,C_int),matches_, &
trim(flags_)//C_NULL_char, status_)
end if
match = status_==0
if (present(status)) then
status=status_
else if (status_/=0.and.status_/=1) then
stop 'Regex runtime error: regexec failed.'
end if
end function regexec
function regmatch(match,string,matches)
integer, intent(in) :: match, matches(2,*)
character(len=*), intent(in) :: string
character(len=matches(2,match)-matches(1,match)) :: regmatch
regmatch = string(matches(1,match)+1:matches(2,match))
end function regmatch
subroutine regerror(this,errcode,errmsg,errmsg_len)
type(regex_type), intent(in) :: this
integer, intent(in) :: errcode
character, intent(out) :: errmsg
integer, intent(out) :: errmsg_len
errmsg_len = C_regerror(int(errcode,C_int), this%preg, &
errmsg, int(len(errmsg),C_size_t))
end subroutine regerror
subroutine regfree(this)
type(regex_type), intent(inout) :: this
call C_regfree(this%preg)
this%preg = C_NULL_ptr
end subroutine regfree
end module regex_module
#include <sys/types.h>
#include <regex.h>
#include <string.h>
#include <stdlib.h>
void C_regalloc(regex_t **preg_return) {
*preg_return = malloc(sizeof(**preg_return));
}
/* pattern must be NUL terminated. */
void C_regcomp(regex_t *preg, const char *pattern,
const char *flags, int *status_return) {
int i, cflags=0;
for (i=0;flags[i];i++) {
switch (flags[i]) {
case 'i': cflags |= REG_ICASE; break;
case 'm': cflags |= REG_NEWLINE; break;
case 'x': cflags |= REG_EXTENDED; break;
case 'n': cflags |= REG_NOSUB; break;
case ' ': break;
default: *status_return=-2; return;
}
}
*status_return = regcomp(preg,pattern,cflags);
}
void C_regexec(const regex_t *preg, const char *string, int nmatch,
int matches[nmatch][2], const char *flags,
int *status_return) {
int i, eflags=0;
int j=0;
const char * p = string;
regmatch_t *pmatch;
int start;
int finish;
for (i=0;flags[i];i++) {
switch (flags[i]) {
case 'b': eflags |= REG_NOTBOL; break;
case 'e': eflags |= REG_NOTEOL; break;
case ' ': break;
default: *status_return=-2; return;
}
}
// Added by Trurl The Constructor
// Elkin Arroyo
pmatch = malloc(sizeof(regmatch_t)); // m.m. modified
for(j=0;j<nmatch;j++) { // m.m. modified
*status_return = regexec(preg,p,1,pmatch,eflags); // m.m. modified
if (status_return[0] == REG_NOMATCH) { // m.m. modified
break;
}
// m.m some lines removed
start = pmatch[0].rm_so + (p - string);
finish = pmatch[0].rm_eo + (p - string);
matches[j][0]=start;
matches[j][1]=finish;
p += pmatch[0].rm_eo;
}
free(pmatch);
}
program test_program2 ! m.m. modifed
use regex_module
implicit none
integer, parameter :: nmatch = 10
integer, parameter :: linelength = 200
logical :: match
integer :: i, istatus, matches(2,nmatch)
type(regex_type) :: regex
character(len=linelength) :: inlin, regc, found
write(*,'(a)',advance="no")"regexp: "
read (*,'(a)',end=999 ) regc
DO
write(*,'(a)',advance="no") "text: "
read( *,'(a)',end=999 ) inlin
call regcomp(regex,trim(regc),'xm') ! trim --> blanks at the end must be specified as [ ]
match = regexec(regex,trim(inlin),matches,status=istatus)
FORALL(i=1:len(found))found(i:i)="-"
DO i=1,nmatch
if(matches(1,i) == NO_MATCH) exit
write(*,*) 'match=',matches(:,i),'"',regmatch(i,trim(inlin),matches),'"'
found(matches(1,i)+1:matches(2,i)) = regmatch(i,trim(inlin),matches)
ENDDO
write(*,*)
write(*,'(a)')trim(inlin)
write(*,'(a)')trim(found(1:len_trim(inlin)))
ENDDO
call regfree(regex)
999 stop
end program test_program2
cafut A single-file object-oriented unit testing utility for Coarray Fortran.
Fortran Unit Test Framework (FRUIT)
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
Fortuno User friendly, flexible and extensible object-oriented Fortran unit testing framework for testing serial, MPI-parallelized and coarray-parallelized applications .
The table below documents features from the Fortran 2003 standard that are supported by several available compilers. A similar table is also availble for Fortran 2008 status and Fortran 2018 status.
Note that the versions described below may be out of date and that the development versions of some compilers support many support additional features. Please check with the compiler vendor for the most up-to-date information on support for specific features. See Compiler Support for Modern Fortran for a summary, caveats, and links to compiler-specific status pages and see Fortran 2003 status discussion for a discussion of the merits of maintaining this page.
The table is based on data from a series of articles in the ACM Fortran Forum by Ian D. Chivers and Jane Sleightholme. For further details of the features listed, see the following report by John Reid: ftp://ftp.nag.co.uk/sc22wg5/N1601-N1650/N1648.pdf.
Legend:
Fortran 2003 features | Absoft | Cray | g95 | GNU | HP | IBM | Intel | NAG | Oracle | PathScale | PGI |
---|---|---|---|---|---|---|---|---|---|---|---|
Compiler Version Number | 14 | 8.4.0 | 13.x | 15.1.5 | 19.0 | 6.2 | 8.8 | 6.0 | 18.10 | ||
ISO TR 15580 IEEE Arithmetic | Y | Y | P | Y | Y | Y | Y | Y | Y | Y | Y |
ISO TR 15581 Allocatable Enhancements | Y | Y | Y | Y | Y | Y | Y | Y | Y (33) | Y | Y |
Data enhancements and object orientation | Absoft | Cray | g95 | GNU | HP | IBM | Intel | NAG | Oracle | PathScale | PGI |
Parameterized derived types | N | Y | N | Y (36) | N | Y | Y | Y | Y | N | Y |
Procedure pointers | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
Finalization | N | Y | N | Y | N | Y | Y | Y | Y | N | Y |
Procedures bound by name to a type | N | Y | N | Y | N | Y | Y | Y | Y | N | Y |
The PASS attribute | Y | Y | N | Y | Y | Y | Y | Y | Y | N | Y |
Procedures bound to a type as operators | N | Y | N | Y | N | Y | Y | Y | Y | N | Y |
Type extension | N | Y | N | Y | N | Y | Y | Y | Y | Y | Y |
Overriding a type-bound procedure | N | Y | N | Y | N | Y | Y | Y | Y | N | Y |
Enumerations | Y | Y | Y | Y | N | Y | Y | Y | Y | N | Y |
ASSOCIATE construct | N | Y | N | Y | N | Y | Y | Y | N | N | Y |
Polymorphic entities | N | Y | N | Y | N | Y | Y | Y | Y | N | Y |
SELECT TYPE construct | N | Y | N | Y | N | Y | Y | Y | Y | N | Y |
Deferred bindings and abstract types | Y | Y | N | Y | N | Y | Y | Y | Y | N | Y |
Allocatable scalars (12) | ? | Y | P | Y | N | Y | Y | Y | Y | N | Y |
Allocatable character length (12) | ? | Y | N | Y | N | Y | Y | Y | Y | N | Y |
Miscellaneous enhancements | Absoft | Cray | g95 | GNU | HP | IBM | Intel | NAG | Oracle | PathScale | PGI |
Structure constructor changes | Y | Y | Y | Y | N | Y | Y | Y | Y | Y | Y |
Generic procedure interfaces with the same name as a type (32) | ? | Y | ? | Y | ? | Y | Y | Y | Y | N | Y |
The allocate statement | P | Y | P | Y | N | Y | Y | Y | Y | Y | Y |
Assignment to an allocatable array | N | Y (3) | N | Y | Y | Y | Y (2) | Y | Y | Y | Y (3) |
Transferring an allocation | N | Y | N | Y | N | Y | Y | Y | Y | Y | Y |
More control of access from a module | Y | Y | N | Y | N | Y | Y | Y | Y | N | Y |
Renaming operators on the USE statement | Y | Y | Y | Y | N | Y | Y | Y | Y | N | Y |
Pointer assignment | Y | Y | Y | Y | N | Y | Y | Y | Y | Y | Y |
Pointer INTENT | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
The VOLATILE attribute | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
The IMPORT statement | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
Intrinsic modules | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
Access to the computing environment | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
Support for international character sets | P (19) | P (19) | Y | Y | N | P | P (19) | Y | N | N | P (19) |
Lengths of names and statements | Y | Y | ? | Y | Y | Y | Y | Y | Y | Y | Y |
Binary, octal and hex constants | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
Array constructor syntax | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
Specification and initialization expressions | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
Complex constants | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
Changes to intrinsic functions | Y | Y | Y | Y | Y | Y | Y | Y | Y | ? | Y |
Controlling IEEE underflow | Y | Y | N | Y | Y | Y | Y | Y | Y | Y | Y |
Another IEEE class value | Y | Y | N | Y | Y | Y | Y | Y | Y | Y | Y |
I/O enhancements | Absoft | Cray | g95 | GNU | HP | IBM | Intel | NAG | Oracle | PathScale | PGI |
Derived type I/O | N | Y | N | Y | N | Y | Y | Y | N | Y | Y |
Asynchronous I/O | Y | Y | Y | Y | N | Y | Y | Y | Y (10) | Y | Y |
FLUSH statement | Y | Y | Y | Y | N | Y | Y | Y | Y | Y | Y |
IOMSG= specifier | Y | Y | Y | Y | Y | Y | Y | Y | Y | N | Y |
Stream access input/output | N | Y | Y | Y | N | Y | Y | Y | Y | Y | Y |
ROUND= specifier | Y | Y | P | Y | Y | Y | Y (20) | Y | Y | N | Y |
DECIMAL= specifier | Y | Y | Y | Y | Y | Y | Y (22) | Y | Y | N | Y |
SIGN= specifier | Y | Y | Y | Y | Y | Y | Y (21) | Y | Y | N | Y |
Kind type parameters of integer specifiers | N | Y | ? | Y | N | Y | Y | Y | Y | N | Y |
Recursive input/output | N | Y | Y | Y | N | Y | Y | Y | Y | Y | Y |
Intrinsic function for newline character | N | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
Input and output of IEEE exceptional values | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
Comma after a P edit descriptor | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
Interoperability with C | Absoft | Cray | g95 | GNU | HP | IBM | Intel | NAG | Oracle | PathScale | PGI |
Interoperability of intrinsic types | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
Interoperability with C pointers | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
Interoperability of derived types | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
Interoperability of variables | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
Interoperability of procedures | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
Interoperability of global data | Y | Y | Y | Y | Y | Y | Y | Y | Y | N | Y |
Footnotes:
(2) Optional under flag;
(3) Can be disabled by an optional flag;
(9) kind=
of maxloc, minloc, shape missing;
(10) implemented as synchronous I/O;
(18) move_alloc;
(19) selected_char_kind only;
(20) plus RC, RD, RN, RP, RU, RZ;
(21) plus BLANK=, DELIM=, PAD=, SIZE=;
(22) plus DC,DP;
(32) These user-defined functions are not to be confused with a type’s structure constructor, which is generated automatically. Structure constructors have also changed in Fortran 2003, e.g. by treating components with default initialization as optional arguments.
(33) Implemented as specified in the Fortran 2003 standard, not as in ISO TR 15581.
(34) Kind type parameters for derived types only.
Changes July 2019:
Changes April 2019:
Changes between December 2015 and August 2016:
Updated table based on latest results from the August 2016 Fortran Forum article (Revision 19).
Updated table based on latest results from the April 2016 Fortran Forum article (Revision 18).
Changes between April 2011 and December 2015:
Changes November 2014:
Changes between December 2010 and April 2011:
Cray supports ISO TR 15580 IEEE arithmetic, renaming operators on the USE statement, controlling IEEE underflow, another IEEE class value, and the ROUND= specifier.
GNU supports allocatable character length and partially supports assignment to an allocatable array.
HP supports ISO TR 15580 IEEE arithmetic and lengths of names
and statements.
IBM supports more control of access from a module, renaming operators on the USE statement, and lengths of names and statements.
Intel added finalization, pointer assignment and other items.
Added new columns for Absoft and PGI compilers.
No changes between August 2010 and December 2010.
Changes between April 2010 and August 2010:
Changes between December 2009 and April 2010:
“Compiler Support for the Fortran 2003 and 2008 Standards” is a series of articles in the ACM Fortran Forum by Ian D. Chivers and Jane Sleightholme. Links to previous revisions are given below:
Fortran Forum 35(1), 9-29, April 2016 (doi:10.1145/2922512.2922513)
Fortran Forum 34(4), 7-27, December 2015 (doi:10.1145/2851087.2851088)
Fortran Forum 32(2), 14-26, August 2013 (doi:10.1145/2502932.2502934)
Fortran Forum 30(1), 16-24, April 2011 (doi:10.1145/1961363.1961365)
Fortran Forum 29(3), 26-34, December 2010
Fortran Forum 29(2), 28-35, August 2010 (doi:10.1145/1837137.1837139)
Fortran Forum 29(1), 29-34, April 2010 (doi:10.1145/1753166.1753169)
Fortran Forum 28(3), 32-37, December 2009
Fortran Forum 28(2), 15-20, August 2009 (doi:10.1145/1570522.1570525)
Fortran Forum 28(1), 26-28, April 2009 (doi:10.1145/1520752.1520755)
Fortran Forum 26(3), 20-22, December 2007 (doi:10.1145/1330585.1330587)
Fortran Forum 26(2), Front matter, August 2007 (frontmatter.pdf)
Fortran Forum 26(1), 7-9, April 2007 (doi:10.1145/1243413.1243414)
#bbddbb
#ffaaaa
#ffffdd
#eeeeee
After modifying the contents of cells in the table, the following Emacs lisp function can be used to synchronize the cell colors with the cell contents:
(defun fortranwiki-update-status-table ()
(interactive)
(save-excursion
(beginning-of-buffer)
(replace-regexp "#[0-9a-f]+\">Y" "#bbddbb\">Y")
(beginning-of-buffer)
(replace-regexp "#[0-9a-f]+\">N" "#ffaaaa\">N")
(beginning-of-buffer)
(replace-regexp "#[0-9a-f]+\">P" "#ffffdd\">P")
(beginning-of-buffer)
(replace-regexp "#[0-9a-f]+\">\\?" "#eeeeee\">?")))
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.
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?
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
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
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 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
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
Portability and Power with the F Programming Language(1997) by Walt Brainerd, 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