Skip to content
Snippets Groups Projects

`create_kernel` API Update

Merged Jan Hönig requested to merge hoenig/pystencils:create_kernel_api into master
11 files
+ 85
61
Compare changes
  • Side-by-side
  • Inline
Files
11
 
from pystencils.enums import Target
from pystencils.llvm.llvmjit import make_python_function
from pystencils.llvm.llvmjit import make_python_function
from pystencils.transformations import insert_casts
from pystencils.transformations import insert_casts
def create_kernel(assignments, function_name="kernel", type_info=None, split_groups=(),
def create_kernel(assignments, function_name="kernel", type_info=None, split_groups=(),
iteration_slice=None, ghost_layers=None, target='cpu'):
iteration_slice=None, ghost_layers=None, target=Target.CPU):
"""
"""
Creates an abstract syntax tree for a kernel function, by taking a list of update rules.
Creates an abstract syntax tree for a kernel function, by taking a list of update rules.
@@ -25,11 +26,11 @@ def create_kernel(assignments, function_name="kernel", type_info=None, split_gro
@@ -25,11 +26,11 @@ def create_kernel(assignments, function_name="kernel", type_info=None, split_gro
:return: :class:`pystencils.ast.KernelFunction` node
:return: :class:`pystencils.ast.KernelFunction` node
"""
"""
if target == 'cpu':
if target == Target.CPU:
from pystencils.cpu import create_kernel
from pystencils.cpu import create_kernel
code = create_kernel(assignments, function_name, type_info, split_groups, iteration_slice, ghost_layers)
code = create_kernel(assignments, function_name, type_info, split_groups, iteration_slice, ghost_layers)
code._backend = 'llvm'
code._backend = 'llvm'
elif target == 'gpu':
elif target == Target.GPU:
from pystencils.gpucuda.kernelcreation import create_cuda_kernel
from pystencils.gpucuda.kernelcreation import create_cuda_kernel
code = create_cuda_kernel(assignments,
code = create_cuda_kernel(assignments,
function_name,
function_name,
Loading