NAPS - New Approaches to Programming in Science

A computational science agenda for programming language research

[download paper]


Programming languages provide an interface for developing increasingly complex models in science. However, as computer models grow more complex, it is increasingly difficult to deliver on core requirements such as verifiability, maintainability, understandability, validity, and portability.

Managing software complexity more effectively has been a focus of programming language research for many years, yet we see little adoption of new approaches in the natural sciences. Instead we see scientists continually striving to evolve their software to more complex models, or bigger data sets or novel execution architectures.

At the University of Cambridge we are running an multidisciplinary project involving computer scientists and natural scientists to understand how state-of-the-art programming language research can be leveraged for more effective programming in the sciences.

Our position paper: A computational science agenda for programming language research published at the International Conference on Computational Science, ICCS'14) outlines our research hypothesis and possible approaches:

CamFort: Automated evolution and verification of computational science models

We have been awarded a 3 year grant by the EPSRC which begins on 1st July 2015. The objectives of the grant are:

  1. Crossing the chasm: To show how programming language ideas such as inference of high-level programming patterns, advanced types and automatic test generation can be used to reduce the accidental complexity of real scientific code, and improve its evolution, maintainability, and verification.
  2. Practical adoption: To develop tools for maintaining and evolving established, long-lived code-bases. To apply these ideas without disrupting existing practices by accommodating the various incarnations of the language, and (custom) pre-processors.
  3. Closing the chasm: To provide a framework which makes it easier to transfer future programming language research in to practice in computational science.

Upgrading Fortran source code using automatic refactoring

[download paper]

[download poster]


CamFort is our refactoring tool for Fortran providing:

  • analyses for gathering data on the programming patterns common in scientific models;
  • automatic refactoring for improving the code quality of existing models.

The first part provides data to inform future language designs to better support the scientific process and to understand the limits of best-practice automatic program analysis.

The second part automatically refactors deprecated or dangerous programming patterns, with the goal of helping to meet the core quality requirements outlined above, such as maintainability. For example, our tool eliminates EQUIVALENCE and COMMON blocks. The tool also helps to expose any programming bugs arising from bad programming practices.

CamFort is currently available in a development version on GitHub and requires GHC Haskell to build.

CamFort download

Download the source for Camfort from github

Download pre-compiled binary: Linux x64.

Evolving Fortran types with inferred units-of-measure

[download paper]

Evolving Fortran types with inferred units-of-measure

Dimensional analysis is a well known technique for checking the consistency of equations involving physical quantities, constituting a kind of type system. Various type systems for dimensional analysis, and its refinement to units-of-measure, have been proposed. We designed and implemented a units-of-measure system for Fortran, provided as a preprocessor using CamFort. Our system is designed to aid adding units to existing code base: units may be polymorphic and can be inferred. When first run the tool reports the set of critical variables which should be explicitly annotated with units to get the maximum amount of unit information with the minimal number of explicit declarations.


We are working on a number of extension to the functional language Haskell for better support of computational science programming.

This is currently in an early state. Included is an automatic discretising memoizer for recursive, finite-functions (see array-memoize github project). This allows programmers to write simple recursive definitions of real-valued functions (in the style of recurrence relations) which are then compiled to high-performance, discrete array implementations.

Get in touch / collaborate

We are seeking collaborations with computational scientists and computer scientists interested in improving programming in science.

Please get in touch if you have any comments or would like to collaborate: