Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A brief guide to compile from source on apple silicon (M1, M2, M3) #283

Open
deKeijzer opened this issue Feb 28, 2024 · 0 comments
Open

Comments

@deKeijzer
Copy link

deKeijzer commented Feb 28, 2024

Hi there,

Perhaps this will help someone out. To compile dedalus from source using

CC=mpicc pip3 install --upgrade --force-reinstall --no-deps --no-cache --no-build-isolation http://github.com/dedalusproject/dedalus/zipball/master/

as stated in the docs, might results in an error

...mpicc -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -arch arm64 -arch x86_64 -g -I/usr/local/opt/llvm/include -I/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/mpi4py/include -I/opt/homebrew/opt/open-mpi/include -Idedalus/libraries/fftw/ -I/opt/homebrew/opt/fftw/include -I/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c dedalus/core/transposes.c -o build/temp.macosx-10.9-universal2-cpython-312/dedalus/core/transposes.o -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -Wno-unused-function -fopenmp
      clang: error: unsupported option '-fopenmp'
      clang: error: unsupported option '-fopenmp'
      error: command '/opt/homebrew/bin/mpicc' failed with exit code 1
      [end of output]...

This is solved by using gcc instead of mpi;

briandekeijzer@MacBook-Pro build % brew install gcc

==> Downloading https://formulae.brew.sh/api/formula.jws.json
##O=- #      #                                                                                                                                                                                                        
==> Downloading https://formulae.brew.sh/api/cask.jws.json

Warning: gcc 13.2.0 is already installed and up-to-date.
To reinstall 13.2.0, run:
  brew reinstall gcc
briandekeijzer@MacBook-Pro build % export CC=/opt/homebrew/bin/gcc-13
export CXX=/opt/homebrew/bin/g++-13

Then specifically compile with gcc-version_number

CC=gcc-13 pip3 install --upgrade --force-reinstall --no-deps --no-cache --no-build-isolation http://github.com/dedalusproject/dedalus/zipball/master/

This allows for compilation fo Dedalus on Apple silicon with the latest Python version.

Have fun simulating!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant