gt4py.cartesian.gtc.gtcpp package

Submodules

gt4py.cartesian.gtc.gtcpp.gtcpp module

class gt4py.cartesian.gtc.gtcpp.gtcpp.AccessorRef(data_index: List[Expr] = NOTHING, *, loc: SourceLocation | None = None, dtype: DataType = DataType.AUTO, name: Any, kind: ExprKind = ExprKind.FIELD, offset: CartesianOffset | VariableKOffset | AbsoluteKIndex)[source]

Bases: FieldAccess__Expr_VariableKOffset, Expr

classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.ApiParamDecl(*args: Any, **kwargs: Any)[source]

Bases: LocNode

dtype: DataType
name: SymbolName
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.Arg(*, loc: SourceLocation | None = None, name: Any)[source]

Bases: LocNode

name: SymbolRef
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.AssignStmt(*, loc: SourceLocation | None = None, right: Expr, left: LocalAccess | AccessorRef)[source]

Bases: AssignStmt__gt4py_cartesian_gtc_gtcpp_gtcpp_localaccess_gt4py_cartesian_gtc_gtcpp_gtcpp_accessorref_Expr, Stmt

classmethod _dtype_validation(instance: DataModel) → None
left: LocalAccess | AccessorRef
no_horizontal_offset_in_assignment(attribute: Attribute, value: LocalAccess | AccessorRef) → None[source]
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.AxisLength(*, loc: SourceLocation | None = None, name: Any, axis: int)[source]

Bases: ComputationDecl

axis: int
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.BinaryOp(*, loc: SourceLocation | None = None, kind: ExprKind = ExprKind.FIELD, dtype: DataType = DataType.AUTO, op: ArithmeticOperator | ComparisonOperator | LogicalOperator, left: Expr, right: Expr)[source]

Bases: BinaryOp__Expr, Expr

classmethod _dtype_propagation(instance: BinaryOp) → None
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.BlockStmt(*, loc: SourceLocation | None = None, body: List[Stmt])[source]

Bases: BlockStmt__Stmt, Stmt

classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.Cache(*, loc: SourceLocation | None = None, name: Any)[source]

Bases: LocNode

name: SymbolRef
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.Cast(*, loc: SourceLocation | None = None, kind: ExprKind = ExprKind.FIELD, dtype: DataType, expr: Expr)[source]

Bases: Cast__Expr, Expr

classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.ComputationDecl(*, loc: SourceLocation | None = None, name: Any)[source]

Bases: LocNode

dtype = 14
kind = 1
name: SymbolName
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.Expr(*args: Any, **kwargs: Any)[source]

Bases: Expr

classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.FieldDecl(data_dims: Tuple[Integral, ...] = NOTHING, *, loc: SourceLocation | None = None, name: Any, dtype: DataType, dimensions: Tuple[bool, bool, bool])[source]

Bases: ApiParamDecl

data_dims: Tuple[Integral, ...]
dimensions: Tuple[bool, bool, bool]
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.GTAccessor(*, loc: SourceLocation | None = None, name: Any, id: int, intent: Intent, extent: GTExtent, ndim: int = 3)[source]

Bases: LocNode

extent: GTExtent
id: int
intent: Intent
name: SymbolName
ndim: int
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.GTApplyMethod(*, loc: SourceLocation | None = None, interval: GTInterval, body: List[Stmt], local_variables: List[LocalVarDecl])[source]

Bases: LocNode

body: List[Stmt]
interval: GTInterval
local_variables: List[LocalVarDecl]
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.GTComputationCall(*, loc: SourceLocation | None = None, arguments: List[Arg], extra_decls: List[ComputationDecl], temporaries: List[Temporary], multi_stages: List[GTMultiStage])[source]

Bases: LocNode, SymbolTableTrait

arguments: List[Arg]
extra_decls: List[ComputationDecl]
multi_stages: List[GTMultiStage]
temporaries: List[Temporary]
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.GTExtent(*, loc: SourceLocation | None = None, i: Tuple[int, int], j: Tuple[int, int], k: Tuple[int, int])[source]

