Skip to content
Snippets Groups Projects
Commit 60761ff2 authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Test, fix scan index preservation property.

parent 815a9f07
No related branches found
No related tags found
Loading
......@@ -312,7 +312,7 @@ void ${name_prefix}_scan_intervals(
}
else
%endif
sum = SCAN_EXPR(tmp, sum);
sum = SCAN_EXPR(sum, tmp);
ldata[k][LID_0] = sum;
}
......
......@@ -908,6 +908,28 @@ def test_unique(ctx_factory):
assert (a_unique_dev.get()[:count_unique_dev] == a_unique_host).all()
@pytools.test.mark_test.opencl
def test_index_preservation(ctx_factory):
context = ctx_factory()
queue = cl.CommandQueue(context)
for n in scan_test_counts:
from pyopencl.scan import GenericScanKernel
knl = GenericScanKernel(
context, np.int32,
arguments="__global int *out",
input_expr="i",
scan_expr="b", neutral="0",
output_statement="""
out[i] = item;
""")
out = cl_array.empty(queue, n, dtype=np.int32)
knl(out)
assert (out.get() == np.arange(n)).all()
@pytools.test.mark_test.opencl
def test_segmented_scan(ctx_factory):
context = ctx_factory()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment