NumPy / Sklearn performance comparison - macOS, Ubuntu, Windows 10 - use Anaconda
One of the advantages to use a Hackintosh is that you can try the same software on the same hardware across three operating systems: how does NumPy - and therefore Sklearn - perform across different operating systems and mathematics libraries?
I created a simple Sklearn routine, which utilises a single thread for its calculations.
Results
Hardware | Os | Python | Math library | Comment | Time (s) |
Macbook Air m1 | MacOS Big Sur | 3.9.1 | CBLAS/LAPACK | Anaconda install | 22 |
Intel 9600k | Ubuntu 20.04 | 3.8.5 | OpenBLAS | standard apt and pip install | 27 |
Intel 9600k | Ubuntu 20.04 | 3.9.0 | OpenBLAS | standard apt and pip install | 27 |
Intel 9600k | MacOS Catalina | 3.8.5 | MKL | Hackintosh with Clover, Anaconda install |
28 |
Intel 9600k | Windows 10 | 3.8.5 | MKL | Anaconda install | 28 |
Intel 9600k | MacOS Big Sur | 3.9.1 | OpenBLAS | Hackintosh with OpenCore, brew and pip install |
29 |
Intel 9600k | MacOS Big Sur | 3.8.7 | OpenBLAS | Hackintosh with OpenCore, brew and pip install |
32 |
Intel 9600k | MacOS Catalina | 3.8.7 | OpenBLAS | Hackintosh with Clover, brew and pip install |
33 |
Intel 9600k | Ubuntu 20.04 | 3.7.9 | MKL | Anaconda Intel proprietary Python+Numpy |
34 |
Macbook Pro i5-7360U | MacOS Catalina | 3.8.5 | MKL | Anaconda install | 38 |
Intel NUC N8280 | Ubuntu 20.04 | 3.8.5 | OpenBLAS | standard apt and pip install | 181 |
Raspberry Pi 4 | Raspbian Linux 10 | 3.7.3 | 181 |
Visually, displaying only the same hardware (9600k)
Findings
There were three surprising findings:
First, the way Python and NumPy are installed does matter a lot: Anaconda's libraries are optimised and will give you an obvious performance edge compared to brew install. Install these using Anaconda instead of brew on macOS.
Second, setting up the development environment on Ubuntu was by far the easiest. Not only apt installed everything right away (no need for brew on Anaconda), the installed libraries were highly optimised and gave the extra performance that on macOS only the Anaconda install provided.
Third, the Apple M1 is really fast, even though it was fiddly to install NumPy - requires Anaconda, brew does not work.
Takeaway message
Use the Anaconda installer - it is not only convenient, it is also highly optimised. Brew on macOS will not give you a good machine learning performance.
Comments
Post a Comment