Commit aff0c6b8 authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Let show_code also work for KernelWrapper

parent afe8c892
...@@ -3,6 +3,7 @@ from typing import Any, Dict, Optional ...@@ -3,6 +3,7 @@ from typing import Any, Dict, Optional
import sympy as sp import sympy as sp
from pystencils.astnodes import KernelFunction from pystencils.astnodes import KernelFunction
from pystencils.kernel_wrapper import KernelWrapper
def to_dot(expr: sp.Expr, graph_style: Optional[Dict[str, Any]] = None, short=True): def to_dot(expr: sp.Expr, graph_style: Optional[Dict[str, Any]] = None, short=True):
...@@ -40,6 +41,10 @@ def show_code(ast: KernelFunction, custom_backend=None): ...@@ -40,6 +41,10 @@ def show_code(ast: KernelFunction, custom_backend=None):
Can either be displayed as HTML in Jupyter notebooks or printed as normal string. Can either be displayed as HTML in Jupyter notebooks or printed as normal string.
""" """
from pystencils.backends.cbackend import generate_c from pystencils.backends.cbackend import generate_c
if isinstance(ast, KernelWrapper):
ast = ast.ast
dialect = 'cuda' if ast.backend == 'gpucuda' else 'c' dialect = 'cuda' if ast.backend == 'gpucuda' else 'c'
class CodeDisplay: class CodeDisplay:
......
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