Exemplo n.º 1
0
    def test_index_mode_detection(self, indexed, expected):
        """
        Test detection of IterationInstance access modes (AFFINE vs IRREGULAR).

        Proper detection of access mode is a prerequisite to any sort of
        data dependence analysis.
        """
        grid = Grid(shape=(4, 4, 4))
        x, y, z = grid.dimensions  # noqa

        sx = SubDimension.middle('sx', x, 1, 1)  # noqa

        u = Function(name='u', grid=grid)  # noqa
        c = Constant(name='c')  # noqa
        sc = Scalar(name='sc', is_const=True)  # noqa
        s = Scalar(name='s')  # noqa

        ii = IterationInstance(eval(indexed))
        assert ii.index_mode == expected
Exemplo n.º 2
0
 def ii_literal(self, fa, fc):
     fax = IterationInstance(fa[x])
     fcxy = IterationInstance(fc[x, y])
     fcx1y = IterationInstance(fc[x + 1, y])
     return fax, fcxy, fcx1y
Exemplo n.º 3
0
 def ii_num(self, fa, fc):
     fa4 = IterationInstance(fa[4])
     fc00 = IterationInstance(fc[0, 0])
     fc11 = IterationInstance(fc[1, 1])
     fc23 = IterationInstance(fc[2, 3])
     return fa4, fc00, fc11, fc23