From 4c5bdb8fe0b2dc259797c7db1068b0d9d9def3f2 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Wed, 10 Jan 2018 18:21:40 -0600 Subject: [PATCH] Rip out fancy level-parallel concurrency management --- sumpy/fmm.py | 53 ++++------------------------------------------------ 1 file changed, 4 insertions(+), 49 deletions(-) diff --git a/sumpy/fmm.py b/sumpy/fmm.py index 79830085..36b07377 100644 --- a/sumpy/fmm.py +++ b/sumpy/fmm.py @@ -147,16 +147,6 @@ class SumpyExpansionWranglerCodeContainer(object): # {{{ expansion wrangler -def _enqueue_barrier(queue, wait_for): - if queue.device.platform.name == "Portable Computing Language": - # pocl 0.13 and below crash on clEnqueueBarrierWithWaitList - evt = cl.enqueue_marker(queue, wait_for=wait_for) - queue.finish() - return evt - else: - return cl.enqueue_barrier(queue, wait_for=wait_for) - - class SumpyExpansionWrangler(object): """Implements the :class:`boxtree.fmm.ExpansionWranglerInterface` by using :mod:`sumpy` expansions/translations. @@ -210,10 +200,6 @@ class SumpyExpansionWrangler(object): self.extra_kwargs = source_extra_kwargs.copy() self.extra_kwargs.update(self.kernel_extra_kwargs) - self.level_queues = [ - cl.CommandQueue(self.code.cl_context) - for i in range(self.tree.nlevels)] - # {{{ data vector utilities def _expansions_level_starts(self, order_to_size): @@ -319,7 +305,6 @@ class SumpyExpansionWrangler(object): kwargs = self.extra_kwargs.copy() kwargs.update(self.box_source_list_kwargs()) - events = [] for lev in range(self.tree.nlevels): p2m = self.code.p2m(self.level_orders[lev]) start, stop = level_start_source_box_nrs[lev:lev+2] @@ -330,25 +315,19 @@ class SumpyExpansionWrangler(object): mpoles, lev) evt, (mpoles_res,) = p2m( - self.level_queues[lev], + self.queue, source_boxes=source_boxes[start:stop], centers=self.tree.box_centers, strengths=src_weights, tgt_expansions=mpoles_view, tgt_base_ibox=level_start_ibox, - wait_for=src_weights.events, rscale=level_to_rscale(self.tree, lev), **kwargs) assert mpoles_res is mpoles_view - events.append(evt) - - evt = _enqueue_barrier(self.queue, wait_for=events) - mpoles.add_event(evt) - return mpoles def coarsen_multipoles(self, @@ -436,7 +415,6 @@ class SumpyExpansionWrangler(object): mpole_exps): local_exps = self.local_expansion_zeros() - events = [] for lev in range(self.tree.nlevels): start, stop = level_start_target_box_nrs[lev:lev+2] if start == stop: @@ -451,7 +429,7 @@ class SumpyExpansionWrangler(object): self.local_expansions_view(local_exps, lev) evt, (local_exps_res,) = m2l( - self.level_queues[lev], + self.queue, src_expansions=source_mpoles_view, src_base_ibox=source_level_start_ibox, @@ -466,16 +444,8 @@ class SumpyExpansionWrangler(object): src_rscale=level_to_rscale(self.tree, lev), tgt_rscale=level_to_rscale(self.tree, lev), - wait_for=mpole_exps.events, - **self.kernel_extra_kwargs) - assert local_exps_res is target_local_exps_view - events.append(evt) - - evt = _enqueue_barrier(self.queue, wait_for=events) - local_exps.add_event(evt) - return local_exps def eval_multipoles(self, @@ -534,7 +504,6 @@ class SumpyExpansionWrangler(object): kwargs = self.extra_kwargs.copy() kwargs.update(self.box_source_list_kwargs()) - events = [] for lev in range(self.tree.nlevels): start, stop = \ level_start_target_or_target_parent_box_nrs[lev:lev+2] @@ -547,7 +516,7 @@ class SumpyExpansionWrangler(object): self.local_expansions_view(local_exps, lev) evt, (result,) = p2l( - self.level_queues[lev], + self.queue, target_boxes=target_or_target_parent_boxes[start:stop], source_box_starts=starts[start:stop+1], source_box_lists=lists, @@ -559,15 +528,9 @@ class SumpyExpansionWrangler(object): rscale=level_to_rscale(self.tree, lev), - wait_for=src_weights.events, - **kwargs) assert result is target_local_exps_view - events.append(evt) - - evt = _enqueue_barrier(self.queue, wait_for=events) - result.add_event(evt) return local_exps @@ -618,7 +581,6 @@ class SumpyExpansionWrangler(object): kwargs = self.kernel_extra_kwargs.copy() kwargs.update(self.box_target_list_kwargs()) - events = [] for lev in range(self.tree.nlevels): start, stop = level_start_target_box_nrs[lev:lev+2] if start == stop: @@ -630,7 +592,7 @@ class SumpyExpansionWrangler(object): self.local_expansions_view(local_exps, lev) evt, pot_res = l2p( - self.level_queues[lev], + self.queue, src_expansions=source_local_exps_view, src_base_ibox=source_level_start_ibox, @@ -641,17 +603,10 @@ class SumpyExpansionWrangler(object): rscale=level_to_rscale(self.tree, lev), - wait_for=local_exps.events, - **kwargs) for pot_i, pot_res_i in zip(pot, pot_res): assert pot_i is pot_res_i - events.append(evt) - - evt = _enqueue_barrier(self.queue, wait_for=events) - for pot_i in pot: - pot_i.add_event(evt) return pot -- GitLab