From b7ecaa8aa2996a598c35bd1d801073a1a8c9cc5e Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Mon, 30 Nov 2015 00:44:47 -0600 Subject: [PATCH] Add ignore_nonexistent kwarg to tag_inames --- loopy/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/loopy/__init__.py b/loopy/__init__.py index b50a4ecf1..eb1e6b31a 100644 --- a/loopy/__init__.py +++ b/loopy/__init__.py @@ -487,7 +487,7 @@ def join_inames(kernel, inames, new_iname=None, tag=None, within=None): # {{{ tag inames -def tag_inames(kernel, iname_to_tag, force=False): +def tag_inames(kernel, iname_to_tag, force=False, ignore_nonexistent=False): from loopy.kernel.data import parse_tag iname_to_tag = dict((iname, parse_tag(tag)) @@ -499,7 +499,10 @@ def tag_inames(kernel, iname_to_tag, force=False): new_iname_to_tag = kernel.iname_to_tag.copy() for iname, new_tag in six.iteritems(iname_to_tag): if iname not in kernel.all_inames(): - raise LoopyError("iname '%s' does not exist" % iname) + if ignore_nonexistent: + continue + else: + raise LoopyError("iname '%s' does not exist" % iname) old_tag = kernel.iname_to_tag.get(iname) -- GitLab