From 1ef92ce89ff533edb5a198a78a539f7c92b8acc8 Mon Sep 17 00:00:00 2001 From: Jack Betteridge Date: Tue, 11 Jun 2024 16:12:25 +0100 Subject: [PATCH] Reset numbering when generating --- pyop2/codegen/rep2loopy.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyop2/codegen/rep2loopy.py b/pyop2/codegen/rep2loopy.py index dbdfed4b2..897a770da 100644 --- a/pyop2/codegen/rep2loopy.py +++ b/pyop2/codegen/rep2loopy.py @@ -13,7 +13,7 @@ import pymbolic.primitives as pym from collections import OrderedDict, defaultdict -from functools import singledispatch, reduce +from functools import singledispatch, reduce, partial import itertools import operator @@ -401,6 +401,12 @@ def bounds(exprs): def generate(builder, wrapper_name=None): + # Reset all terminal counters to avoid generated code becoming different across ranks + Argument._count = defaultdict(partial(itertools.count)) + Index._count = itertools.count() + Materialise._count = itertools.count() + RuntimeIndex._count = itertools.count() + if builder.layer_index is not None: outer_inames = frozenset([builder._loop_index.name, builder.layer_index.name])