Skip to content
Snippets Groups Projects
Commit edbf0335 authored by EXT Jean-Matthieu Etancelin's avatar EXT Jean-Matthieu Etancelin
Browse files

Fix ccode for sympy<1.7 compatibility

parent ea70ee17
No related branches found
No related tags found
2 merge requests!24Resolve "Add python3.x support",!15WIP: Resolve "HySoP with tasks"
Pipeline #62611 canceled
from hysop.backend.device.opencl.opencl_types import basetype as cl_basetype, \
components as cl_components, \
vtype as cl_vtype
from hysop.backend.device.codegen.base.variables import ctype_to_dtype
import sympy as sm import sympy as sm
from hysop.symbolic import Symbol, Expr from hysop.symbolic import Symbol, Expr
from hysop.symbolic.array import OpenClSymbolicBuffer, OpenClSymbolicNdBuffer from hysop.symbolic.array import OpenClSymbolicBuffer, OpenClSymbolicNdBuffer
from hysop.tools.types import check_instance, first_not_None, to_tuple, to_list from hysop.tools.types import check_instance, first_not_None, to_tuple, to_list
from hysop.tools.numerics import is_fp, is_signed, is_unsigned, is_integer, is_complex from hysop.tools.numerics import is_fp, is_signed, is_unsigned, is_integer, is_complex
from sympy.printing.c import C99CodePrinter
from hysop.backend.device.codegen.base.variables import ctype_to_dtype from packaging import version
from hysop.backend.device.opencl.opencl_types import basetype as cl_basetype, \ if version.parse(sp.__version__) > version.parse("1.7"):
components as cl_components, \ from sympy.printing.c import C99CodePrinter
vtype as cl_vtype else:
from sympy.printing.ccode import C99CodePrinter
InstructionTermination = '' InstructionTermination = ''
......
import sympy as sm
from sympy.printing.c import C99CodePrinter
from hysop.tools.types import check_instance
from hysop.backend.device.opencl.opencl_types import OpenClTypeGen from hysop.backend.device.opencl.opencl_types import OpenClTypeGen
from hysop.tools.types import check_instance
import sympy as sm
from packaging import version
if version.parse(sp.__version__) > version.parse("1.7"):
from sympy.printing.c import C99CodePrinter
else:
from sympy.printing.ccode import C99CodePrinter
# /!\ TODO complete known_functions list with OpenCL builtins # /!\ TODO complete known_functions list with OpenCL builtins
# - keys are sympy function names (beware to capital letters) # - keys are sympy function names (beware to capital letters)
......
...@@ -5,8 +5,12 @@ from hysop.tools.sympy_utils import nabla, partial, subscript, subscripts, \ ...@@ -5,8 +5,12 @@ from hysop.tools.sympy_utils import nabla, partial, subscript, subscripts, \
exponent, exponents, xsymbol, get_derivative_variables exponent, exponents, xsymbol, get_derivative_variables
from sympy.printing.str import StrPrinter, StrReprPrinter from sympy.printing.str import StrPrinter, StrReprPrinter
from sympy.printing.c import C99CodePrinter
from sympy.printing.latex import LatexPrinter from sympy.printing.latex import LatexPrinter
from packaging import version
if version.parse(sp.__version__) > version.parse("1.7"):
from sympy.printing.c import C99CodePrinter
else:
from sympy.printing.ccode import C99CodePrinter
class BasePrinter(object): class BasePrinter(object):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment