Commit 05aa005a authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Add `use_auto_for_assignments` as a kernel parameter

parent 69c29833
...@@ -518,7 +518,7 @@ class LoopOverCoordinate(Node): ...@@ -518,7 +518,7 @@ class LoopOverCoordinate(Node):
class SympyAssignment(Node): class SympyAssignment(Node):
def __init__(self, lhs_symbol, rhs_expr, is_const=True, use_auto=True): def __init__(self, lhs_symbol, rhs_expr, is_const=True, use_auto=False):
super(SympyAssignment, self).__init__(parent=None) super(SympyAssignment, self).__init__(parent=None)
self._lhs_symbol = lhs_symbol self._lhs_symbol = lhs_symbol
self.rhs = sp.sympify(rhs_expr) self.rhs = sp.sympify(rhs_expr)
...@@ -26,7 +26,8 @@ def create_kernel(assignments, ...@@ -26,7 +26,8 @@ def create_kernel(assignments,
gpu_indexing='block', gpu_indexing='block',
gpu_indexing_params=MappingProxyType({}), gpu_indexing_params=MappingProxyType({}),
use_textures_for_interpolation=True, use_textures_for_interpolation=True,
cpu_prepend_optimizations=[]): cpu_prepend_optimizations=[],
""" """
Creates abstract syntax tree (AST) of kernel, using a list of update equations. Creates abstract syntax tree (AST) of kernel, using a list of update equations.
...@@ -102,12 +103,10 @@ def create_kernel(assignments, ...@@ -102,12 +103,10 @@ def create_kernel(assignments,
vectorize(ast, **cpu_vectorize_info) vectorize(ast, **cpu_vectorize_info)
else: else:
raise ValueError("Invalid value for cpu_vectorize_info") raise ValueError("Invalid value for cpu_vectorize_info")
return ast
elif target == 'llvm': elif target == 'llvm':
from pystencils.llvm import create_kernel from pystencils.llvm import create_kernel
ast = create_kernel(assignments, type_info=data_type, split_groups=split_groups, ast = create_kernel(assignments, type_info=data_type, split_groups=split_groups,
iteration_slice=iteration_slice, ghost_layers=ghost_layers) iteration_slice=iteration_slice, ghost_layers=ghost_layers)
return ast
elif target == 'gpu': elif target == 'gpu':
from pystencils.gpucuda import create_cuda_kernel from pystencils.gpucuda import create_cuda_kernel
ast = create_cuda_kernel(assignments, type_info=data_type, ast = create_cuda_kernel(assignments, type_info=data_type,
...@@ -115,10 +114,15 @@ def create_kernel(assignments, ...@@ -115,10 +114,15 @@ def create_kernel(assignments,
iteration_slice=iteration_slice, ghost_layers=ghost_layers, iteration_slice=iteration_slice, ghost_layers=ghost_layers,
skip_independence_check=skip_independence_check, skip_independence_check=skip_independence_check,
use_textures_for_interpolation=use_textures_for_interpolation) use_textures_for_interpolation=use_textures_for_interpolation)
return ast
else: else:
raise ValueError("Unknown target %s. Has to be one of 'cpu', 'gpu' or 'llvm' " % (target,)) raise ValueError("Unknown target %s. Has to be one of 'cpu', 'gpu' or 'llvm' " % (target,))
if use_auto_for_assignments:
for a in ast.atoms(SympyAssignment):
a.use_auto = True
return ast
def create_indexed_kernel(assignments, def create_indexed_kernel(assignments,
index_fields, index_fields,
Markdown is supported
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