Bases: LocNode

i: Tuple[int, int]
j: Tuple[int, int]
k: Tuple[int, int]
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

classmethod zero() → GTExtent[source]
class gt4py.cartesian.gtc.gtcpp.gtcpp.GTFunctor(*, loc: SourceLocation | None = None, name: Any, applies: List[GTApplyMethod], param_list: GTParamList)[source]

Bases: LocNode, SymbolTableTrait

applies: List[GTApplyMethod]
name: SymbolName
param_list: GTParamList
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.GTInterval(*, loc: SourceLocation | None = None, from_level: GTLevel, to_level: GTLevel)[source]

Bases: LocNode

from_level: GTLevel
to_level: GTLevel
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.GTLevel(*, loc: SourceLocation | None = None, splitter: int, offset: int)[source]

Bases: LocNode

offset: int
offset_must_not_be_zero(attribute: Attribute, value: int) → None[source]
splitter: int
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.GTMultiStage(*, loc: SourceLocation | None = None, loop_order: LoopOrder, stages: List[GTStage], caches: List[Cache])[source]

Bases: LocNode

caches: List[Cache]
loop_order: LoopOrder
stages: List[GTStage]
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.GTParamList(*, loc: SourceLocation | None = None, accessors: List[GTAccessor])[source]

Bases: LocNode

accessors: List[GTAccessor]
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.GTStage(*, loc: SourceLocation | None = None, functor: Any, args: List[Arg])[source]

Bases: LocNode

args: List[Arg]
functor: SymbolRef
has_args(attribute: Attribute, value: List[Arg]) → None[source]
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.GlobalParamDecl(*, loc: SourceLocation | None = None, name: Any, dtype: DataType)[source]

Bases: ApiParamDecl

classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.IJCache(*, loc: SourceLocation | None = None, name: Any)[source]

Bases: Cache

classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.IfStmt(*, loc: SourceLocation | None = None, cond: Expr, true_branch: BlockStmt, false_branch: BlockStmt | None = None)[source]

Bases: IfStmt__BlockStmt_Expr, Stmt

classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.Intent(*values)[source]

Bases: StrEnum

IN = 'in'
INOUT = 'inout'
class gt4py.cartesian.gtc.gtcpp.gtcpp.KCache(*, loc: SourceLocation | None = None, name: Any, fill: bool, flush: bool)[source]

Bases: Cache

fill: bool
flush: bool
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.Literal(*, loc: SourceLocation | None = None, value: BuiltInLiteral | str, dtype: DataType, kind: ExprKind = ExprKind.SCALAR)[source]

Bases: Literal, Expr

classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.LocalAccess(*, loc: SourceLocation | None = None, dtype: DataType = DataType.AUTO, name: Any, kind: ExprKind = ExprKind.SCALAR)[source]

Bases: ScalarAccess, Expr

classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.LocalVarDecl(*, loc: SourceLocation | None = None, name: SymbolName, dtype: DataType)[source]

Bases: LocNode

dtype: DataType
name: SymbolName
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.NativeFuncCall(*, loc: SourceLocation | None = None, kind: ExprKind = ExprKind.FIELD, dtype: DataType = DataType.AUTO, func: NativeFunction, args: List[Expr])[source]

Bases: NativeFuncCall__Expr, Expr

classmethod _dtype_propagation(instance: NativeFuncCall) → None
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.Offset(*, i: int, j: int, k: int)[source]

Bases: CartesianOffset

classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.Positional(*, loc: SourceLocation | None = None, name: Any, axis_name: str)[source]

Bases: ComputationDecl

axis_name: str
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.Program(*, loc: SourceLocation | None = None, name: str, parameters: List[ApiParamDecl], functors: List[GTFunctor], gt_computation: GTComputationCall)[source]

Bases: LocNode, ValidatedSymbolTableTrait

