From ecf8eaaa53e08193484f1db6c37b9751ad3f7044 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 4 Dec 2016 21:08:32 -0600 Subject: [PATCH] Make kernel order in instructions deterministic --- pytential/symbolic/compiler.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pytential/symbolic/compiler.py b/pytential/symbolic/compiler.py index ee4b81f2..d24b0a09 100644 --- a/pytential/symbolic/compiler.py +++ b/pytential/symbolic/compiler.py @@ -578,12 +578,12 @@ class OperatorCompiler(IdentityMapper): group = self.group_to_operators[self.op_group_features(expr)] names = [self.get_var_name() for op in group] - kernel_to_index = {} - kernels = [] - for op in group: - if op.kernel not in kernel_to_index: - kernel_to_index[op.kernel] = len(kernels) - kernels.append(op.kernel) + kernels = sorted( + set(op.kernel for op in group), + key=lambda kernel: repr(kernel)) + + kernel_to_index = dict( + (kernel, i) for i, kernel in enumerate(kernels)) from pytools import single_valued from sumpy.kernel import AxisTargetDerivativeRemover -- GitLab