Numpy-MKL for OS X
intel-mkl, macos, numpy, python, python-3.3
Solution
MacPorts seems to have recently added an MKL variant to their NumPy port (as well as to SciPy and PyTorch). Tested on my 16” MacBook Pro 2019 with 2.4GHz 8-core Intel Core i9 and macOS Ventura 13.0.1, Numpy with MKL is significantly faster than Numpy with the Accelerate framework, which is another fast replacement for OpenBLAS that is built into macOS. I tested using this code which I got from Puget Systems:
import numpy as np
import time
n = 20000
A = np.random.randn(n,n).astype('float64')
B = np.random.randn(n,n).astype('float64')
start_time = time.time()
nrm = np.linalg.norm(A@B)
print(" took {} seconds ".format(time.time() - start_time))
print(" norm = ",nrm)
The result of my testing is that Numpy with mkl took ~47 seconds while Numpy with accelerate took ~66 seconds. Accelerate also used more threads.
To install this with MacPorts you first have to install MacPorts, then run `sudo port install py310-numpy -openblas +mkl` in the terminal.
Problem
I love being able to use Christoph Gohlke's `numpy-MKL` version of `NumPy` linked to Intel's Math Kernel Library on Windows. However, I have been unable to find a similar version for OS X, preferably NumPy 1.7 linked for Python 3.3 on Mountain Lion. Does anyone know where this might be obtained? EDIT: So after a bit of hunting I found this link to evaluate Intel's Composer XE2013 studios for C++ and Fortran (both of which contain the MKL), as well as a tutorial on building NumPy and SciPy with it, so this will serve for the present. However, the question remains - is there a frequently-updated archive for OS X similar to Christoph Gohlke's? If not, why not? :)