From 857f25f59bc646fc9c753f0927c6244a6106915d Mon Sep 17 00:00:00 2001 From: Luciano Paz Date: Mon, 11 Nov 2024 22:38:16 +0100 Subject: [PATCH 1/2] Use ld64 linker on Mac OS --- pytensor/link/c/cmodule.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pytensor/link/c/cmodule.py b/pytensor/link/c/cmodule.py index 62f5adea01..9968eb59be 100644 --- a/pytensor/link/c/cmodule.py +++ b/pytensor/link/c/cmodule.py @@ -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. From 484bfdf489ecbdfc762d18b1c91076bc3639ff07 Mon Sep 17 00:00:00 2001 From: Luciano Paz Date: Mon, 11 Nov 2024 22:41:08 +0100 Subject: [PATCH 2/2] Run MacOS tests on version 15 --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a8456c8292..5c3cf79cf3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -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; @@ -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"';