pyFAI icon indicating copy to clipboard operation
pyFAI copied to clipboard

Investigate the stable C-Python API

Open kif opened this issue 2 years ago • 5 comments

https://docs.python.org/3/c-api/stable.html

Rational: build once and deploy on any version of python (within a certain range).

--> likely to save a lot of energy & time in recompilation of pyFAI during continuous integration process (also with BoB).

kif avatar Sep 20 '23 07:09 kif

some more reading: https://github.com/cython/cython/issues/2542

kif avatar Sep 20 '23 07:09 kif

even more: https://peps.python.org/pep-0652/

kif avatar Sep 20 '23 07:09 kif

TODO: Measure the amount of energy needed to build pyFAI using setuptools and meson:

  • setuptool t = XX s, E= XX J
  • meson t = XX s, E= XX J

Reference computer:

Also check the speed of most extensions since this path is likely to show slow-down in the order of 10%

kif avatar Sep 20 '23 07:09 kif

Computer: macbook13 late2013 running on battery sudo perf stat -e power/energy-cores/,power/energy-ram/,power/energy-gpu/,power/energy-pkg/ /home/kieffer/.venv/py311/bin/python -m build -n

Performance counter stats for 'system wide':

          4,107.37 Joules power/energy-cores/                                                
            502.41 Joules power/energy-ram/                                                  
             22.44 Joules power/energy-gpu/                                                  
          5,097.11 Joules power/energy-pkg/                                                  

     205.446454898 seconds time elapsed

Using the former build tool: sudo perf stat -e power/energy-cores/,power/energy-ram/,power/energy-gpu/,power/energy-pkg/ /home/kieffer/.venv/py311/bin/python setup.py bdist_wheel

 Performance counter stats for 'system wide':

          5,275.53 Joules power/energy-cores/                                                
            766.19 Joules power/energy-ram/                                                  
             63.12 Joules power/energy-gpu/                                                  
          7,395.96 Joules power/energy-pkg/                                                  

     432.963893802 seconds time elapsed

kif avatar Sep 20 '23 08:09 kif

Computer: Epyc 7262 (8 core) meson:

 Performance counter stats for 'system wide':

          3 510,61 Joules power/energy-pkg/                                                  

      43,107392225 seconds time elapsed

setup.py:

 Performance counter stats for 'system wide':

         19 852,24 Joules power/energy-pkg/                                                  

     359,812061364 seconds time elapsed

kif avatar Sep 20 '23 08:09 kif