From 5d5838e686133e736536f70c59624b15b6571a74 Mon Sep 17 00:00:00 2001 From: Hao Gao Date: Mon, 19 Feb 2018 22:04:40 -0600 Subject: [PATCH] fix eliminate empty list bug --- pyopencl/algorithm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyopencl/algorithm.py b/pyopencl/algorithm.py index 0d6b9f58..73e43d56 100644 --- a/pyopencl/algorithm.py +++ b/pyopencl/algorithm.py @@ -864,7 +864,7 @@ class ListOfListsBuilder: __global ${index_t} *num_non_empty_list """ from sys import version_info - if (version_info > (3, 0)): + if version_info > (3, 0): arguments = Template(arguments) else: arguments = Template(arguments, disable_unicode=True) @@ -876,7 +876,7 @@ class ListOfListsBuilder: input_expr="count[i] == 0 ? 0 : 1", scan_expr="a+b", neutral="0", output_statement=""" - compressed_indices[i + 1] = item; + if (i + 1 < N) compressed_indices[i + 1] = item; if (prev_item != item) { nonempty_indices[item - 1] = i; compressed_counts[item - 1] = count[i]; -- GitLab