diff --git a/devito/passes/iet/definitions.py b/devito/passes/iet/definitions.py index e4195c95c66..0568e833add 100644 --- a/devito/passes/iet/definitions.py +++ b/devito/passes/iet/definitions.py @@ -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) diff --git a/devito/symbolics/extended_sympy.py b/devito/symbolics/extended_sympy.py index 87a56c13b78..161f596a049 100644 --- a/devito/symbolics/extended_sympy.py +++ b/devito/symbolics/extended_sympy.py @@ -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 @@ -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