dace.codegen package

Subpackages

Submodules

dace.codegen.codegen module

dace.codegen.codeobject module

class dace.codegen.codeobject.CodeObject(*args, **kwargs)

Bases: object

property clean_code
code

The code attached to this object

environments

Environments required by CMake to build and run this code node.

extra_compiler_kwargs

Additional compiler argument variables to add to template

language

Language used for this code (same as its file extension)

linkable

Should this file participate in overall linkage?

name

Filename to use

properties()
target

Target to use for compilation

target_type

Sub-target within target (e.g., host or device code)

title

Title of code for GUI

dace.codegen.compiled_sdfg module

Contains functionality to load, use, and invoke compiled SDFG libraries.

class dace.codegen.compiled_sdfg.CompiledSDFG(sdfg, lib, argnames=None)

Bases: object

A compiled SDFG object that can be called through Python.

clear_return_values()
fast_call(callargs, initargs, do_gpu_check=False)

Calls the underlying binary functions directly and bypassing argument sanitation.

This is a faster, but less user friendly version of __call__(). While __call__() will transforms its Python arguments such that they can be forwarded, this function assumes that this processing was already done by the user.

Parameters:
  • callargs (Tuple[Any, ...]) – Arguments passed to the actual computation.

  • initargs (Tuple[Any, ...]) – Arguments passed to the initialization function.

  • do_gpu_check (bool) – Check if errors happened on the GPU.

Note:

You may use _construct_args() to generate the processed arguments.

Return type:

Union[Tuple[Any, ...], Any]

property filename
finalize()
get_exported_function(name, restype=None)

Tries to find a symbol by name in the compiled SDFG, and convert it to a callable function with the (optionally) given return type (void by default). If no such function exists, returns None.

Parameters:

name (str) – Name of the function to query.

Return type:

Optional[Callable[..., Any]]

Returns:

Callable to the function, or None if doesn’t exist.

get_state_struct()

Attempt to parse the SDFG source code and extract the state struct. This method will parse the first consecutive entries in the struct that are pointers. As soon as a non-pointer or other unparseable field is encountered, the method exits early. All fields defined until then will nevertheless be available in the structure.

Return type:

Structure

Returns:

the ctypes.Structure representation of the state struct.

get_workspace_sizes()

Returns the total external memory size to be allocated for this SDFG.

Return type:

Dict[StorageType, int]

Returns:

A dictionary mapping storage types to the number of bytes necessary to allocate for the SDFG to work properly.

initialize(*args, **kwargs)

Initializes the compiled SDFG without invoking it.

Parameters:
  • args – Arguments to call SDFG with.

  • kwargs – Keyword arguments to call SDFG with.

Returns:

If successful, returns the library handle (as a ctypes pointer).

Note:

This call requires the same arguments as it would when normally calling the program.

property sdfg
set_workspace(storage, workspace)

Sets the workspace for the given storage type to the given buffer.

Parameters:
  • storage (StorageType) – The storage type to fill.

  • workspace (Any) – An array-convertible object (through __[cuda_]array_interface__, see _array_interface_ptr) to use for the workspace.

class dace.codegen.compiled_sdfg.ReloadableDLL(library_filename, program_name)

Bases: object

A reloadable shared object (or dynamically linked library), which bypasses Python’s dynamic library reloading issues.

get_symbol(name, restype=<class 'ctypes.c_int'>)

Returns a symbol (e.g., function name) in the loaded library.

is_loaded()

Checks if the library is already loaded.

Return type:

bool

load()

Loads the internal library using the stub.

unload()

Unloads the internal library using the stub.

dace.codegen.compiler module

Handles compilation of code objects. Creates the proper folder structure, compiles each target separately, links all targets to one binary, and returns the corresponding CompiledSDFG object.

dace.codegen.compiler.configure_and_compile(program_folder, program_name=None, output_stream=None)

Configures and compiles a DaCe program in the specified folder into a shared library file.

Parameters:
  • program_folder – Folder containing all files necessary to build, equivalent to what was passed to generate_program_folder.

  • output_stream – Additional output stream to write to (used for other clients such as the vscode extension).

Returns:

Path to the compiled shared library file.

dace.codegen.compiler.generate_program_folder(sdfg, code_objects, out_path, config=None)

Writes all files required to configure and compile the DaCe program into the specified folder.

Parameters:
  • sdfg – The SDFG to generate the program folder for.

  • code_objects (List[CodeObject]) – List of generated code objects.

  • out_path (str) – The folder in which the build files should be written.

Returns:

Path to the program folder.

dace.codegen.compiler.get_binary_name(object_folder, object_name, lib_extension='so')
dace.codegen.compiler.get_environment_flags(environments)

Returns the CMake environment and linkage flags associated with the given input environments/libraries.

Parameters:

environments – A list of @dace.library.environment-decorated classes.

Return type:

Tuple[List[str], Set[str]]

Returns:

A 2-tuple of (environment CMake flags, linkage CMake flags)

dace.codegen.compiler.get_program_handle(library_path, sdfg)
dace.codegen.compiler.identical_file_exists(filename, file_contents)
dace.codegen.compiler.load_from_file(sdfg, binary_filename)
dace.codegen.compiler.unique_flags(flags)

dace.codegen.control_flow module

Various classes to facilitate the code generation of structured control flow elements (e.g., for, if, while) from state machines in SDFGs.

SDFGs are state machines of dataflow graphs, where each node is a state and each edge may contain a state transition condition and assignments. As such, when generating code from an SDFG, the straightforward way would be to generate code for each state and conditional goto statements for the state transitions. However, this inhibits compiler optimizations on the generated code, which rely on loops and branches.

This file contains analyses that extract structured control flow constructs from the state machine and emit code with the correct C keywords. It does so by iteratively converting the SDFG into a control flow tree when certain control flow patterns are detected (using the structured_control_flow_tree function). The resulting tree classes (which all extend ControlFlow) contain the original states, and upon code generation are traversed recursively into the tree rather than in arbitrary order.

Each individual state is first wrapped with the SingleState control flow “block”, and then upon analysis can be grouped into larger control flow blocks, such as ForScope or IfElseChain. If no structured control flow pattern is detected (or this analysis is disabled in configuration), the group of states is wrapped in a GeneralBlock, which generates the aforementioned conditional goto code.

For example, the following SDFG:

      x < 5
     /------>[s2]--------\
[s1] \                   ->[s5]
      ------>[s3]->[s4]--/   
      x >= 5

would create the control flow tree below:

GeneralBlock({
    IfScope(condition=x<5, body={  
        GeneralBlock({
            SingleState(s2)
        })
    }, orelse={
        GeneralBlock({
            SingleState(s3),
            SingleState(s4),
        })
    }),
    SingleState(s5)
})
class dace.codegen.control_flow.ControlFlow(dispatch_state, parent)

Bases: object

Abstract class representing a control flow block.

as_cpp(codegen, symbols)

Returns C++ code for this control flow block.

Parameters:
  • codegen – A code generator object, used for allocation information and defined variables in scope.

  • symbols – A dictionary of symbol names and their types.

Returns:

C++ string with the generated code of the control flow block.

property children: List[ControlFlow]

Returns a list of control flow blocks that exist within this block.

dispatch_state: Callable[[SDFGState], str]
property first_state: SDFGState

Returns the first or initializing state in this control flow block. Used to determine which will be the next state in a control flow block to avoid generating extraneous goto calls.

parent: Optional[ControlFlow]
class dace.codegen.control_flow.DoWhileScope(dispatch_state, parent, sdfg, test, body)

Bases: ControlFlow

Do-while loop block (without break or continue statements).

as_cpp(codegen, symbols)

Returns C++ code for this control flow block.

Parameters:
  • codegen – A code generator object, used for allocation information and defined variables in scope.

  • symbols – A dictionary of symbol names and their types.

Return type:

str

Returns:

C++ string with the generated code of the control flow block.

body: GeneralBlock

Loop body as control flow block

property children: List[ControlFlow]

Returns a list of control flow blocks that exist within this block.

property first_state: SDFGState

Returns the first or initializing state in this control flow block. Used to determine which will be the next state in a control flow block to avoid generating extraneous goto calls.

sdfg: SDFG

Parent SDFG

test: CodeBlock

Do-while loop condition

class dace.codegen.control_flow.ForScope(dispatch_state, parent, itervar, guard, init, condition, update, body, init_edges)

Bases: ControlFlow

For loop block (without break or continue statements).

as_cpp(codegen, symbols)

