Skip to content

MDAnalysis

OpenMP on macOS

MDanalysis does not compile with OpenMP support on macOS.

Why?

When building, MDanalysis checks if the following program can be compiled with the current compiler:

#include <omp.h>

int main(void) {
    omp_get_num_threads();
}

On macOS, compiling such program with g++ -fopenmp fails with the following error:

clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'

g++ on macOS is an alias for clang++.

OpenMP Support with GCC

Install GCC using brew install gcc (or any other package manager).

CC=gcc-11 CXX=g++-11 pip install -e package

Disabling OpenMP Support

OpenMP support can be explicitly disabled with

MDA_USE_OPENMP=FALSE CC=gcc-11 CXX=g++-11 pip install -e package