EMS-TU-Ilmenau / fastmat

A library to build up lazily evaluated expressions of linear transforms for efficient scientific computing.
https://fastmat.readthedocs.io
Apache License 2.0
24 stars 8 forks source link

Adjusted setup.py to handle Apple ARM chips #114

Closed lpossner closed 1 year ago

lpossner commented 1 year ago

The Apple clang compiler on systems with Apple ARM chips (e.g. M1 and M2) does not support the '-march' and '-mtune' compiler arguments anymore. The newer compiler argument '-mcpu' should be used. According to https://maskray.me/blog/2022-08-28-march-mcpu-mtune it is an alternative to both '-march' and '-mtune'. The setup.py script distinguishes now between Apple (Darwin) x86 and ARM64 systems and uses '-mcpu' as 'native' or 'arm', depending wether FASTMAT_GENERIC is set or not. With this configuration, no extra environment variable should be needed.

ChristophWWagner commented 1 year ago

Thank you again for your feature extension. Your work was included in the current upstream of 0.2.1.

The new environment variable switch FASTMAT_COMPILER_OPTIONS was added that allows to pass specific options to the compiler directly. It takes precedence to the FASTMAT_GENERIC option.

Furthermore, building wheels for macOS-arm64 was added to the CI setup, which as of 0.2.1 was migrated from Travis-CI to Github Actions. I hove the new binary support will also help you with faster setup times on those machines. If you could, testing the new arm64 wheels for M1 silicon and reporting some feedback on that would be appreciated greatly. Thanks!

Cheers,

Christoph

lpossner commented 1 year ago

Hello and thank you. I can confirm that the arm64 wheels from PyPI do work as well. Cheers!