loopy/transform/iname.py
def remove_unused_inames(knl, inames=None):
    """Delete those among *inames* that are unused, i.e. project them
    out of the domain. If these inames pose implicit restrictions on
    other inames, these restrictions will persist as existentially
    quantified variables.

    :arg inames: may be an iterable of inames or a string of comma-separated inames.
    """

    # {{{ normalize arguments

    if inames is None:
        inames = knl.all_inames()
    elif isinstance(inames, str):
        inames = inames.split(",")

    # }}}

    # {{{ check which inames are unused

    import loopy as lp
    exp_knl = lp.expand_subst(knl)

    inames = set(inames)
    used_inames = set()
    for insn in exp_knl.instructions:
        used_inames.update(
                exp_knl.insn_inames(insn.id)
                | insn.reduction_inames())

    unused_inames = inames - used_inames

    # }}}

    # {{{ remove them

    from loopy.kernel.tools import DomainChanger

    for iname in unused_inames:
        domch = DomainChanger(knl, (iname,))

        dom = domch.domain
        dt, idx = dom.get_var_dict()[iname]
        dom = dom.project_out(dt, idx, 1)

        knl = knl.copy(domains=domch.get_domains_with(dom))

    # }}}

    return knl
Delete those among *inames* that are unused, i.e. project them
    out of the domain. If these inames pose implicit restrictions on
    other inames, these restrictions will persist as existentially
    quantified variables.

    :arg inames: may be an iterable of inames or a string of comma-separated inames.
    
Delete those among *inames* that are unused, i.e. project them
out of the domain. If these inames pose implicit restrictions on
other inames, these restrictions will persist as existentially
quantified variables.
Delete those among * inames * that are unused i . e . project them out of the domain . If these inames pose implicit restrictions on other inames these restrictions will persist as existentially quantified variables .
def remove_unused_inames(knl, inames=None):
    if inames is None:
        inames = knl.all_inames()
    elif isinstance(inames, str):
        inames = inames.split(",")
    import loopy as lp
    exp_knl = lp.expand_subst(knl)
    inames = set(inames)
    used_inames = set()
    for insn in exp_knl.instructions:
        used_inames.update(
                exp_knl.insn_inames(insn.id)
                | insn.reduction_inames())
    unused_inames = inames - used_inames
    from loopy.kernel.tools import DomainChanger
    for iname in unused_inames:
        domch = DomainChanger(knl, (iname,))
        dom = domch.domain
        dt, idx = dom.get_var_dict()[iname]
        dom = dom.project_out(dt, idx, 1)
        knl = knl.copy(domains=domch.get_domains_with(dom))
    return knl
def remove_unused_inames ( knl , inames = None ) : if inames is None : inames = knl . all_inames ( ) elif isinstance ( inames , str ) : inames = inames . split ( "," ) import loopy as lp exp_knl = lp . expand_subst ( knl ) inames = set ( inames ) used_inames = set ( ) for insn in exp_knl . instructions : used_inames . update ( exp_knl . insn_inames ( insn . id ) | insn . reduction_inames ( ) ) unused_inames = inames - used_inames from loopy . kernel . tools import DomainChanger for iname in unused_inames : domch = DomainChanger ( knl , ( iname , ) ) dom = domch . domain dt , idx = dom . get_var_dict ( ) [ iname ] dom = dom . project_out ( dt , idx , 1 ) knl = knl . copy ( domains = domch . get_domains_with ( dom ) ) return knl
Delete those among *inames* that are unused, i.e.
Delete those among * inames * that are unused i . e .
"""Delete those among *inames* that are unused, i.e. project them
    out of the domain. If these inames pose implicit restrictions on
    other inames, these restrictions will persist as existentially
    quantified variables.

    :arg inames: may be an iterable of inames or a string of comma-separated inames.
    """ # {{{ normalize arguments # }}} # {{{ check which inames are unused # }}} # {{{ remove them # }}}
knl
inames
may be an iterable of inames or a string of comma-separated inames.
may be an iterable of inames or a string of comma - separated inames .