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

Fix CasADI path and disable IREE for MacOS #4528

Merged
merged 9 commits into from
Oct 18, 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

## Bug Fixes

- Disabled IREE on MacOS due to compatibility issues and added the CasADI
path to the environment to resolve issues on MacOS and Linux. Windows
users may still experience issues with interpolation. ([#4528](https://github.com/pybamm-team/PyBaMM/pull/4528))
MarcBerliner marked this conversation as resolved.
Show resolved Hide resolved
- Added `_from_json()` functionality to `Sign` which was erroneously omitted previously. ([#4517](https://github.com/pybamm-team/PyBaMM/pull/4517))
- Fixed bug where IDAKLU solver failed when `output variables` were specified and an extrapolation event is present. ([#4440](https://github.com/pybamm-team/PyBaMM/pull/4440))

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,8 @@ Editable notebooks are made available using [Google Colab](https://colab.researc

GitHub does some magic with particular filenames. In particular:

- The first page people see when they go to [our GitHub page](https://github.com/pybamm-team/PyBaMM) displays the contents of [README.md](https://github.com/pybamm-team/PyBaMM/blob/develop/README.md), which is written in the [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) format. Some guidelines can be found [here](https://help.github.com/articles/about-readmes/).
- The license for using PyBaMM is stored in [LICENSE](https://github.com/pybamm-team/PyBaMM/blob/develop/LICENSE.txt), and [automatically](https://help.github.com/articles/adding-a-license-to-a-repository/) linked to by GitHub.
- The first page people see when they go to [our GitHub page](https://github.com/pybamm-team/PyBaMM) displays the contents of [README.md](https://github.com/pybamm-team/PyBaMM/blob/develop/README.md), which is written in the [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) format. Some guidelines can be found [here](https://docs.github.com/articles/about-readmes/).
- The license for using PyBaMM is stored in [LICENSE](https://github.com/pybamm-team/PyBaMM/blob/develop/LICENSE.txt), and [automatically](https://docs.github.com/articles/adding-a-license-to-a-repository/) linked to by GitHub.
- This file, [CONTRIBUTING.md](https://github.com/pybamm-team/PyBaMM/blob/develop/CONTRIBUTING.md) is recognised as the contribution guidelines and a link is [automatically](https://github.com/blog/1184-contributing-guidelines) displayed when new issues or pull requests are created.

## Acknowledgements
Expand Down
18 changes: 2 additions & 16 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
import sys
import warnings
import platform
from pathlib import Path


Expand All @@ -27,28 +26,15 @@ def set_iree_state():
"""
state = "ON" if os.getenv("PYBAMM_IDAKLU_EXPR_IREE", "OFF") == "ON" else "OFF"
if state == "ON":
if sys.platform == "win32":
if sys.platform == "win32" or sys.platform == "darwin":
warnings.warn(
(
"IREE is not enabled on Windows yet. "
"IREE is not enabled on Windows and MacOS. "
"Setting PYBAMM_IDAKLU_EXPR_IREE=OFF."
),
stacklevel=2,
)
return "OFF"
if sys.platform == "darwin":
# iree-compiler is currently only available as a wheel on macOS 13 (or
# higher) and Python version 3.11
mac_ver = int(platform.mac_ver()[0].split(".")[0])
if (not sys.version_info[:2] == (3, 11)) or mac_ver < 14:
warnings.warn(
(
"IREE is only supported on MacOS 13 (or higher) and Python"
"version 3.11. Setting PYBAMM_IDAKLU_EXPR_IREE=OFF."
),
stacklevel=2,
)
return "OFF"
return state


Expand Down
9 changes: 5 additions & 4 deletions src/pybamm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import sys

from pybamm.version import __version__

# Demote expressions to 32-bit floats/ints - option used for IDAKLU-MLIR compilation
Expand Down Expand Up @@ -201,8 +199,11 @@
# Pybamm Data manager using pooch
from .pybamm_data import DataLoader

# Remove any imported modules, so we don't expose them as part of pybamm
del sys
# Fix Casadi import
import os
import pathlib
import sysconfig
os.environ["CASADIPATH"] = str(pathlib.Path(sysconfig.get_path('purelib')) / 'casadi')

__all__ = [
"batch_study",
Expand Down
Loading