Returns C++ code for this control flow block.

Parameters:
  • codegen – A code generator object, used for allocation information and defined variables in scope.

  • symbols – A dictionary of symbol names and their types.

Return type:

str

Returns:

C++ string with the generated code of the control flow block.

body: GeneralBlock

Loop body as a control flow block

property children: List[ControlFlow]

Returns a list of control flow blocks that exist within this block.

condition: CodeBlock

For-loop condition

property first_state: SDFGState

Returns the first or initializing state in this control flow block. Used to determine which will be the next state in a control flow block to avoid generating extraneous goto calls.

guard: SDFGState

Loop guard state

init: str

C++ code for initializing iteration variable

init_edges: List[InterstateEdge]

All initialization edges

itervar: str

Name of iteration variable

update: str

C++ code for updating iteration variable

class dace.codegen.control_flow.GeneralBlock(dispatch_state, parent, elements, gotos_to_ignore, gotos_to_continue, gotos_to_break, assignments_to_ignore, sequential)

Bases: ControlFlow

General (or unrecognized) control flow block with gotos between states.

as_cpp(codegen, symbols)

Returns C++ code for this control flow block.

Parameters:
  • codegen – A code generator object, used for allocation information and defined variables in scope.

  • symbols – A dictionary of symbol names and their types.

Return type:

str

Returns:

C++ string with the generated code of the control flow block.

assignments_to_ignore: Sequence[Edge[InterstateEdge]]
property children: List[ControlFlow]

Returns a list of control flow blocks that exist within this block.

elements: List[ControlFlow]
property first_state: SDFGState

Returns the first or initializing state in this control flow block. Used to determine which will be the next state in a control flow block to avoid generating extraneous goto calls.

gotos_to_break: Sequence[Edge[InterstateEdge]]
gotos_to_continue: Sequence[Edge[InterstateEdge]]
gotos_to_ignore: Sequence[Edge[InterstateEdge]]
sequential: bool
class dace.codegen.control_flow.IfElseChain(dispatch_state, parent, sdfg, branch_state, body)

Bases: ControlFlow

A control flow scope of “if, else if, …, else” chain of blocks.

as_cpp(codegen, symbols)

Returns C++ code for this control flow block.

Parameters:
  • codegen – A code generator object, used for allocation information and defined variables in scope.

  • symbols – A dictionary of symbol names and their types.

Return type:

str

Returns:

C++ string with the generated code of the control flow block.

body: List[Tuple[CodeBlock, GeneralBlock]]

List of (condition, block)

branch_state: SDFGState

State that branches out to all blocks

property children: List[ControlFlow]

Returns a list of control flow blocks that exist within this block.

property first_state: SDFGState

Returns the first or initializing state in this control flow block. Used to determine which will be the next state in a control flow block to avoid generating extraneous goto calls.

sdfg: SDFG

Parent SDFG

class dace.codegen.control_flow.IfScope(dispatch_state, parent, sdfg, branch_state, condition, body, orelse=None)

Bases: ControlFlow

A control flow scope of an if (else) block.

as_cpp(codegen, symbols)

Returns C++ code for this control flow block.

Parameters:
  • codegen – A code generator object, used for allocation information and defined variables in scope.

  • symbols – A dictionary of symbol names and their types.

Return type:

str

Returns:

C++ string with the generated code of the control flow block.

body: GeneralBlock

Body of if condition

branch_state: SDFGState

State that branches out to if/else scopes

property children: List[ControlFlow]

Returns a list of control flow blocks that exist within this block.

condition: CodeBlock

If-condition

property first_state: SDFGState

Returns the first or initializing state in this control flow block. Used to determine which will be the next state in a control flow block to avoid generating extraneous goto calls.

orelse: Optional[GeneralBlock] = None

Optional body of else condition

sdfg: SDFG

Parent SDFG

class dace.codegen.control_flow.SingleState(dispatch_state, parent, state, last_state=False)

Bases: ControlFlow

A control flow element containing a single state.

as_cpp(codegen, symbols)

Returns C++ code for this control flow block.

Parameters:
  • codegen – A code generator object, used for allocation information and defined variables in scope.

  • symbols – A dictionary of symbol names and their types.

Return type:

str

Returns:

C++ string with the generated code of the control flow block.

property first_state: SDFGState

