Skip to content

Commit

Permalink
attempt to improve compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
majosm committed Aug 14, 2024
1 parent b4b0f1e commit c2ab44f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions arraycontext/impl/pyopencl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ def __init__(self,
if wait_event_queue_length is None:
wait_event_queue_length = 10

# May be True or None; only used by clone()
self._force_device_scalars = force_device_scalars

self._wait_event_queue_length = wait_event_queue_length
self._kernel_name_to_wait_event_queue: Dict[str, List[cl.Event]] = {}

Expand Down Expand Up @@ -295,8 +298,16 @@ def call_loopy(self, t_unit, **kwargs):
return {name: tga.to_tagged_cl_array(ary) for name, ary in result.items()}

def clone(self):
return type(self)(self.queue, self.allocator,
wait_event_queue_length=self._wait_event_queue_length)
if self._force_device_scalars is not None:
# Subclass might still be using the old
# "force_devices_scalars: bool = False" interface, in which case we need
# to explicitly pass force_device_scalars=True
return type(self)(self.queue, self.allocator,
wait_event_queue_length=self._wait_event_queue_length,
force_device_scalars=True)
else:
return type(self)(self.queue, self.allocator,
wait_event_queue_length=self._wait_event_queue_length)

# }}}

Expand Down

0 comments on commit c2ab44f

Please sign in to comment.