devito.ir.clusters package¶
Submodules¶
devito.ir.clusters.algorithms module¶
devito.ir.clusters.cluster module¶

class
devito.ir.clusters.cluster.
Cluster
(exprs, ispace, dspace, atomics=None, guards=None)[source]¶ Bases:
devito.ir.clusters.cluster.PartialCluster
A Cluster is an immutable
PartialCluster
.
dspace
¶

exprs
¶

functions
¶

is_dense
¶

is_sparse
¶

ispace
¶

rebuild
(exprs)[source]¶ Build a new cluster with expressions
exprs
having same iteration space and atomics asself
.

squash
(other)[source]¶ Concatenate the expressions in
other
to those inself
.self
andother
must have sameispace
. Duplicate expressions are dropped. TheDataSpace
is updated accordingly.

trace
¶


class
devito.ir.clusters.cluster.
ClusterGroup
[source]¶ Bases:
list
An iterable of :class:`PartialCluster`s.

dspace
¶ Return the cumulative
DataSpace
of this ClusterGroup.

dtype
¶ Return the arithmetic data type of this ClusterGroup. If at least one Cluster is performing floating point arithmetic, then any Cluster performing integer arithmetic is ignored. If two Clusters are performing floating point calculations with different precision, return the data type with highest precision.

finalize
()[source]¶ Return a new ClusterGroup in which all of
self
’s PartialClusters have been turned into actual Clusters.

meta
¶ Return the metadata carried by this ClusterGroup, a 2tuple consisting of data type and data space.

devito.ir.clusters.graph module¶

class
devito.ir.clusters.graph.
FlowGraph
(exprs, **kwargs)[source]¶ Bases:
collections.OrderedDict
A FlowGraph represents an ordered sequence of operations. Operations, of type
Node
, are the nodes of the graph. An edge fromn0
ton1
indicates thatn1
reads fromn0
. For example, the sequence:temp0 = a*b temp1 = temp0*c temp2 = temp0*d temp3 = temp1 + temp2
is represented by the following FlowGraph:
temp0 > temp1     v v temp2 > temp3
The input and output edges of a node
n
are encoded inn.reads
andn.readby
, respectively.Operations may involve scalars and indexed objects (arrays). The indices of the indexed objects represent either “space” or “time” dimensions.

extract
(key, readby=False)[source]¶ Return the list of nodes appearing in
key.reads
, in program order (ie, based on the order in which the nodes appear inself
). Ifreadby is True
, then return instead the list of nodes appearingkey.readby
, in program order.Given the following sequence of operations:
t1 = ... t0 = ... u[i, j] = ... v ... u[3, j] = ... v = t0 + t1 + u[z, k] t2 = ...
Assuming
key == v
andreadby is False
(as by default), return the following list ofNode
objects:[t1, t0, u[i, j], u[3, j]]
If
readby is True
, return:[v, t2]

is_index
(key)[source]¶ Return True if
key
is used as array index in an expression of the FlowGraph, False otherwise.

tensors
¶ Return all occurrences of the tensors in
self
keyed by function.

time_invariant
(expr=None)[source]¶ Check if
expr
is time invariant.expr
may be an expressione
explicitly tracked by the FlowGraph or even a generic subexpression ofe
. If noexpr
is provided, then time invariance of the entire FlowGraph is assessed.

trace
(key, readby=False, strict=False)[source]¶ Return the sequence of operations required to compute the node
key
. Ifreadby = True
, then return the sequence of operations that will depend onkey
, instead. Withstrict = True
, dropkey
from the result.

unknown
¶ Return all symbols appearing in self for which a node is not available.