Returns the first or initializing state in this control flow block. Used to determine which will be the next state in a control flow block to avoid generating extraneous goto calls.

generate_transition(sdfg, edge, successor=None, assignments_only=False, framecode=None)

Helper function that generates a state transition (conditional goto) from a state and an SDFG edge.

Parameters:
  • sdfg – The parent SDFG.

  • edge – The state transition edge to generate.

  • successor – If not None, the state that will be generated right after the current state (used to avoid extraneous gotos).

  • assignments_only – If True, generates only the assignments of the inter-state edge.

  • framecode – Code generator object (used for allocation information).

Returns:

A c++ string representing the state transition code.

last_state: bool = False
state: SDFGState
class dace.codegen.control_flow.SwitchCaseScope(dispatch_state, parent, sdfg, branch_state, switchvar, cases)

Bases: ControlFlow

Simple switch-case scope without fall-through cases.

as_cpp(codegen, symbols)

Returns C++ code for this control flow block.

Parameters:
  • codegen – A code generator object, used for allocation information and defined variables in scope.

  • symbols – A dictionary of symbol names and their types.

Return type:

str

Returns:

C++ string with the generated code of the control flow block.

branch_state: SDFGState

Branching state

cases: Dict[str, GeneralBlock]

Mapping of cases to control flow blocks

property children: List[ControlFlow]

Returns a list of control flow blocks that exist within this block.

property first_state: SDFGState

Returns the first or initializing state in this control flow block. Used to determine which will be the next state in a control flow block to avoid generating extraneous goto calls.

sdfg: SDFG

Parent SDFG

switchvar: str

C++ code for switch expression

class dace.codegen.control_flow.WhileScope(dispatch_state, parent, guard, test, body)

Bases: ControlFlow

While loop block (without break or continue statements).

as_cpp(codegen, symbols)

Returns C++ code for this control flow block.

Parameters:
  • codegen – A code generator object, used for allocation information and defined variables in scope.

  • symbols – A dictionary of symbol names and their types.

Return type:

str

Returns:

C++ string with the generated code of the control flow block.

body: GeneralBlock

Loop body as control flow block

property children: List[ControlFlow]

Returns a list of control flow blocks that exist within this block.

property first_state: SDFGState

Returns the first or initializing state in this control flow block. Used to determine which will be the next state in a control flow block to avoid generating extraneous goto calls.

guard: SDFGState

Loop guard state

test: CodeBlock

While-loop condition

dace.codegen.control_flow.structured_control_flow_tree(sdfg, dispatch_state)

Returns a structured control-flow tree (i.e., with constructs such as branches and loops) from an SDFG, which can be used to generate its code in a compiler- and human-friendly way.

Parameters:

sdfg (SDFG) – The SDFG to iterate over.

Return type:

ControlFlow

Returns:

Control-flow block representing the entire SDFG.

dace.codegen.cppunparse module

class dace.codegen.cppunparse.CPPLocals

Bases: LocalScheme

clear_scope(from_indentation)

Clears all locals defined in indentation ‘from_indentation’ and deeper

define(local_name, lineno, depth, dtype=None)
get_name_type_associations()
is_defined(local_name, current_depth)
class dace.codegen.cppunparse.CPPUnparser(tree, depth, locals, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, indent_output=True, expr_semicolon=True, indent_offset=0, type_inference=False, defined_symbols=None, language=Language.CPP)

Bases: object

Methods in this class recursively traverse an AST and output C++ source code for the abstract syntax; original formatting is disregarded.

binop = {'Add': '+', 'BitAnd': '&', 'BitOr': '|', 'BitXor': '^', 'Div': '/', 'LShift': '<<', 'Mod': '%', 'Mult': '*', 'RShift': '>>', 'Sub': '-'}
boolops = {<class 'ast.And'>: '&&', <class 'ast.Or'>: '||'}
callbools = {'And': <class 'ast.And'>, 'Or': <class 'ast.Or'>}
callcmps = {'Eq': <class 'ast.Eq'>, 'Ge': <class 'ast.GtE'>, 'Gt': <class 'ast.Gt'>, 'GtE': <class 'ast.GtE'>, 'Le': <class 'ast.LtE'>, 'Lt': <class 'ast.Lt'>, 'LtE': <class 'ast.LtE'>, 'Ne': <class 'ast.NotEq'>, 'NotEq': <class 'ast.NotEq'>}
cmpops = {'Eq': '==', 'Gt': '>', 'GtE': '>=', 'Is': '==', 'IsNot': '!=', 'Lt': '<', 'LtE': '<=', 'NotEq': '!='}
dispatch(tree)

