gtrfxdso wrote:You can build your own openBLAS (make sure that shared library option should be switched on) and create symbolic links for refblas and mllapack to that dynlib. That’s it. OpenBLAS is faster than intelMKL running on AMD cpus + Windows.
I'd come across openBLAS in my searching but didn't really understand its uses. Thanks for the direction!
Man, this is gonna be a fun rabbit hole! (not yet sure if that is sarcastic or not)
FriedEngineer wrote:Man, this is gonna be a fun rabbit hole! (not yet sure if that is sarcastic or not)
Edit (Mon Mar 9, 2020):
Well, that was a fun rabbit hole! (turned out to not be very sarcastic at all!)
I haven't exhaustively tested it yet but so far I am now able to use things that rely on LAPACK and BLAS. Here's what now works (that didn't properly before):
For those who are interested, I'll do some additional testing and write up a guide to replicate what I did in the next few weeks.
Edit (Fri Mar 27, 2020):
The main reason for this is to use the OpenBLAS Library instead of the Intel Math Kernel Library (MKL).
Okay, so here's the basics of what I had to do
- swap the libiomp5.dylib (this is just to launch matlab, as mentioned earlier in this thread)
- Download and compile openBLAS with the AMD ZEN flag (TARGET=ZEN, which they note is pretty much the same as the Haswell optimization)
- Copy the compiled dylib to MATLAB_R2019b/sys/os/maci64
- Modify the blas.spec and lapack.spec files to point to that dylib
- install gcc7 and change its link location in /usr/local/opt (defaults to [email protected] and openBLAS looks for it in gcc not [email protected])
Note: I have not exhaustively tested Matlab after this modification but it did resolve all the issues I'd seen so far.
If you're interested, here's the full instructions
(and the attached zip with the libraries)
To launch Matlab
To use MKL based functions
- Go to "MATLAB_R2019b/sys/os/maci64" (to get here right click on the application and click "show contents" and then navigate to this folder)
- Rename "libiomp5.dylib" to "libiomp5.dylib.bak"
- Copy the included "libiomp5.dylib" to the same location
- Install homebrew: this makes installing the required gcc 7 easier. You can start this and then do 2-3 below while it runs in the background. (See https://brew.sh/ for installation details). Note: it will also install the Xcode Command Line Tools
- Copy "libopenblas.dylib" to "MATLAB_R2019b/bin/maci64". The included library is OpenBLAS v0.3.9.
- Add a new line with "AuthenticAMD Family * Model * libopenblas.dylib #AMD" to the blas.spec and lapack.spec files located in MATLAB_R2019b/bin/maci64 (just open them in TextEdit). This tells Matlab to use the OpenBLAS library for all blas and lapack functions when it finds an AMD based system instead of the default mkl.dylib.
- Once homebrew is finished installing, in a terminal window (which you probably have open from installing homebrew) and type the command "brew install [email protected]" to install gcc version 7
- Go to /usr/local/opt (it's hidden so I'd recommend you use Finder's "Go to Folder" command to get there) and rename the "[email protected]" folder there to "gcc". This folder is just a link to the actual install location and openBLAS looks in gcc instead of [email protected] for the gcc 7 library it needs.