Haverford Researchers Help Develop CodeCarbon To Address Computing Emissions

Associate Professor of Computer Science Sorelle Friedler (left) and Associate Professor of Environmental Studies Jonathan Wilson were part of a team that created CodeCarbon, an open-source tool for tracking the carbon footprints of computing projects. Photos by Patrick Montero.
Details
Associate Professor of Computer Science Sorelle Friedler and Associate Professor of Environmental Studies Jonathan Wilson are part of a team that developed the open-source software package that can help organizations track the carbon footprint of their AI projects.
The discussion of the human role of carbon dioxide emissions in climate change is so often focused on the burning of fossil fuels or deforestation. But did you know that computing has an emissions cost too? When programmers train a machine-learning algorithm, it can require multiple computers running for days, or weeks, at a time. This requires a lot of electricity. And until recently, there was no easy way to estimate and visualize the location-dependent carbon footprint of such computing work.
Haverford professors Sorelle Friedler and Jonathan Wilson are part of a team that is working to change that. They, along with Université de Montréal research institute Mila, AI and analytics team BCG GAMMA, and cloud-based machine-learning platform Comet, developed CodeCarbon, an open-source software package that can help organizations track the emissions of their computing projects. CodeCarbon can estimate the amount of carbon dioxide produced by the computing resources used to execute specific code. Armed with such information, hopefully, developers will be incentivized to optimize their code emissions.
"One important aspect of this project is that it highlights how the heterogeneity of the electrical grid can lead to very different carbon footprints for the same code package," said Wilson, an associate professor of environmental studies. "If a program is run in Montreal, for example, where the electrical grid is mostly powered by low-carbon sources like hydroelectricity, the carbon footprint will be small. If the same code package is run in Missouri, where the electrical grid is powered by coal-burning power plants, the CO₂ impact is significantly greater. Therefore, the location matters a great deal, and we hope that engineers in the AI field will take these factors into consideration when choosing which data centers, or other computational resources, to use."
Wilson and Friedler, an associate professor of computer science, began their work together as part of Friedler’s recent Mozilla grant, supporting the integration of responsible computing ideas into computer science curriculum.
“We were interested in the ways that the environmental impact of code, specifically the resulting CO₂ emissions, mirror computational complexity concerns that students learn about in these courses," said Friedler. "We worked on integrating these ideas into the curriculum, and found that a package to allow students to compute the CO ₂ emissions of their programs would be a useful contribution."
Several Haverford students have been part of this work over the past two years, including Kadan Lottick ‘20 and Silvia Susai ‘20, whose senior thesis work involved working on the carbon-emissions-computing package. Ziyao Wang ‘22 continued the development work on the package this past summer. Lottick and Susai were also co-authors on a paper, "Energy Usage Reports: Environmental Awareness as Part of Algorithmic Accountability," given at a Workshop on Tackling Climate Change with Machine Learning held in Vancouver, B.C., last December. (It was at that meeting, in fact, where Friedler and Wilson met some of the other team members on the CodeCarbon project.)
The Haverford team’s focus throughout has been the creation of an easy-to-access dashboard that CodeCarbon users can employ to learn about carbon emissions and better visualize the big picture of environmental impacts of large-scale computing efforts. “The resulting dashboard includes a map with associated energy grid mix breakdowns, so people can see how the underlying energy grid mix in a country or region contributes to carbon emissions resulting from code,” said Friedler. It also also includes equivalents, such as "miles driven," to help dashboard visitors better understand the tangible impacts of these computing emissions.
"I think it's important that students, software engineers, and computer science researchers better understand the societal impacts of their computational choices, and that includes the environmental impacts," said Friedler. "I'm glad that we had the opportunity to work with this large and amazing team to make a package that is easy to use and has a resulting dashboard that, I hope, will help to educate computer scientists about their code's carbon footprint."