fastscapelib.flow.numba.flow_kernel.NumbaFlowKernel

class fastscapelib.flow.numba.flow_kernel.NumbaFlowKernel(kernel, func, apply_dir, outputs, n_threads, generated_code, generated_spec, node_data_create, node_data_init, node_data_getter, node_data_setter, node_data_free)

Immutable Proxy object representing a numba jit-compiled flow kernel function.

It is returned by create_flow_kernel() and required by apply_kernel() alongside the NumbaFlowKernelData mapping object.

kernel

An internal object used to pass and execute the flow kernel either from C++ or from numba jit-compiled code.

Type:

object

func

The numba-compiled kernel function, which accepts one argument (the kernel’s node data as an instance of a numba jit-compiled class).

Type:

callable

apply_dir

The direction and order in which the flow kernel will be applied along the graph.

Type:

FlowGraphTraversalDir

outputs

The names of the kernel output variables.

Type:

tuple

n_threads

Number of threads to use for applying the kernel function in parallel along the flow graph (if equal to 1, the kernel is applied sequentially).

Type:

int

generated_code

A dictionary with the source code generated for each of the functions below.

Type:

dict

generated_spec

The numba types of the attributes of the jit-compiled classes used by the kernel.

Type:

tuple

node_data_create

Internal numba compiled function used to create the kernel’s node data object (one instance per each thread).

Type:

callable

node_data_init

Internal numba jit-compiled function used to initialize node data scalar values.

Type:

callable or None

node_data_getter

Internal numba jit-compiled function used to get grid data values at the current node, its receivers and its donors.

Type:

callable

node_data_setter

Internal numba jit-compiled function used to set grid data values from the kernel’s data at the current node, its receivers and its donors.

Type:

callable

node_data_free

Used internally to de-allocate memory used by the kernel’s node data.

Type:

object

__init__(kernel, func, apply_dir, outputs, n_threads, generated_code, generated_spec, node_data_create, node_data_init, node_data_getter, node_data_setter, node_data_free)

Methods

__init__(kernel, func, apply_dir, outputs, ...)

Attributes