From 8e4d2c2f64a7a40faaf2a8e7bd73247d744ba9fb Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 21 Jun 2020 00:23:14 -0500 Subject: [PATCH] Adapt to no events being available for zero-size array allocations --- boxtree/tree_build.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/boxtree/tree_build.py b/boxtree/tree_build.py index 8f652aa..38c69b7 100644 --- a/boxtree/tree_build.py +++ b/boxtree/tree_build.py @@ -220,7 +220,16 @@ class TreeBuilder(object): def zeros(shape, dtype): result = cl.array.zeros(queue, shape, dtype, allocator=allocator) - event, = result.events + if result.events: + event, = result.events + else: + from numbers import Number + if isinstance(shape, Number): + shape = (shape,) + from pytools import product + assert product(shape) == 0 + event = cl.enqueue_marker(queue) + return result, event knl_info = self.get_kernel_info(dimensions, coord_dtype, -- GitLab