classmethod _validate_dtype_is_set(instance: ExprT) → None
functors: List[GTFunctor]
gt_computation: GTComputationCall
name: str
parameters: List[ApiParamDecl]
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.Stmt(*args: Any, **kwargs: Any)[source]

Bases: Stmt

classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.Temporary(data_dims: Tuple[int, ...] = NOTHING, *, loc: SourceLocation | None = None, name: Any, dtype: DataType, dimensions: tuple[bool, bool, bool] = (True, True, True))[source]

Bases: LocNode

data_dims: Tuple[int, ...]
dimensions: tuple[bool, bool, bool]
dtype: DataType
name: SymbolName
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.TernaryOp(*, loc: SourceLocation | None = None, kind: ExprKind = ExprKind.FIELD, dtype: DataType = DataType.AUTO, cond: Expr, true_expr: Expr, false_expr: Expr)[source]

Bases: TernaryOp__Expr, Expr

classmethod _dtype_propagation(instance: TernaryOp) → None
classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.UnaryOp(*, loc: SourceLocation | None = None, kind: ExprKind = ExprKind.FIELD, dtype: DataType = DataType.AUTO, op: UnaryOperator, expr: Expr)[source]

Bases: UnaryOp__Expr, Expr

classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.VariableKOffset(*, k: Expr)[source]

Bases: VariableKOffset__Expr

classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

class gt4py.cartesian.gtc.gtcpp.gtcpp.While(*, loc: SourceLocation | None = None, cond: Expr, body: List[Stmt])[source]

Bases: While__Stmt_Expr, Stmt

classmethod update_forward_refs(localns: dict[str, Any] | None = None) → type[_DataModelT]

Update Data Model class meta-information replacing forwarded type annotations with actual types.

Parameters:

localns – locals dict used in the evaluation of the annotations (globals are automatically taken from model.__module__).

Returns:

The provided class (so it can be used as a decorator too).

gt4py.cartesian.gtc.gtcpp.gtcpp_codegen module

class gt4py.cartesian.gtc.gtcpp.gtcpp_codegen.GTCppCodegen[source]

Bases: TemplatedGenerator, VisitorWithSymbolTableTrait

ApiParamDecl = <gt4py.eve.codegen.FormatTemplate object>
Arg = <gt4py.eve.codegen.FormatTemplate object>
AssignStmt = <gt4py.eve.codegen.FormatTemplate object>
AxisLength = <gt4py.eve.codegen.FormatTemplate object>
BinaryOp = <gt4py.eve.codegen.FormatTemplate object>
BlockStmt = <gt4py.eve.codegen.MakoTemplate object>
Cast = <gt4py.eve.codegen.FormatTemplate object>
DATA_TYPE_TO_CODE: Final[dict[DataType, str]] = {DataType.BOOL: 'bool', DataType.INT8: 'std::int8_t', DataType.INT16: 'std::int16_t', DataType.INT32: 'std::int32_t', DataType.INT64: 'std::int64_t', DataType.FLOAT32: 'float', DataType.FLOAT64: 'double'}
GTAccessor = <gt4py.eve.codegen.FormatTemplate object>
GTApplyMethod = <gt4py.eve.codegen.MakoTemplate object>
GTComputationCall = <gt4py.eve.codegen.MakoTemplate object>
GTExtent = <gt4py.eve.codegen.FormatTemplate object>
GTFunctor = <gt4py.eve.codegen.MakoTemplate object>
GTInterval = <gt4py.eve.codegen.FormatTemplate object>
GTLevel = <gt4py.eve.codegen.FormatTemplate object>
GTMultiStage = <gt4py.eve.codegen.MakoTemplate object>
GTParamList = <gt4py.eve.codegen.MakoTemplate object>
GTStage = <gt4py.eve.codegen.MakoTemplate object>
IJCache = <gt4py.eve.codegen.FormatTemplate object>
IfStmt = <gt4py.eve.codegen.MakoTemplate object>
KCache = <gt4py.eve.codegen.MakoTemplate object>
LocalAccess = <gt4py.eve.codegen.FormatTemplate object>
LocalVarDecl = <gt4py.eve.codegen.FormatTemplate object>
NativeFuncCall = <gt4py.eve.codegen.MakoTemplate object>
Positional = <gt4py.eve.codegen.FormatTemplate object>
Program = <gt4py.eve.codegen.MakoTemplate object>
TernaryOp = <gt4py.eve.codegen.FormatTemplate object>
UNARY_OPERATOR_TO_CODE: Final[dict[UnaryOperator, str]] = {UnaryOperator.POS: '+', UnaryOperator.NEG: '-', UnaryOperator.NOT: '!'}
UnaryOp = <gt4py.eve.codegen.FormatTemplate object>
While = <gt4py.eve.codegen.MakoTemplate object>
_node_visitor_cache_: ClassVar[dict[type, str] | None] = {}

