camfort: CamFort - Cambridge Fortran infrastructure

[ apache, language, library, program ] [ Propose Tags ]

CamFort is a tool for the analysis, transformation, and extension of Fortran code base.

[Skip to Readme]
Versions 0.62, 0.615, 0.700, 0.800, 0.802, 0.804, 0.900, 0.901, 0.902, 0.903, 0.904, 0.905 (info)
Dependencies array (>=0.4), base (<5), comonad (>=3), containers (>=, directory (>=1.2), fclabels (>=2), generic-deriving (>=1.5.5), haskell-src (>=1.0.1), hmatrix (>=0.15), language-fortran (>=0.5), matrix (>=0.2.2), mtl (>=2.1), syb (>=0.4), syz (>=0.2), template-haskell (>=2.4), text (>=, transformers (>=0.4), uniplate (>=1.6.10), vector (>=0.1) [details]
License Apache-2.0
Copyright 2012-2016 University of Cambridge
Author Dominic Orchard, Matthew Danish, Mistral Contrastin, Andrew Rice, Oleg Oshmyan
Category Language, tools
Source repo head: git clone
Uploaded by DominicOrchard at Fri Mar 11 00:54:05 UTC 2016
Distributions NixOS:0.905
Executables camfort
Downloads 2288 total (56 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-03-11 [all 1 reports]
Hackage Matrix CI




Maintainer's Corner

For package maintainers and hackage trustees

Readme for camfort-0.700

[back to package description]


Installation & Building

Using Stack

We recommend using Stack ( to build Camfort.

  1. Install Stack following the instructions here:
  2. Checkout the latest version of language-fortran
  3. Checkout the latest version of camfort
  4. Build using Stack
git clone
git clone
cd camfort
stack build
stack install      # install binary
stack exec camfort # run camfort

Please note that at this time we have been unable to compile Camfort on Windows due to a problem with the hmatrix dependency.

Using Cabal

Cabal does not automatically install the build tools. If you wonder why checkout haskell/cabal#220.

$ cabal install alex happy

Install the native packages needed for hmatrix dependency

sudo apt-get install libgsl0-dev liblapack-dev libatlas-base-dev

For general usage

$ cabal install camfort

For development

$ cabal sandbox init
$ cabal install --only-dependencies
$ cabal exec bash

This spawns a new shell with only the packages within the sandbox available.

$ ghc Main.hs -o camfort

This generates a camfort executable in the root directory using only the packages in the sandbox and none of ~/.cabal or system Haskell packages.


CamFort - Cambridge Fortran Infrastructure.
Usage: camfort <MODE> <INPUT> [OUTPUT] [OPTIONS...]
Refactor functions:
    common           [common block elimination]
    commonArg        [common block elimination (to parameter passing)]
    equivalence      [equivalence elimination]
    dataType         [derived data type introduction]
    dead             [dead-code elimination]
    units            [unit-of-measure inference]
    removeUnits      [unit-of-measure removal]

Analysis functions:
    asts             [blank analysis, outputs analysis files with AST information]
    lva              [live-variable analysis]
    loops            [loop information]
    count            [count variable declarations]
    criticalUnits    [calculate the critical variables for units-of-measure inference]
    ast              [print the raw AST -- for development purposes]

  -v, -?    --version            show version number
  -e FILES  --exclude=FILES      files to exclude (comma separated list, no spaces)
  -s ID     --units-solver=ID    units-of-measure solver. ID = Custom or LAPACK
  -l ID     --units-literals=ID  units-of-measure literals mode. ID = Unitless, Poly, or Mixed