charmplusplus / charm4py

Parallel Programming with Python and Charm++
https://charm4py.readthedocs.io
Apache License 2.0
290 stars 21 forks source link

fixing build issues on mac #254

Closed ritvikrao closed 5 months ago

ritvikrao commented 5 months ago

had to make a new pr to get rid of the ray commits; my original pr was made before ray was merged.

adityapb commented 5 months ago

Can you rename the commit and the PR to fixing build issues on mac

ZwFink commented 5 months ago

Pinging @mayantaylor for the new branch. We are hoping you can test this on your Apple Silicon machine

mayantaylor commented 5 months ago

Testing on arm (specifically an AppleM2 running Sonoma) produces the following error:

maya@genmaicha charm4py % python3 setup.py install ... clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -Wno-error=implicit-function-declaration -arch arm8 -Icharm_src/charm/include -I/opt/homebrew/lib/python3.11/site-packages/numpy/core/include -I/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c charm4py/charmlib/charmlib_cython.c -o build/temp.macosx-14.0-arm64-cpython-311/charm4py/charmlib/charmlib_cython.o -g0 -O3

clang: error: invalid arch name '-arch arm8'

For context, I am running clang 15.0.0: maya@genmaicha ray % clang --version Apple clang version 15.0.0 (clang-1500.3.9.4) Target: arm64-apple-darwin23.0.0

I can fix this problem with the following edit to setup.py...

def get_build_machine(): machine = platform.machine() if machine == 'arm64' or machine == 'aarch64': - return 'arm8' + return 'arm64' return machine

... however, I don't know enough about clang to say for certain that this will work for all arm64/aarch64 machines (although I assume it will). I've pushed this change.

Everything else runs smoothly.