Dispatcher function, dispatching tree type T to method _T.

dispatch_lhs_tuple(targets)
enter()

Print ‘{’, and increase the indentation.

fill(text='')

Indent a piece of text, according to the current indentation level

format_conversions = {97: 'a', 114: 'r', 115: 's'}
funcops = {'FloorDiv': (' /', 'dace::math::ifloor'), 'MatMult': (',', 'dace::gemm')}
leave()

Decrease the indentation and print ‘}’.

unop = {'Invert': '~', 'Not': '!', 'UAdd': '+', 'USub': '-'}
unop_lambda = {'Invert': <function CPPUnparser.<lambda>>, 'Not': <function CPPUnparser.<lambda>>, 'UAdd': <function CPPUnparser.<lambda>>, 'USub': <function CPPUnparser.<lambda>>}
write(text)

Append a piece of text to the current line

class dace.codegen.cppunparse.LocalScheme

Bases: object

clear_scope(from_indentation)
define(local_name, lineno, depth)
is_defined(local_name, current_depth)
dace.codegen.cppunparse.cppunparse(node, expr_semicolon=True, locals=None, defined_symbols=None)
dace.codegen.cppunparse.interleave(inter, f, seq, **kwargs)

Call f on each item in seq, calling inter() in between. f can accept optional arguments (kwargs)

dace.codegen.cppunparse.py2cpp(code, expr_semicolon=True, defined_symbols=None)
dace.codegen.cppunparse.pyexpr2cpp(expr)

dace.codegen.dispatcher module

Contains the DaCe code generator target dispatcher, which is responsible for flexible code generation with multiple backends by dispatching certain functionality to registered code generators based on user-defined predicates.

class dace.codegen.dispatcher.DefinedMemlets

Bases: object

Keeps track of the type of defined memlets to ensure that they are referenced correctly in nested scopes and SDFGs. The ones defined in the first (top) scope, refer to global variables.

add(name, dtype, ctype, ancestor=0, allow_shadowing=False)
add_global(name, dtype, ctype)

Adds a global variable (top scope)

enter_scope(parent, can_access_parent=True)
exit_scope(parent)
get(name, ancestor=0, is_global=False)
Return type:

Tuple[DefinedType, str]

has(name, ancestor=0)
remove(name, ancestor=0, is_global=False)
Return type:

Tuple[DefinedType, str]

