Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pytential/qbx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,9 @@ def exec_compute_potential_insn_fmm(self, actx: PyOpenCLArrayContext,
geo_data.tree().user_source_ids,
insn.kernel_arguments, evaluate))

from sumpy.fmm import SumpyTranslationClassesData
translation_classes_data = SumpyTranslationClassesData(actx.queue,
geo_data.traversal())
Comment on lines +606 to +608

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a sumpy-specific interface. How come we're passing ostensibly sumpy-specific data?

tree_indep = self._tree_indep_data_for_wrangler(

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to compute the translation classes as part of the wrangler creation?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrangler doesn't have access to a queue. Should I add that?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just make a private, temporary queue:

with cl.CommandQueue(ctx) as queue:
   ...

target_kernels=insn.target_kernels,
source_kernels=insn.source_kernels)
Expand All @@ -612,7 +615,8 @@ def exec_compute_potential_insn_fmm(self, actx: PyOpenCLArrayContext,
self.qbx_order,
self.fmm_level_to_order,
source_extra_kwargs=source_extra_kwargs,
kernel_extra_kwargs=kernel_extra_kwargs)
kernel_extra_kwargs=kernel_extra_kwargs,
translation_classes_data=translation_classes_data)

from pytential.qbx.geometry import target_state
if actx.to_numpy(actx.np.any(
Expand Down
5 changes: 3 additions & 2 deletions pytential/qbx/fmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,14 @@ class QBXExpansionWrangler(SumpyExpansionWrangler):
def __init__(self, tree_indep, geo_data, dtype,
qbx_order, fmm_level_to_order,
source_extra_kwargs, kernel_extra_kwargs,
_use_target_specific_qbx=None):
translation_classes_data=None, *, _use_target_specific_qbx=None):
if _use_target_specific_qbx:
raise ValueError("TSQBX is not implemented in sumpy")

super().__init__(
tree_indep, geo_data.traversal(),
dtype, fmm_level_to_order, source_extra_kwargs, kernel_extra_kwargs)
dtype, fmm_level_to_order, source_extra_kwargs, kernel_extra_kwargs,
translation_classes_data=translation_classes_data)

self.qbx_order = qbx_order
self.geo_data = geo_data
Expand Down
3 changes: 2 additions & 1 deletion pytential/qbx/fmmlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ class QBXFMMLibExpansionWrangler(FMMLibExpansionWrangler):
def __init__(self, tree_indep, geo_data, dtype,
qbx_order, fmm_level_to_order,
source_extra_kwargs,
kernel_extra_kwargs,
kernel_extra_kwargs, *,
translation_classes_data=None,
_use_target_specific_qbx=None):
# FMMLib is CPU-only. This wrapper gets the geometry out of
# OpenCL-land.
Expand Down
4 changes: 4 additions & 0 deletions pytential/unregularized.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,16 @@ def exec_compute_potential_insn_fmm(self, actx: PyOpenCLArrayContext,
tree_indep = self._tree_indep_data_for_wrangler(
fmm_kernel, target_kernels=insn.target_kernels,
source_kernels=insn.source_kernels)
from sumpy.fmm import SumpyTranslationClassesData
translation_classes_data = SumpyTranslationClassesData(actx.queue,
geo_data.traversal())

from sumpy.fmm import SumpyExpansionWrangler
wrangler = SumpyExpansionWrangler(
tree_indep, geo_data.traversal(),
output_and_expansion_dtype,
self.fmm_level_to_order,
translation_classes_data=translation_classes_data,
source_extra_kwargs=source_extra_kwargs,
kernel_extra_kwargs=kernel_extra_kwargs)

Expand Down