Skip to content
Snippets Groups Projects
Commit 8e4aae93 authored by Martin Bauer's avatar Martin Bauer
Browse files

CUDA backend: use fastmath by default

parent 7c0fc3e8
No related merge requests found
...@@ -6,6 +6,9 @@ from pystencils.field import FieldType ...@@ -6,6 +6,9 @@ from pystencils.field import FieldType
from pystencils.include import get_pystencils_include_path from pystencils.include import get_pystencils_include_path
USE_FAST_MATH = True
def make_python_function(kernel_function_node, argument_dict=None): def make_python_function(kernel_function_node, argument_dict=None):
""" """
Creates a kernel function from an abstract syntax tree which Creates a kernel function from an abstract syntax tree which
...@@ -33,8 +36,10 @@ def make_python_function(kernel_function_node, argument_dict=None): ...@@ -33,8 +36,10 @@ def make_python_function(kernel_function_node, argument_dict=None):
code += "#define FUNC_PREFIX __global__\n" code += "#define FUNC_PREFIX __global__\n"
code += "#define RESTRICT __restrict__\n\n" code += "#define RESTRICT __restrict__\n\n"
code += str(generate_c(kernel_function_node, dialect='cuda')) code += str(generate_c(kernel_function_node, dialect='cuda'))
mod = SourceModule(code, options=["-w", "-std=c++11", "-Wno-deprecated-gpu-targets"], options = options = ["-w", "-std=c++11", "-Wno-deprecated-gpu-targets", "-use_fast_math"]
include_dirs=[get_pystencils_include_path()]) if USE_FAST_MATH:
options.append("-use_fast_math")
mod = SourceModule(code, options=options, include_dirs=[get_pystencils_include_path()])
func = mod.get_function(kernel_function_node.function_name) func = mod.get_function(kernel_function_node.function_name)
parameters = kernel_function_node.get_parameters() parameters = kernel_function_node.get_parameters()
......
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