From 1ac7603dc1a5c17bbc3448dc3fa10d334367b02e Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Tue, 24 Jul 2012 14:26:54 -0400 Subject: [PATCH] Python 3 fixes. --- pyopencl/scan.py | 10 +++++----- test/test_array.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pyopencl/scan.py b/pyopencl/scan.py index ee2b4e7a..5a736fd6 100644 --- a/pyopencl/scan.py +++ b/pyopencl/scan.py @@ -165,7 +165,7 @@ void ${name_prefix}_scan_intervals( local_fetch_expr_args = set( arg_name - for arg_name, ife_offsets in fetch_expr_offsets.iteritems() + for arg_name, ife_offsets in fetch_expr_offsets.items() if -1 in ife_offsets or len(ife_offsets) > 1) %> @@ -758,7 +758,7 @@ def _make_template(s): from warnings import warn warn("leftover words in identifier prefixing: " + " ".join(leftovers)) - return mako.template.Template(s, strict_undefined=True, disable_unicode=True) + return mako.template.Template(s, strict_undefined=True) from pytools import Record class _ScanKernelInfo(Record): @@ -1265,7 +1265,7 @@ def copy_if(ary, predicate, extra_args=[], queue=None, preamble=""): is an on-device scalar (fetch to host with `count.get()`) indicating how many elements satisfied *predicate*. """ - if len(ary) > np.iinfo(np.uint32): + if len(ary) > np.iinfo(np.uint32).max: scan_dtype = np.uint64 else: scan_dtype = np.uint32 @@ -1334,7 +1334,7 @@ def partition(ary, predicate, extra_args=[], queue=None, preamble=""): is an on-device scalar (fetch to host with `count.get()`) indicating how many elements satisfied the predicate. """ - if len(ary) > np.iinfo(np.uint32): + if len(ary) > np.iinfo(np.uint32).max: scan_dtype = np.uint64 else: scan_dtype = np.uint32 @@ -1395,7 +1395,7 @@ def unique(ary, is_equal_expr="a == b", extra_args=[], queue=None, preamble=""): how many elements satisfied the predicate. """ - if len(ary) > np.iinfo(np.uint32): + if len(ary) > np.iinfo(np.uint32).max: scan_dtype = np.uint64 else: scan_dtype = np.uint32 diff --git a/test/test_array.py b/test/test_array.py index d490aa87..a78e2334 100644 --- a/test/test_array.py +++ b/test/test_array.py @@ -677,7 +677,7 @@ def test_dot(ctx_factory): for a_dtype in dtypes: for b_dtype in dtypes: - print a_dtype, b_dtype + print(a_dtype, b_dtype) a_gpu = general_clrand(queue, (200000,), a_dtype) a = a_gpu.get() b_gpu = general_clrand(queue, (200000,), b_dtype) @@ -943,7 +943,7 @@ def test_segmented_scan(ctx_factory): seg_boundaries_values = [] for i in range(10): seg_boundary_count = max(2, min(100, randrange(0, int(0.4*n)))) - seg_boundaries = [randrange(n) for i in xrange(seg_boundary_count)] + seg_boundaries = [randrange(n) for i in range(seg_boundary_count)] if n >= 1029: seg_boundaries.insert(0, 1028) seg_boundaries.sort() -- GitLab