1/10 We need to be careful about the environmental impact of scientific computing. What about the massive use of #Python?

@numpy_team #SciPy @matplotlib @IPythonDev @ProjectJupyter @scikit_learn #skimage @astropy @numba_jit @pypyproject
2/10 We (S. Guelton, @cfbolz, @ashwinvis & I) investigate this question in a short note just published in @NatureAstronomy https://rdcu.be/ciO0J 

The title is "Reducing the ecological impact of computing through education and Python compilers".
3/10 We consider a classical problem representative of numerically intensive scientific computations, the N-body problem, with N=16,384. #AstropyPerformance

The computation of the acceleration of each particle involves a loop over all other particles.
4/10 We MEASURE both time for solution and energy consumption for ≠ implementations in ≠ languages (C++, Fortran, Julia & Python) on a https://www.grid5000.fr  cluster.

The code is here https://github.com/paugier/nbabel 
5/10 The C++ and Fortran implementations come from https://www.nbabel.org/  and have been used in another letter (Zwart, 2020, https://arxiv.org/pdf/2009.11295.pdf).

These programs could have been further optimized, but are representative of code written by many scientists.
6/10 We also considered efficient @JuliaLanguage and #Python implementations.

For Python, we used tools adapted for such problems: Python/Numpy compilers (Pythran via Transonic and Numba @numba_jit) and an efficient Python interpreter called PyPy @pypyproject.
7/10 Our figure shows the CO₂ production as a function of time to solution. For details, see https://rdcu.be/ciO0J .

The results are clear: (i) dynamic languages give very good results. (ii) It's easy to write in Python very efficient and ecologically friendly programs.
8/10 This is great news for accessibility of efficient computing and productivity of developers of scientific programs. It is also important in terms of global impact of computing given the large amount of people learning and using Python.
9/10 Our conclusions in few words: minimizing the ecological impact of scientific computing is mainly limited by human factors: time, work, knowledge and skills. Time and money should be invested in education and tooling, irrespective of the underlying language.
You can follow @pierre_augier.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: