Skip to content

Latest commit

 

History

History

macOS

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Prerequisites for MUMPS installation on a Mac

We need the following tools before compiling MUMPS and its MATLAB interface on macOS.

Much of the following (and the whole MUMPS compilation process) needs to be done in a command-line environment. You can either use Apple's built-in Terminal app (in the /Applications/Utilities/ folder) or a 3rd-party one like iTerm2.

MATLAB for Apple silicon Macs

If you are not sure whether your Mac runs on an Intel processor or Apple silicon, click the Apple logo on the top left corner of the menu bar, and click About This Mac. A Mac with Intel processor will show an item Processor (e.g., Intel Core i7); a Mac with Apple silicon will show an item Chip (e.g., Apple M1) instead.

If your Mac runs on Apple silicon, the version of your MATLAB must be R2023b or later. Older versions of MATLAB can run on Apple silicon through Rosetta 2 but do not support building mex files as native ARM binaries, which we need to compile the MATLAB interface for MUMPS.

Xcode Command Line Tools

Apple's Xcode Command Line Tools (CLT) include make, ar, and ranlib, Apple's C compiler clang, and Apple's implementation of BLAS and LAPACK, vecLib, within its Accelerate framework. We need those.

In the next step, we will install Homebrew, which will install CLT (if not already installed). So, nothing needs to be done here.

Homebrew

Xcode and CLT do not include a Fortran compiler. Here, we use Homebrew to install one; Homebrew can also be used for the optional installation of openblas and cmake below. If you already have Homebrew installed, run brew update to update it. If you don't have Homebrew installed, copy the following line and paste it in terminal.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Follow instructions from the script to install Homebrew and then to add it to your PATH.

If CLT was not installed prior, Homebrew will install it as part of the script above.

As described in the Homebrew installation page, this installs Homebrew to /opt/homebrew for an Apple Silicon Mac, /usr/local for an Intel Mac.

After installation, enter

brew doctor

to make sure there's no outstanding issues.

GNU compiler collection

After installing Homebrew, enter

brew install gcc

in terminal. This will install the GNU compiler collection (GCC), which includes the Fortran compiler gfortran. If you already installed GCC through Homebrew before, this will update GCC to the most current stable version.

If you update GCC in the future (through brew upgrade or by running brew install gcc again), and the first number of the GCC version changes (e.g. from gcc 11.x.x to gcc 12.x.x), then you'll need to update that version number in the LIBFORT path within the make.inc of the MATLAB interface of MUMPS, and recompile that MATLAB interface.

(Optional) OpenBLAS

MUMPS uses BLAS extensively, so we need a BLAS library. One option is Apple's vecLib within its Accelerate framework (which is already installed above with Xcode and CLT); another is OpenBLAS; another is MKL.

If you have an Apple silicon Mac, you should use vecLib for BLAS. On an Apple silicon Mac, vecLib utilizes the Apple Matrix coprocessor (AMX), so it is much faster than single-threaded OpenBLAS (e.g., see this benchmark) and has a comparable speed as multithreaded OpenBLAS (e.g., see this benchmark). In this case, you don't need to install OpenBLAS, and you can skip this section.

If you have an Intel Mac, we recommend installing OpenBLAS. We found on an Intel Macbook Pro that MESTI with the APF method is about 30% faster when MUMPS is compiled with single-threaded OpenBLAS compared to with vecLib. Most likely MKL will be even faster than OpenBLAS on an Intel Mac, but we did not test it; you can follow the instructions here if you want to use MKL instead (but note the macOS Makefile.inc and make.inc files we provide only consider vecLib and OpenBLAS.) To install OpenBLAS, enter

brew install openblas

in the terminal. This will install OpenBLAS in /usr/local/opt/openblas for an Intel Mac (or /opt/homebrew/opt/openblas for an Apple Silicon Mac). You can find this information in the future with the brew info openblas command.

(Optional) CMake

If you plan to install METIS for matrix ordering, you'll also need CMake. Enter

brew install cmake

in terminal to install CMake.

Troubleshooting

During the MATLAB interface compilation, you may encounter a warning with Xcode license has not been accepted and then an error with no supported compiler was found. This issue can be resolved by entering

/usr/libexec/PlistBuddy -c 'Add :IDEXcodeVersionForAgreedToGMLicense string 10.0' ~/Library/Preferences/com.apple.dt.Xcode.plist

in terminal. Alternatively, you can install the full Xcode and accept the Xcode license agreement if this trick does not work.