From a66c7a55e6a5a45e4d6468d9e95c4a28e3a7bdfa Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Fri, 9 Dec 2016 11:58:48 -0600 Subject: [PATCH 1/2] Make sure order of type declarations in template-generated kernels is the same every time --- pyopencl/tools.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyopencl/tools.py b/pyopencl/tools.py index 36fafbc3..c7bd5ed0 100644 --- a/pyopencl/tools.py +++ b/pyopencl/tools.py @@ -458,7 +458,7 @@ class _CDeclList: if dtype in vec.type_to_scalar_and_count: return - for name, field_data in six.iteritems(dtype.fields): + for name, field_data in sorted(six.iteritems(dtype.fields)): field_dtype, offset = field_data[:2] self.add_dtype(field_dtype) @@ -846,12 +846,12 @@ class _TemplateRenderer(object): if arguments is not None: cdl.visit_arguments(arguments) - for tv in six.itervalues(self.type_aliases): + for _, tv in sorted(six.iteritems(self.type_aliases)): cdl.add_dtype(tv) type_alias_decls = [ "typedef %s %s;" % (dtype_to_ctype(val), name) - for name, val in six.iteritems(self.type_aliases) + for name, val in sorted(six.iteritems(self.type_aliases)) ] return cdl.get_declarations() + "\n" + "\n".join(type_alias_decls) -- GitLab From 2853fb7faeb2c7437805ba08a80af5c8f29e9f7a Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Fri, 9 Dec 2016 11:59:02 -0600 Subject: [PATCH 2/2] Tidy up imports in scan --- pyopencl/scan.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pyopencl/scan.py b/pyopencl/scan.py index 0ea9e01e..93339eba 100644 --- a/pyopencl/scan.py +++ b/pyopencl/scan.py @@ -1,10 +1,6 @@ """Scan primitive.""" -from __future__ import division -from __future__ import absolute_import -import six -from six.moves import range -from six.moves import zip +from __future__ import division, absolute_import __copyright__ = """ Copyright 2011-2012 Andreas Kloeckner @@ -28,6 +24,9 @@ Derived from code within the Thrust project, https://github.com/thrust/thrust/ """ +import six +from six.moves import range, zip + import numpy as np import pyopencl as cl -- GitLab