astropy / astropy-project

Documents and policies regarding the Astropy Project as a whole.
Creative Commons Attribution 4.0 International
36 stars 43 forks source link

Proposal: strive to be a carbon-neutral project #16

Open astrofrog opened 4 years ago

astrofrog commented 4 years ago

This is an idea that was discussed in Socorro (the 2019 Coordination Meeting) and started out from whether we want to scale back our CI builds to reduce our carbon footprint.

The suggestion we came up with is that regardless of whether or not we scale back the CI, we could consider trying to offset project specific CO2-emissions, such as for travel of project members to conferences or meetings, or also the CI itself. It would be good to figure out what kind of costs we'd be looking at, and also we would need to make sure that any carbon offsetting project we use is actually beneficial. If the costs are reasonable, we could aim to be a 'carbon-neutral open source project'!

Just an idea for discussion and investigation at this stage.

eteq commented 4 years ago

I'm in favor of this idea broadly.

To give a bit more context of the cost for CI, prompted by a suggestion from @saimn, here is a back-of-the-envelop estimate:

So we should definitely do that!

saimn commented 4 years ago

Thanks for opening this issue, I think it's an important topic with all the current discussions about global warming. When I mentioned this topic I had no idea about the carbon footprint of all the CI stuff in the cloud, so @eteq numbers are interesting. Other topics like travels are of course very important as well, and probably easier to measure.

To stay on the CI topic, what I had in mind was to find some numbers about the carbon footprint of the cloud providers. I had a look, and found nothing too specific yet, but this is a hot topic. Then, I wanted to find some statistics about the number of builds triggered for astropy. http://scribu.net/travis-stats/#astropy/astropy/master gives an idea (https://github.com/scribu/travis-stats). I will try to go more in detail into this.

And finally, even if astropy's footprint is probably not too high, as shown above (or if we compare to watching series on netflix :trollface: ), I think we should keep this in mind when thinking about adding new builds etc. And this relates also to the ideas of speeding up the test suite and the doc build. It is important that the tests and docs can be run easily on people's laptop, which means that these should run fast enough. For the CI runs I think we will see some improvement thanks to the switch to tox and removal of conda, but maybe we can also make some additional efforts to speedup the tests and docs themselves (though there was already various efforts in the past).

pllim commented 4 years ago

Re: tox -- It is already happening with the acceptance of APE 17. 😉

crawfordsm commented 4 years ago

If I did the calculation correctly, the carbon footprint for our flights for the Socorro coordination meeting is around 14.2 metric tonne (appropriate airport hack).

bsipocz commented 4 years ago

The number I got, including the connections, is around 20t, though I ignored the fact that a few of us combined different meetings in their trip.

eteq commented 4 years ago

Also (somewhat ironically while I was on an airplane...), I thought a bit more about the CI and @saimn's comments - I think I probably low-balled by maybe a factor of 2 or 3 because I didn't account for cooling/infrastructure costs, which another set of random web pages put at between 30 and 75% depending on where you look. But nothing I read indicated I was off by an order-of-magnitude.

That said, I think @saimn's underlying point is that we should always be considering this as at least "another" reason to keep our CI usage under control, which I'm 100% on board with. I was doing the exercise hoping to see that the offsetting cost would be feasible for us to pay as a project at our current scale, and if my estimate is right then we should figure out how to do that, since we definitely can!

eteq commented 4 years ago