Cache for visitor method names per node class to speed up dispatching. Note that we cache the visitor method name, not the bound method itself, to avoid implicitly caching the visitor state, which could lead to unexpected behavior.

classmethod apply(root: NodeT | bool | bytes | int | float | str | IntEnum | StrEnum, **kwargs: Any) → str[source]

Public method to build a class instance and visit an IR node.

Parameters:
  • root – An IR node.

  • node_templates (optional) – see NodeDumper.

  • dump_function (optional) – see NodeDumper.

  • **kwargs (optional) – custom extra parameters forwarded to visit_NODE_TYPE_NAME().

Returns:

String (or collection of strings) with the dumped version of the root IR node.

visit_AccessorRef(accessor_ref: AccessorRef, *, symtable: Dict[str, GTAccessor], temp_decls: Dict[str, Temporary] | None = None, **kwargs: Any)[source]
visit_BuiltInLiteral(builtin: BuiltInLiteral, **kwargs: Any) → str[source]
visit_DataType(dtype: DataType, **kwargs: Any) → str[source]
visit_GTComputationCall(node: GTComputationCall, **kwargs: Any) → str | Collection[str][source]
visit_Literal(node: Literal, *, in_data_index: bool = False, **kwargs: Any) → str[source]
visit_LoopOrder(looporder: LoopOrder, **kwargs: Any) → str[source]
visit_NativeFunction(func: NativeFunction, **kwargs: Any) → str[source]
visit_Program(node: Program, **kwargs: Any) → str | Collection[str][source]
visit_Temporary(node: Temporary, **kwargs: Any) → str[source]
gt4py.cartesian.gtc.gtcpp.gtcpp_codegen._offset_limit(root: Node) → int[source]

gt4py.cartesian.gtc.gtcpp.oir_to_gtcpp module

class gt4py.cartesian.gtc.gtcpp.oir_to_gtcpp.OIRToGTCpp[source]

Bases: NodeTranslator, VisitorWithSymbolTableTrait

class GTComputationContext(create_symbol_name: 'SymbolNameCreator', temporaries: 'List[gtcpp.Temporary]' = <factory>, positionals: 'Dict[int, gtcpp.Positional]'=<factory>, axis_lengths: 'Dict[int, gtcpp.AxisLength]'=<factory>, _arguments: 'Set[str]' = <factory>)[source]

Bases: object

_arguments: Set[str]
static _make_scalar_accessor(name: str) → AccessorRef[source]
add_arguments(arguments: Set[str]) → GTComputationContext[source]
add_temporaries(temporaries: List[Temporary]) → GTComputationContext[source]
property arguments: List[Arg]
axis_lengths: Dict[int, AxisLength]
create_symbol_name: SymbolNameCreator
property extra_decls: List[ComputationDecl]
make_length(axis: int) → AccessorRef[source]
make_positional(axis: int) → AccessorRef[source]
positionals: Dict[int, Positional]
temporaries: List[Temporary]
class ProgramContext(functors: 'List[gtcpp.GTFunctor]' = <factory>)[source]

Bases: object

