diff --git a/pystencils/backends/opencl_backend.py b/pystencils/backends/opencl_backend.py index d2e40a69f05fe1181fc41110ca9a1b07763a75be..4217e9384644d86db7c225c0bd092c9fac7f1558 100644 --- a/pystencils/backends/opencl_backend.py +++ b/pystencils/backends/opencl_backend.py @@ -81,7 +81,10 @@ class OpenClSympyPrinter(CudaSympyPrinter): # For math functions, OpenCL is more similar to the C++ printer CustomSympyPrinter # since built-in math functions are generic. # In CUDA, you have to differentiate between `sin` and `sinf` - _print_math_func = CustomSympyPrinter._print_math_func + try: + _print_math_func = CustomSympyPrinter._print_math_func + except AttributeError: + pass _print_Pow = CustomSympyPrinter._print_Pow def _print_Function(self, expr): diff --git a/pystencils/opencl/opencljit.py b/pystencils/opencl/opencljit.py index 75076db53bd8dd37457fc4bb9c9dea833942d57f..f1df02936b035d178eed91f1c4ed2fd05a31e44c 100644 --- a/pystencils/opencl/opencljit.py +++ b/pystencils/opencl/opencljit.py @@ -41,8 +41,12 @@ def make_python_function(kernel_function_node, opencl_queue, opencl_ctx, argumen code += str(generate_c(kernel_function_node, dialect='opencl', custom_backend=custom_backend)) options = [] if USE_FAST_MATH: - options.append("-cl-unsafe-math-optimizations -cl-mad-enable -cl-fast-relaxed-math -cl-finite-math-only") - options.append("-I \"" + get_pystencils_include_path() + "\"") + options.append("-cl-unsafe-math-optimizations") + options.append("-cl-mad-enable") + options.append("-cl-fast-relaxed-math") + options.append("-cl-finite-math-only") + options.append("-I") + options.append(get_pystencils_include_path()) mod = cl.Program(opencl_ctx, code).build(options=options) func = getattr(mod, kernel_function_node.function_name)