Warning

You are reading a version of the website built against the unstable main branch. This content is liable to change without notice and may be inappropriate for your use case. You can find the documentation for the current stable release here.

pyop3.expr package

Subpackages

Submodules

pyop3.expr.base module

class pyop3.expr.base.Abs(a)[source]

Bases: UnaryOperator

property local_max
property local_min
property symbol
class pyop3.expr.base.Add(a, b)[source]

Bases: BinaryOperator

property local_max
property local_min
class pyop3.expr.base.AxisVar(axis)[source]

Bases: TerminalExpression

AxisVar(axis: ‘pyop3.axis_tree.Axis’)

axis
collect_buffers(visitor)[source]
property dtype
get_disk_cache_key(visitor)[source]
get_instruction_executor_cache_key(visitor)
property local_max
property local_min
record_new(**attrs)

Create and initialise a new record from an existing one.

class pyop3.expr.base.BinaryOperator(a, b)[source]

Bases: Operator

BinaryOperator(a: ‘ExpressionT’, b: ‘ExpressionT’)

a
b
child_attrs = ('a', 'b')
collect_buffers(visitor)[source]
property dtype
get_disk_cache_key(visitor)[source]
get_instruction_executor_cache_key(visitor)
property operands
record_new(**attrs)

Create and initialise a new record from an existing one.

with_operands(operands)[source]
class pyop3.expr.base.Comparison(a, b)[source]

Bases: BinaryOperator

property local_max
property local_min
class pyop3.expr.base.Conditional(a, b, c)[source]

Bases: TernaryOperator

Conditional(a: ‘ExpressionT’, b: ‘ExpressionT’, c: ‘ExpressionT’)

property if_false
property if_true
property local_max
property local_min
property predicate
record_new(**attrs)

Create and initialise a new record from an existing one.

class pyop3.expr.base.Div(a, b)[source]

Bases: BinaryOperator

class pyop3.expr.base.Expression[source]

Bases: Node, ABC

property dtype
property local_max
property local_min
class pyop3.expr.base.FloorDiv(a, b)[source]

Bases: BinaryOperator

class pyop3.expr.base.GreaterThan(a, b)[source]

Bases: Comparison

class pyop3.expr.base.GreaterThanOrEqual(a, b)[source]

Bases: Comparison

class pyop3.expr.base.LessThan(a, b)[source]

Bases: Comparison

class pyop3.expr.base.LessThanOrEqual(a, b)[source]

Bases: Comparison

class pyop3.expr.base.LoopIndexVar(loop_index, axis)[source]

Bases: TerminalExpression

LoopIndexVar(loop_index, axis) -> ‘None’

axis
collect_buffers(visitor)[source]
property dtype
get_disk_cache_key(visitor)[source]
get_instruction_executor_cache_key(visitor)
property local_max
property local_min
loop_index
record_new(**attrs)

Create and initialise a new record from an existing one.

class pyop3.expr.base.Modulo(a, b)[source]

Bases: BinaryOperator

class pyop3.expr.base.Mul(a, b)[source]

Bases: BinaryOperator

property local_max
property local_min
class pyop3.expr.base.NaN[source]

Bases: TerminalExpression

NaN()

property dtype
classmethod get_custom_comm()[source]
get_disk_cache_key(visitor)[source]
get_instruction_executor_cache_key(visitor)
property local_max
property local_min
record_new(**attrs)

Create and initialise a new record from an existing one.

class pyop3.expr.base.NameVar(name)[source]

Bases: TerminalExpression

Class for representing arbitrary variables.

They are useful for evaluating arbitrary symbolic expressions where something like an \(AxisVar\) would be inappropriate (due to there not being an axis available).

dtype()[source]
name
record_new(**attrs)

Create and initialise a new record from an existing one.

class pyop3.expr.base.NamedTerminalExpression[source]

Bases: TerminalExpression

A terminal with a name.

This type is important because only named terminals can be replaced when an operation is reused. For example we can only do the following:

loop = op3.loop(p, kernel(dat1[p]))
loop(**{"dat": dat2})  # pass dat2 instead of dat1

if dat1 is a named terminal.

class pyop3.expr.base.Neg(a)[source]

Bases: UnaryOperator

property local_max
property local_min
property symbol
class pyop3.expr.base.Operator[source]

Bases: Expression

abstract property operands
abstractmethod with_operands(operands)[source]
class pyop3.expr.base.Or(a, b)[source]

Bases: Comparison

class pyop3.expr.base.Pow(a, b)[source]

Bases: BinaryOperator

property local_max
property local_min
class pyop3.expr.base.Sub(a, b)[source]

Bases: BinaryOperator

property local_max
property local_min
class pyop3.expr.base.TerminalExpression[source]

Bases: Expression, Terminal, ABC

child_attrs = ()
class pyop3.expr.base.TernaryOperator(a, b, c)[source]

Bases: Operator

TernaryOperator(a: ‘ExpressionT’, b: ‘ExpressionT’, c: ‘ExpressionT’)

a
b
c
child_attrs = ('a', 'b', 'c')
collect_buffers(visitor)[source]
property dtype
get_disk_cache_key(visitor)[source]
get_instruction_executor_cache_key(visitor)
property operands
record_new(**attrs)

Create and initialise a new record from an existing one.

with_operands(operands)[source]
class pyop3.expr.base.UnaryOperator(a)[source]

Bases: Operator

UnaryOperator(a: ‘ExpressionT’)

a
child_attrs = ('a',)
collect_buffers(visitor)[source]
property dtype
get_disk_cache_key(visitor)[source]
get_instruction_executor_cache_key(visitor)
property operand
property operands
record_new(**attrs)

Create and initialise a new record from an existing one.

abstract property symbol
with_operands(operands)[source]
pyop3.expr.base.as_str(expr)[source]
pyop3.expr.base.as_str(expr)
pyop3.expr.base.as_str(expr)
pyop3.expr.base.as_str(expr)
pyop3.expr.base.as_str(expr)
pyop3.expr.base.conditional(predicate, if_true, if_false)[source]
pyop3.expr.base.get_loop_tree(expr)[source]
pyop3.expr.base.loopified_shape(expr)[source]

pyop3.expr.buffer module

class pyop3.expr.buffer.BufferExpression[source]

Bases: Expression

assign(other, *, _weakref=True)[source]
property buffer
property dtype
iassign(other, *, _weakref=True)[source]
property name
class pyop3.expr.buffer.DatBufferExpression[source]

Bases: BufferExpression

class pyop3.expr.buffer.LinearBufferExpression[source]

Bases: BufferExpression

class pyop3.expr.buffer.LinearDatBufferExpression(buffer_view, layout)[source]

Bases: DatBufferExpression, LinearBufferExpression

A dat with fixed (?) layout.

It cannot be indexed.

This class is useful for describing arrays used in index expressions, at which point it has a fixed set of axes.

buffer_view
child_attrs = ('layout',)
collect_buffers(visitor)[source]
property comm
concretize()[source]
get_disk_cache_key(visitor)[source]
get_instruction_executor_cache_key(visitor)[source]
layout
property local_max
property local_min
record_new(**attrs)

Create and initialise a new record from an existing one.

class pyop3.expr.buffer.MatArrayBufferExpression(buffer_view, row_layouts, column_layouts)[source]

Bases: MatBufferExpression, NonlinearBufferExpression

MatArrayBufferExpression(buffer_view, row_layouts, column_layouts)

buffer_view
child_attrs = ('row_layouts', 'column_layouts')
collect_buffers(visitor)[source]
column_layouts
get_disk_cache_key(visitor)[source]
property local_max
property local_min
record_new(**attrs)

Create and initialise a new record from an existing one.

row_layouts
class pyop3.expr.buffer.MatBufferExpression[source]

Bases: BufferExpression

class pyop3.expr.buffer.MatPetscMatBufferExpression(buffer_view, row_layout, column_layout)[source]

Bases: MatBufferExpression, LinearBufferExpression

MatPetscMatBufferExpression(buffer_view: ‘pyop3.buffer.IndexedBuffer’, row_layout: ‘ExpressionT’, column_layout: ‘ExpressionT’)

buffer_view
child_attrs = ('row_layout', 'column_layout')
collect_buffers(visitor)[source]
column_layout
get_disk_cache_key(visitor)[source]
property local_max
property local_min
record_new(**attrs)

Create and initialise a new record from an existing one.

row_layout
class pyop3.expr.buffer.NonlinearBufferExpression[source]

Bases: BufferExpression

class pyop3.expr.buffer.NonlinearDatBufferExpression(buffer_view, layouts)[source]

Bases: DatBufferExpression, NonlinearBufferExpression

A dat with fixed layouts.

This class is useful for describing dats whose layouts have been optimised.

buffer_view
child_attrs = ('layouts',)
collect_buffers(visitor)[source]
property comm
get_disk_cache_key(visitor)[source]
layouts
property leaf_layouts
linearize(path, *, allow_partial=False)[source]
property local_max
property local_min
record_new(**attrs)

Create and initialise a new record from an existing one.

class pyop3.expr.buffer.ScalarBufferExpression(buffer_view)[source]

Bases: BufferExpression

ScalarBufferExpression(buffer_view: ‘AbstractBuffer | pyop3.buffer.IndexedBuffer’) -> ‘None’

buffer_view
child_attrs = ()
collect_buffers(visitor)[source]
get_disk_cache_key(visitor)[source]
get_instruction_executor_cache_key(visitor)
property local_max
property local_min
record_new(**attrs)

Create and initialise a new record from an existing one.

property value
pyop3.expr.buffer.as_linear_buffer_expression(obj)[source]

pyop3.expr.opaque module

class pyop3.expr.opaque.OpaqueTerminal(buffer_view, *, name=None, prefix=None)[source]

Bases: NamedTerminalExpression

A data object that we don’t know anything about but the local kernel does.

This class is useful for blindly passing arguments into local kernels without doing any packing/unpacking.

DEFAULT_PREFIX = 'opaque'
property buffer
buffer_view
collect_buffers(visitor)[source]
property comm
get_disk_cache_key(visitor)[source]
get_instruction_executor_cache_key(visitor)
name
nest_indices = ()
record_new(**attrs)

Create and initialise a new record from an existing one.

with_context(ctx)[source]

Module contents