add_functor(functor: GTFunctor) → ProgramContext[source]
functors: List[GTFunctor]
_mask_to_expr(mask: common.HorizontalMask, comp_ctx: GTComputationContext) → gtcpp.Expr[source]
_node_visitor_cache_: ClassVar[dict[type, str] | None] = {}

Cache for visitor method names per node class to speed up dispatching. Note that we cache the visitor method name, not the bound method itself, to avoid implicitly caching the visitor state, which could lead to unexpected behavior.

visit_AbsoluteKIndex(node: AbsoluteKIndex, **kwargs: Any) → None[source]
visit_AssignStmt(node: AssignStmt, **kwargs: Any) → AssignStmt[source]
visit_AxisBound(node: AxisBound, *, is_start: bool, **kwargs: Any) → GTLevel[source]
visit_BinaryOp(node: BinaryOp, **kwargs: Any) → BinaryOp[source]
visit_Cast(node: Cast, **kwargs: Any) → Cast[source]
visit_FieldAccess(node: FieldAccess, **kwargs: Any) → AccessorRef[source]
visit_FieldDecl(node: FieldDecl, **kwargs: Any) → FieldDecl[source]
visit_HorizontalExecution(node: oir.HorizontalExecution, *, prog_ctx: ProgramContext, comp_ctx: GTComputationContext, interval: gtcpp.GTInterval, **kwargs: Any) → gtcpp.GTStage[source]
visit_HorizontalRestriction(node: HorizontalRestriction, **kwargs: Any) → IfStmt[source]
visit_IJCache(node: IJCache, **kwargs: Any) → IJCache[source]
visit_Interval(node: Interval, **kwargs: Any) → GTInterval[source]
visit_IteratorAccess(node: IteratorAccess, **kwargs: Any) → None[source]
visit_KCache(node: KCache, **kwargs: Any) → KCache[source]
visit_Literal(node: Literal, **kwargs: Any) → Literal[source]
visit_LocalScalar(node: LocalScalar, **kwargs: Any) → LocalVarDecl[source]
visit_MaskStmt(node: MaskStmt, **kwargs: Any) → IfStmt[source]
visit_NativeFuncCall(node: NativeFuncCall, **kwargs: Any) → NativeFuncCall[source]
visit_RuntimeAxisBound(node: RuntimeAxisBound, **kwargs: Any) → None[source]
visit_ScalarAccess(node: ScalarAccess, **kwargs: Any) → AccessorRef | LocalAccess[source]
visit_ScalarDecl(node: ScalarDecl, **kwargs: Any) → GlobalParamDecl[source]
visit_Stencil(node: Stencil, **kwargs: Any) → Program[source]
visit_Temporary(node: Temporary, **kwargs: Any) → Temporary[source]
visit_TernaryOp(node: TernaryOp, **kwargs: Any) → TernaryOp[source]
visit_UnaryOp(node: UnaryOp, **kwargs: Any) → UnaryOp[source]
visit_VariableKOffset(node: VariableKOffset, **kwargs: Any) → VariableKOffset[source]
visit_VerticalLoop(node: oir.VerticalLoop, *, comp_ctx: GTComputationContext, **kwargs: Any) → gtcpp.GTMultiStage[source]
visit_While(node: While, **kwargs: Any) → While[source]
class gt4py.cartesian.gtc.gtcpp.oir_to_gtcpp.SymbolNameCreator(*args, **kwargs)[source]

Bases: Protocol

__call__(name: str) → str[source]

Call self as a function.

_abc_impl = <_abc._abc_data object>
_is_protocol = True
gt4py.cartesian.gtc.gtcpp.oir_to_gtcpp._extract_accessors(node: Node, temp_names: Set[str]) → List[GTAccessor][source]
gt4py.cartesian.gtc.gtcpp.oir_to_gtcpp._make_axis_offset_expr(bound: AxisBound, axis_index: int, axis_length_accessor: Callable[[int], AccessorRef]) → Expr[source]

Module contents