Package wheels built for different CPUs (i.e. --march=native or avx)

12 views
Skip to first unread message

v...@viblo.se

unread,
May 2, 2024, 3:26:33 PMMay 2
to python-cffi
Hi!

I wonder if there's some examples / ideas how to (if possible) package cffi libraries compiled against specific CPU instructions?

I have a library, Pymunk, which uses the Chipmunk2D c library. I did some tests, and by compiling with -march=skylake for my CPU (an Intel skylake laptop cpu) I get a 5% performance boost under Ubuntu in WSL. I would not be surprised if there's more improvements to have by newer CPUs as well. I have also considered testing out if SIMD instructions in the Chipmunk2D library could increase performance. 

But this is all good when compiling locally. However, how can this be packaged up for Pypi/conda?

Some ideas I have:
- Let end user compile themselves, maybe add some easy option to setup to build for native?
- Do runtime detection for SSE/AVX etc and use that call then
- More options?

Thanks!
/Victor

Reply all
Reply to author
Forward
0 new messages