  Climate change is profoundly affecting nearly all aspects of life on earth,
including human societies, economies and health. Various human activities are
responsible for significant greenhouse gas emissions, including data centres
and other sources of large-scale computation. Although many important
scientific milestones have been achieved thanks to the development of
high-performance computing, the resultant environmental impact has been
underappreciated. In this paper, we present a methodological framework to
estimate the carbon footprint of any computational task in a standardised and
reliable way, based on the processing time, type of computing cores, memory
available and the efficiency and location of the computing facility. Metrics to
interpret and contextualise greenhouse gas emissions are defined, including the
equivalent distance travelled by car or plane as well as the number of
tree-months necessary for carbon sequestration. We develop a freely available
online tool, Green Algorithms (www.green-algorithms.org), which enables a user
to estimate and report the carbon footprint of their computation. The Green
Algorithms tool easily integrates with computational processes as it requires
minimal information and does not interfere with existing code, while also
accounting for a broad range of CPUs, GPUs, cloud computing, local servers and
desktop computers. Finally, by applying Green Algorithms, we quantify the
greenhouse gas emissions of algorithms used for particle physics simulations,
weather forecasts and natural language processing. Taken together, this study
develops a simple generalisable framework and freely available tool to quantify
the carbon footprint of nearly any computation. Combined with a series of
recommendations to minimise unnecessary CO2 emissions, we hope to raise
awareness and facilitate greener computation.
