From 9a9f41bdd7d670e09261a64bb8e6b1c194dac083 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Thu, 2 Jul 2020 10:23:01 -0500 Subject: [PATCH 1/2] Fix calls to deprecated functions from pytools.obj_array --- boxtree/tools.py | 4 ++-- boxtree/tree_build.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/boxtree/tools.py b/boxtree/tools.py index 9c74d96..b1d223e 100644 --- a/boxtree/tools.py +++ b/boxtree/tools.py @@ -276,8 +276,8 @@ class DeviceDataRecord(Record): def transform_val(val): from pyopencl.algorithm import BuiltList if isinstance(val, np.ndarray) and val.dtype == object: - from pytools.obj_array import with_object_array_or_scalar - return with_object_array_or_scalar(f, val) + from pytools.obj_array import obj_array_vectorize + return obj_array_vectorize(f, val) elif isinstance(val, list): return [transform_val(i) for i in val] elif isinstance(val, BuiltList): diff --git a/boxtree/tree_build.py b/boxtree/tree_build.py index 38c69b7..2d6797b 100644 --- a/boxtree/tree_build.py +++ b/boxtree/tree_build.py @@ -247,10 +247,11 @@ class TreeBuilder(object): # Targets weren't specified. Sources are also targets. Let's # call them "srcntgts". - from pytools.obj_array import is_obj_array, make_obj_array - if is_obj_array(particles): + if isinstance(particles, np.ndarray) and particles.dtype.char == "O": srcntgts = particles else: + assert isinstance(particles, cl.array.Array) + from pytools.obj_array import make_obj_array srcntgts = make_obj_array([ p.with_queue(queue).copy() for p in particles ]) -- GitLab From c2c33a84aa5d8ee61affd83f2cd599504a27a136 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Thu, 2 Jul 2020 10:46:44 -0500 Subject: [PATCH 2/2] Remove too-strict assertion --- boxtree/tree_build.py | 1 - 1 file changed, 1 deletion(-) diff --git a/boxtree/tree_build.py b/boxtree/tree_build.py index 2d6797b..cf4e80b 100644 --- a/boxtree/tree_build.py +++ b/boxtree/tree_build.py @@ -250,7 +250,6 @@ class TreeBuilder(object): if isinstance(particles, np.ndarray) and particles.dtype.char == "O": srcntgts = particles else: - assert isinstance(particles, cl.array.Array) from pytools.obj_array import make_obj_array srcntgts = make_obj_array([ p.with_queue(queue).copy() for p in particles -- GitLab