Skip to content
Snippets Groups Projects
Commit a8292b88 authored by Michael Kuron's avatar Michael Kuron :mortar_board:
Browse files

Fix OpenCL with older Sympy and pyopencl versions

parent 9f76ea1d
2 merge requests!77Run opencl without pycuda,!76Fix OpenCL with older Sympy and pyopencl versions
Pipeline #18962 passed with stage
in 3 minutes and 4 seconds
......@@ -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):
......
......@@ -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)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment