devito.dle package


devito.dle.blocking_utils module

devito.dle.blocking_utils.fold_blockable_tree(node, exclude_innermost=False)[source]

Create IterationFold`s from sequences of nested :class:`Iteration.


Unfold nested IterationFold.


Given a section of Iteration/Expression tree as below:

for i = 1 to N-1  // folded
  for j = 1 to N-1  // folded

Assuming a fold with offset 1 in both /i/ and /j/ and body foo2(), create:

for i = 1 to N-1
  for j = 1 to N-1
for i = 2 to N-2
  for j = 2 to N-2

devito.dle.transformer module

devito.dle.transformer.transform(node, mode='basic', options=None)[source]

Transform Iteration/Expression trees to generate highly optimized C code.

  • node – The Iteration/Expression tree to be transformed, or an iterable of Iteration/Expression trees.
  • mode – Drive the tree transformation. mode is a string indicating a certain optimization pipeline.
  • options – A dictionary with additional information to drive the DLE.

The mode parameter accepts the following values:

* 'noop': Do nothing.
* 'basic': Add instructions to avoid denormal numbers and create elemental
           functions for rapid JIT-compilation.
* 'advanced': 'basic', vectorization, loop blocking.
* 'speculative': Apply all of the 'advanced' transformations, plus other
                 transformations that might increase (or possibly decrease)

The options parameter accepts the following values:

* 'blockshape': The block shape for loop blocking (a tuple).
* 'blockinner': By default, loop blocking is not applied to the innermost
                dimension of an Iteration/Expression tree (to maximize
                vectorization). Set this flag to True to override this
* 'blockalways': Apply blocking even though the DLE thinks it's not
                 worthwhile applying it.

Module contents