class dace.codegen.dispatcher.DefinedType(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoNumberEnum

Data types for DefinedMemlets.

See:

DefinedMemlets

ArrayInterface = 7
FPGA_ShiftRegister = 6
Object = 3
Pointer = 1
Scalar = 2
Stream = 4
StreamArray = 5
register(*args)
class dace.codegen.dispatcher.TargetDispatcher(framecode)

Bases: object

Dispatches sub-SDFG generation (according to scope), storage<->storage copies, and storage<->tasklet copies to targets.

property declared_arrays: DefinedMemlets

Returns a list of declared variables.

This is used for variables that must have their declaration and allocation separate. It includes all such variables that have been declared by the dispatcher.

property defined_vars: DefinedMemlets

Returns a list of defined variables.

This includes all variables defined by the dispatcher.

dispatch_allocate(sdfg, dfg, state_id, node, datadesc, function_stream, callsite_stream, declare=True, allocate=True)

Dispatches a code generator for data allocation.

dispatch_copy(src_node, dst_node, edge, sdfg, dfg, state_id, function_stream, output_stream)

Dispatches a code generator for a memory copy operation.

dispatch_deallocate(sdfg, dfg, state_id, node, datadesc, function_stream, callsite_stream)

Dispatches a code generator for a data deallocation.

dispatch_node(sdfg, dfg, state_id, node, function_stream, callsite_stream)

Dispatches a code generator for a single node.

dispatch_output_definition(src_node, dst_node, edge, sdfg, dfg, state_id, function_stream, output_stream)

Dispatches a code generator for an output memlet definition in a tasklet.

dispatch_scope(map_schedule, sdfg, sub_dfg, state_id, function_stream, callsite_stream)

Dispatches a code generator function for a scope in an SDFG state.

dispatch_state(sdfg, state, function_stream, callsite_stream)

Dispatches a code generator for an SDFG state.

dispatch_subgraph(sdfg, dfg, state_id, function_stream, callsite_stream, skip_entry_node=False, skip_exit_node=False)

Dispatches a code generator for a scope subgraph of an SDFGState.

get_array_dispatcher(storage)
get_copy_dispatcher(src_node, dst_node, edge, sdfg, state)

(Internal) Returns a code generator that should be dispatched for a memory copy operation.

get_generic_node_dispatcher()

Returns the default node dispatcher.

get_generic_state_dispatcher()

Returns the default state dispatcher.

get_node_dispatcher(sdfg, state, node)
get_predicated_node_dispatchers()

Returns a list of node dispatchers with predicates.

get_predicated_state_dispatchers()

Returns a list of state dispatchers with predicates.

get_scope_dispatcher(schedule)
get_state_dispatcher(sdfg, state)
register_array_dispatcher(storage_type, func)

Registers a function that processes data allocation, initialization, and deinitialization. Used when calling dispatch_allocate/deallocate/initialize.

Parameters:
  • storage_type – The data storage type that triggers func.

  • func – A TargetCodeGenerator object that contains an implementation of data memory management functions.

See:

TargetCodeGenerator

register_copy_dispatcher(src_storage, dst_storage, dst_schedule, func, predicate=None)

Registers code generation of data-to-data (or data from/to tasklet, if src/dst storage is StorageType.Register) copy functions. Can also be target-schedule specific, or dst_schedule=None if the function will be invoked on any schedule.

Parameters:
  • src_storage – The source data storage type that triggers func.

  • dst_storage – The destination data storage type that triggers func.

  • dst_schedule – An optional destination scope schedule type that triggers func.

  • func – A TargetCodeGenerator object that contains an implementation of copy_memory.

  • predicate – A lambda function that accepts the SDFG, state, and source and destination nodes, and triggers the code generator when True is returned. If None, always dispatches with this dispatcher.

See:

TargetCodeGenerator

register_map_dispatcher(schedule_type, func)

Registers a function that processes a scope, used when calling dispatch_subgraph and dispatch_scope.

Parameters:
  • schedule_type – The scope schedule that triggers func.

  • func – A TargetCodeGenerator object that contains an implementation of generate_scope.

See:

TargetCodeGenerator

register_node_dispatcher(dispatcher, predicate=None)

Registers a code generator that processes a single node, calling generate_node.

Parameters:
  • dispatcher – The code generator to use.

  • predicate – A lambda function that accepts the SDFG, state, and node, and triggers the code generator when True is returned. If None, registers dispatcher as the default node dispatcher.

See:

TargetCodeGenerator

register_state_dispatcher(dispatcher, predicate=None)

Registers a code generator that processes a single state, calling generate_state.

Parameters:
  • dispatcher – The code generator to use.

  • predicate – A lambda function that accepts the SDFG and state, and triggers the code generator when True is returned. If None, registers dispatcher as the default state dispatcher.

See:

TargetCodeGenerator

property used_environments

Returns a list of environments required to build and run the code.

property used_targets

Returns a list of targets (code generators) that were triggered during generation.

dace.codegen.exceptions module

Specialized exception classes for code generator.

exception dace.codegen.exceptions.CodegenError

Bases: Exception

An exception that is raised within SDFG code generation.

exception dace.codegen.exceptions.CompilationError

Bases: Exception

An exception that is raised whenever a compilation error occurs.

exception dace.codegen.exceptions.CompilerConfigurationError

Bases: Exception

An exception that is raised whenever CMake encounters a configuration error.

exception dace.codegen.exceptions.DuplicateDLLError

Bases: Exception

An exception that is raised whenever a library is loaded twice.

dace.codegen.prettycode module

Code I/O stream that automates indentation and mapping of code to SDFG nodes.

class dace.codegen.prettycode.CodeIOStream(base_indentation=0)

Bases: StringIO

Code I/O stream that automates indentation and mapping of code to SDFG nodes.

write(contents, sdfg=None, state_id=None, node_id=None)

Write string to file.

Returns the number of characters written, which is always equal to the length of the string.

Module contents