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

Use old ld64 linker on MacOS >= 15.0 #1083

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:
fast-compile: 0
float32: 0
part: "tests/link/pytorch"
- os: macos-latest
- os: macos-15
python-version: "3.12"
fast-compile: 0
float32: 0
Expand Down Expand Up @@ -169,7 +169,7 @@ jobs:
shell: micromamba-shell {0}
run: |

if [[ $OS == "macos-latest" ]]; then
if [[ $OS == "macos-15" ]]; then
micromamba install --yes -q "python~=${PYTHON_VERSION}=*_cpython" numpy scipy pip graphviz cython pytest coverage pytest-cov pytest-benchmark pytest-mock libblas=*=*accelerate;
else
micromamba install --yes -q "python~=${PYTHON_VERSION}=*_cpython" mkl numpy scipy pip mkl-service graphviz cython pytest coverage pytest-cov pytest-benchmark pytest-mock;
Expand All @@ -182,7 +182,7 @@ jobs:
pip install -e ./
micromamba list && pip freeze
python -c 'import pytensor; print(pytensor.config.__str__(print_doc=False))'
if [[ $OS == "macos-latest" ]]; then
if [[ $OS == "macos-15" ]]; then
python -c 'import pytensor; assert pytensor.config.blas__ldflags.startswith("-framework Accelerate"), "Blas flags are not set to MacOS Accelerate"';
else
python -c 'import pytensor; assert pytensor.config.blas__ldflags != "", "Blas flags are empty"';
Expand Down
8 changes: 8 additions & 0 deletions pytensor/link/c/cmodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -2379,6 +2379,14 @@ def join_options(init_part):
if sys.platform == "darwin":
# Use the already-loaded python symbols.
cxxflags.extend(["-undefined", "dynamic_lookup"])
# XCode15 introduced ld_prime linker. At the time of writing, this linker
# leads to multiple issues, so we supply a flag to use the older dynamic
# linker: ld64
if int(platform.mac_ver()[0].split(".")[0]) >= 15:
# This might be incorrect. We know that ld_prime was introduced in
# XCode15, but we don't know if the platform version is aligned with
# xcode's version.
cxxflags.append("-ld64")

if sys.platform == "win32":
# Workaround for https://github.com/Theano/Theano/issues/4926.
Expand Down
Loading