Skip to content

Commit

Permalink
compiler: Patch custom coefficients
Browse files Browse the repository at this point in the history
  • Loading branch information
FabioLuporini committed Oct 24, 2023
1 parent d566d31 commit e0cccf2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 3 additions & 1 deletion devito/passes/iet/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,9 @@ def place_definitions(self, iet, globs=None, **kwargs):
includes = set()
if isinstance(iet, EntryFunction) and globs:
for i in sorted(globs, key=lambda f: f.name):
includes.add(self._alloc_array_on_global_mem(iet, i, storage))
v = self._alloc_array_on_global_mem(iet, i, storage)
if v:
includes.add(v)

iet, efuncs = self._inject_definitions(iet, storage)

Expand Down
14 changes: 5 additions & 9 deletions devito/symbolics/extended_sympy.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np
import sympy
from sympy import Expr, Integer, Function, Number, Tuple, sympify
from sympy import Expr, Float, Integer, Function, Number, Tuple, sympify
from sympy.core.decorators import call_highest_priority

from devito.tools import (Pickable, as_tuple, is_integer, float2, float3, float4, # noqa
Expand Down Expand Up @@ -278,14 +278,10 @@ class ListInitializer(sympy.Expr, Pickable):
def __new__(cls, params):
args = []
for p in as_tuple(params):
if isinstance(p, str):
args.append(Symbol(p))
elif is_integer(p):
args.append(Integer(p))
elif not isinstance(p, Expr):
raise ValueError("`params` must be an iterable of Expr or str")
else:
args.append(p)
try:
args.append(sympify(p))
except sympy.SympifyError:
raise ValueError("Illegal param `%s`" % p)
obj = sympy.Expr.__new__(cls, *args)
obj.params = tuple(args)
return obj
Expand Down

0 comments on commit e0cccf2

Please sign in to comment.