Skip to content

Commit

Permalink
deps: support sympy 1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Jul 8, 2024
1 parent f518eb3 commit dee09dd
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 101 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pytest-core-nompi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ jobs:
os: ubuntu-20.04
arch: "gcc-10"
language: "C"
sympy: "1.10"
sympy: "1.11"

- name: pytest-ubuntu-py312-gcc13-omp
python-version: '3.12'
os: ubuntu-24.04
arch: "gcc-13"
language: "openmp"
sympy: "1.11"
sympy: "1.13"

- name: pytest-ubuntu-py39-gcc9-omp
python-version: '3.9'
Expand Down
6 changes: 5 additions & 1 deletion devito/finite_differences/differentiable.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
import sympy
from sympy.core.add import _addsort
from sympy.core.mul import _keep_coeff, _mulsort
from sympy.core.core import ordering_of_classes
from sympy.core.decorators import call_highest_priority
from sympy.core.evalf import evalf_table
try:
from sympy.core.core import ordering_of_classes
except ImportError:
# Moved in 1.13
from sympy.core.basic import ordering_of_classes

from devito.finite_differences.tools import make_shift_x0, coeff_priority
from devito.logger import warning
Expand Down
6 changes: 5 additions & 1 deletion devito/passes/clusters/cse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
from functools import singledispatch

from sympy import Add, Function, Indexed, Mul, Pow
from sympy.core.core import ordering_of_classes
try:
from sympy.core.core import ordering_of_classes
except ImportError:
# Moved in 1.13
from sympy.core.basic import ordering_of_classes

from devito.finite_differences.differentiable import IndexDerivative
from devito.ir import Cluster, Scope, cluster_pass
Expand Down
2 changes: 1 addition & 1 deletion devito/symbolics/manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def pow_to_mul(expr):
if exp > 10 or exp < -10 or exp == 0:
# Large powers remain untouched
return expr
elif exp == -1 or int(exp) != exp:
elif exp == -1 or (int(exp) - exp != 0):
# Reciprocals and fractional powers also remain untouched,
# but at least we traverse the base looking for other Pows
return expr.func(pow_to_mul(base), exp, evaluate=False)
Expand Down
6 changes: 5 additions & 1 deletion devito/types/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

import numpy as np
import sympy
from sympy.core.core import ordering_of_classes
try:
from sympy.core.core import ordering_of_classes
except ImportError:
# Moved in 1.13
from sympy.core.basic import ordering_of_classes

from devito.types import Array, CompositeObject, Indexed, Symbol, LocalObject
from devito.types.basic import IndexedData
Expand Down
82 changes: 33 additions & 49 deletions examples/seismic/tutorials/05_staggered_acoustic.ipynb

Large diffs are not rendered by default.

84 changes: 40 additions & 44 deletions examples/seismic/tutorials/06_elastic_varying_parameters.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pip>=9.0.1
numpy>1.16,<2.1
sympy>=1.9,<1.13
sympy>=1.9,<1.14
psutil>=5.1.0,<7.0
py-cpuinfo<10
cgen>=2020.1
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def numpy_compat(required):

# Due to api changes in numpy 2.0, it requires sympy 1.12.1 at the minimum
# Check if sympy is installed and enforce numpy version accordingly.
# If sympy isn't installed, endforce sympy>=1.12.1 and numpy>=2.0
# If sympy isn't installed, enforce sympy>=1.12.1 and numpy>=2.0
try:
sympy_version = pkg_resources.get_distribution("sympy").version
min_ver2 = pkg_resources.parse_version("1.12.1")
Expand Down

0 comments on commit dee09dd

Please sign in to comment.