CI also has the element that it's a lot easier to truly offset it via renewable energy, since I'm pretty sure a large fraction of the carbon is just from electricity (as opposed to, say, flights, where there's really no practical way to do it "renewably" as opposed to sequestration/offsets/whatever).

Cadair commented 4 years ago

Might be relevant: http://arxiver.moonhats.com/2019/12/13/the-imperative-to-reduce-carbon-emissions-in-astronomy-ima/

astrofrog commented 4 years ago

Here are some links that were sent to me on Twitter:

hamogu commented 4 years ago

Comparing the simple estimates above show that travel is about an order of magnitude more important than CI jobs. I'm totally on board with reducing CI load as much as we can, but we can have a much bigger impact by reducing travel through online participation (video streaming emits significant CO2 too, but much less than flying), choosing meeting locations that reduce total travel distance, or attaching coordination meetings to existing meetings where many participants travel already (e.g. the week after a AAS meeting).

Of course, this is a comment from someone who never attended a coordination meeting in the first place. I'd like to say that that's purely because I want to reduce the carbon footprint, but I would be lying.

pllim commented 4 years ago

There is a great benefit to meet in-person though, so 👎 on fully remote coordination meeting, but 👍 to taking steps to reduce carbon footprint of traveling.

pllim commented 4 years ago

If we all switch to Windows products, maybe will help a little? 🤷‍♀

https://blogs.microsoft.com/blog/2020/01/16/microsoft-will-be-carbon-negative-by-2030/

saimn commented 3 years ago

Probably worth mentioning here the recent Nature article series about carbon footprint in Astronomy (Observatories, HPC, meetings, and Python rant): https://www.nature.com/articles/s41550-020-01216-9

pllim commented 3 years ago

Running Python on a single CPU core of a powerful workstation has a relatively high environmental cost; instead, prefer C++ — it is faster anyway.

Hahah... Spending 100 hours trying to debug C++ also has a cost (all the coffee you drink, all the lights that are not off because you are not sleeping, etc). I am not convinced by that sentence alone.

dstansby commented 1 year ago

FWIW I've been playing around with scraping GH actions stats and combining them with info from https://www.green-algorithms.org/ to estimate CI emissions - over at sunpy I estimated ~50kg CO2 across the whole of 2022, and for the last month of astropy these are my results:

astropy_ci_co2

Code here: https://github.com/dstansby/ci-impact

pllim commented 1 year ago

@dstansby , thanks! Is this good or bad news?

taldcroft commented 1 year ago

I'd say this is good news, astropy is making a negligible contribution to CO2 emissions from what I've seen. This looks like around 200 kg/year.

The snow falling outside right now in Boston has probably cancelled enough flights to make up for the CI for every major open source project for many years.

[1] https://www.carbonindependent.org/22.html#:~:text=CO2%20emissions%3A%20101%20g%20per,CO2%20per%20passenger%20per%20hour

I'll confess that 300,000 kg of carbon coming from a single plane seems not credible since a 747-400 has a fuel capacity of 216,840 liters. But anyway a single flight generates literally tons of carbon.

dstansby commented 1 year ago

I'd agree with ☝️ - I went into looking into investigating thinking CI would have a large footprint, and came out of it thinking that it's practically at the bottom of the list of things to worry about.

hamogu commented 1 year ago

I'll confess that 300,000 kg of carbon coming from a single plane seems not credible since a 747-400 has a fuel capacity of 216,840 liters. But anyway a single flight generates literally tons of carbon.

That's per flight, not per person. 1 liter of fuel is just under 1 kg. Fuel is a hydrocarbon, and since H has a atomic weight of 1, most of the weight is actually carbon. CO2 on on the other hand has a much higher weight because of the 2 O. So, 1 liter of fuel makes ~ 3 kg of CO2. A Boston-LA flight is below the max range of a 747, so that works out.

"CO2 per passenger" is in the range of 2000-4000 kg CO2 depending on average filling factor of the plane, ticket class (business seat takes more space) etc. Often, calculators with "CO2 equivalent" which for flights is 2-3 times CO2 by weight to account for the fact that that CO2 is emitted very high in the atmosphere where is acts more strongly than at ground level.

dhomeier commented 1 year ago

I'd also take that as a rather positive (mild) surprise (had expected the impact to be moderate, but not that modest).

"CO2 per passenger" is in the range of 2000-4000 kg CO2 depending on average filling factor of the plane, ticket class (business seat takes more space) etc.

That's also the typical number I had in mind for transatlantic flights, generally a bit longer than East to West coast.

Often, calculators with "CO2 equivalent" which for flights is 2-3 times CO2 by weight to account for the fact that that CO2 is emitted very high in the atmosphere where is acts more strongly than at ground level.

I rather doubt that's a strong factor; CO2 having a life time in the atmosphere of ~centuries will fully mix long before that. I think some factors are applied to account for the additional positive or negative warming effect due to aerosol nucleation at high altitudes (which is not very well known and probably even depends on what climate zone etc. the plane moves in).

hamogu commented 1 year ago

Often, calculators with "CO2 equivalent" which for flights is 2-3 times CO2 by weight to account for the fact that that CO2 is emitted very high in the atmosphere where is acts more strongly than at ground level.

I rather doubt that's a strong factor; CO2 having a life time in the atmosphere of ~centuries will fully mix long before that. I think some factors are applied to account for the additional positive or negative warming effect due to aerosol nucleation at high altitudes (which is not very well known and probably even depends on what climate zone etc. the plane moves in).

A factor of 2-3 is currently considered best practice. See discussion here https://travel-footprint-calculator.irap.omp.eu/home.html and in particular section 2.3 of Barret (2020).

taldcroft commented 1 year ago

So, 1 liter of fuel makes ~ 3 kg of CO2. A Boston-LA flight is below the max range of a 747, so that works out.

Of course, makes sense. I didn't consider pulling in atmospheric oxygen to end up emitting more CO2 mass than the mass of the fuel.

taldcroft commented 1 year ago

But back to the actual issue here, can we close this?

pllim commented 1 year ago

can we close this?

Should we at least document this finding somewhere more official (Zenodo? website? blog?) before closing the issue?