From 0755d8a4d2044b0ddf24bd6dee372445753bbf3f Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Fri, 18 Nov 2011 12:16:11 -0500 Subject: [PATCH] Fix passing of stage 1 arguments to stage 2 of reduction. --- pyopencl/reduction.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pyopencl/reduction.py b/pyopencl/reduction.py index 9b62dd08..1d9972e9 100644 --- a/pyopencl/reduction.py +++ b/pyopencl/reduction.py @@ -225,7 +225,11 @@ def get_reduction_kernel(stage, map_expr = "in[i]" if stage == 2: - arguments = "__global const %s *in" % out_type + in_arg = "__global const %s *in" % out_type + if arguments: + arguments = in_arg + ", " + arguments + else: + arguments = in_arg inf = get_reduction_source( ctx, out_type, out_type_size, @@ -293,6 +297,8 @@ class ReductionKernel: if kwargs: raise TypeError("invalid keyword argument to reduction kernel") + stage1_args = args + while True: invocation_args = [] vectors = [] @@ -345,7 +351,7 @@ class ReductionKernel: return result else: stage_inf = self.stage_2_inf - args = [result] + args = (result,) + stage1_args -- GitLab