From 7ea12be5fc1e8de50a399e1af91798a965e5d4a2 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Fri, 1 Sep 2017 17:40:31 -0500 Subject: [PATCH 1/2] Used fixed_parameters in FMM kernels to avoid temp shape fallback warnings. --- sumpy/e2e.py | 12 ++++-------- sumpy/e2p.py | 16 ++++++---------- sumpy/p2e.py | 10 ++++------ sumpy/p2p.py | 20 ++++++++------------ sumpy/qbx.py | 6 ++---- 5 files changed, 24 insertions(+), 40 deletions(-) diff --git a/sumpy/e2e.py b/sumpy/e2e.py index bff0f508..33ba6c31 100644 --- a/sumpy/e2e.py +++ b/sumpy/e2e.py @@ -211,9 +211,8 @@ class E2EFromCSR(E2EBase): name=self.name, assumptions="ntgt_boxes>=1", silenced_warnings="write_race(write_expn*)", - default_offset=lp.auto) - - loopy_knl = lp.fix_parameters(loopy_knl, dim=self.dim) + default_offset=lp.auto, + fixed_parameters=dict(dim=self.dim)) for expn in [self.src_expansion, self.tgt_expansion]: loopy_knl = expn.prepare_loopy_kernel(loopy_knl) @@ -319,11 +318,8 @@ class E2EFromChildren(E2EBase): ] + gather_loopy_arguments([self.src_expansion, self.tgt_expansion]), name=self.name, assumptions="ntgt_boxes>=1", - silenced_warnings="write_race(write_expn*)") - - loopy_knl = lp.fix_parameters(loopy_knl, - dim=self.dim, - nchildren=2**self.dim) + silenced_warnings="write_race(write_expn*)", + fixed_parameters=dict(dim=self.dim, nchildren=2**self.dim)) for expn in [self.src_expansion, self.tgt_expansion]: loopy_knl = expn.prepare_loopy_kernel(loopy_knl) diff --git a/sumpy/e2p.py b/sumpy/e2p.py index 9a2a8bc1..f21473a6 100644 --- a/sumpy/e2p.py +++ b/sumpy/e2p.py @@ -181,11 +181,8 @@ class E2PFromSingleBox(E2PBase): name=self.name, assumptions="ntgt_boxes>=1", silenced_warnings="write_race(write_result*)", - default_offset=lp.auto) - - loopy_knl = lp.fix_parameters(loopy_knl, - dim=self.dim, - nresults=len(result_names)) + default_offset=lp.auto, + fixed_parameters=dict(dim=self.dim, nresults=len(result_names))) loopy_knl = lp.tag_inames(loopy_knl, "idim*:unr") loopy_knl = self.expansion.prepare_loopy_kernel(loopy_knl) @@ -284,11 +281,10 @@ class E2PFromCSR(E2PBase): name=self.name, assumptions="ntgt_boxes>=1", silenced_warnings="write_race(write_result*)", - default_offset=lp.auto) - - loopy_knl = lp.fix_parameters(loopy_knl, - dim=self.dim, - nresults=len(result_names)) + default_offset=lp.auto, + fixed_parameters=dict( + dim=self.dim, + nresults=len(result_names))) loopy_knl = lp.tag_inames(loopy_knl, "idim*:unr") loopy_knl = lp.prioritize_loops(loopy_knl, "itgt_box,itgt,isrc_box") diff --git a/sumpy/p2e.py b/sumpy/p2e.py index b8c60a64..7bacba79 100644 --- a/sumpy/p2e.py +++ b/sumpy/p2e.py @@ -153,9 +153,8 @@ class P2EFromSingleBox(P2EBase): name=self.name, assumptions="nsrc_boxes>=1", silenced_warnings="write_race(write_expn*)", - default_offset=lp.auto) - - loopy_knl = lp.fix_parameters(loopy_knl, dim=self.dim) + default_offset=lp.auto, + fixed_parameters=dict(dim=self.dim)) loopy_knl = self.expansion.prepare_loopy_kernel(loopy_knl) loopy_knl = lp.tag_inames(loopy_knl, "idim*:unr") @@ -253,9 +252,8 @@ class P2EFromCSR(P2EBase): name=self.name, assumptions="ntgt_boxes>=1", silenced_warnings="write_race(write_expn*)", - default_offset=lp.auto) - - loopy_knl = lp.fix_parameters(loopy_knl, dim=self.dim) + default_offset=lp.auto, + fixed_parameters=dict(dim=self.dim)) loopy_knl = self.expansion.prepare_loopy_kernel(loopy_knl) loopy_knl = lp.tag_inames(loopy_knl, "idim*:unr") diff --git a/sumpy/p2p.py b/sumpy/p2p.py index 9e07fbe0..f8c925c8 100644 --- a/sumpy/p2p.py +++ b/sumpy/p2p.py @@ -163,13 +163,11 @@ class P2P(P2PBase): if self.exclude_self else [] ) + gather_loopy_source_arguments(self.kernels), name=self.name, - assumptions="nsources>=1 and ntargets>=1") - - loopy_knl = lp.fix_parameters( - loopy_knl, - dim=self.dim, - nstrengths=self.strength_count, - nresults=len(self.kernels)) + assumptions="nsources>=1 and ntargets>=1", + fixed_parameters=dict( + dim=self.dim, + nstrengths=self.strength_count, + nresults=len(self.kernels))) loopy_knl = lp.tag_inames(loopy_knl, "idim*:unr") @@ -296,13 +294,11 @@ class P2PFromCSR(P2PBase): [lp.GlobalArg("target_to_source", np.int32, shape=("ntargets",))] if self.exclude_self else [] ) + gather_loopy_source_arguments(self.kernels), - name=self.name, assumptions="ntgt_boxes>=1") - - loopy_knl = lp.fix_parameters( - loopy_knl, + name=self.name, assumptions="ntgt_boxes>=1", + fixed_parameters=dict( dim=self.dim, nstrengths=self.strength_count, - nkernels=len(self.kernels)) + nkernels=len(self.kernels))) loopy_knl = lp.tag_inames(loopy_knl, "idim*:unr") loopy_knl = lp.tag_array_axes(loopy_knl, "strength", "sep,C") diff --git a/sumpy/qbx.py b/sumpy/qbx.py index 8892739e..f1df3c38 100644 --- a/sumpy/qbx.py +++ b/sumpy/qbx.py @@ -175,10 +175,8 @@ class LayerPotentialBase(KernelComputation, KernelCacheWrapper): name=self.name, assumptions="nsources>=1 and ntargets>=1", default_offset=lp.auto, - silenced_warnings="write_race(write_lpot*)" - ) - - loopy_knl = lp.fix_parameters(loopy_knl, dim=self.dim) + silenced_warnings="write_race(write_lpot*)", + fixed_parameters=dict(dim=self.dim)) loopy_knl = lp.tag_inames(loopy_knl, "idim*:unr") -- GitLab From 7ec8da143cfc2d8e8ee786984a1717d3cff2a4d7 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Fri, 1 Sep 2017 17:40:31 -0500 Subject: [PATCH 2/2] Missed a kernel and forgot to update requirements. --- setup.py | 2 +- sumpy/e2e.py | 18 ++++++------------ sumpy/e2p.py | 16 ++++++---------- sumpy/p2e.py | 10 ++++------ sumpy/p2p.py | 20 ++++++++------------ sumpy/qbx.py | 6 ++---- 6 files changed, 27 insertions(+), 45 deletions(-) diff --git a/setup.py b/setup.py index fa19cfff..c21f3b92 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ setup(name="sumpy", packages=["sumpy", "sumpy.expansion"], install_requires=[ - "loo.py>=2013.1beta", + "loo.py>=2017.2", "pytools>=2013.5.6", "boxtree>=2013.1", "pytest>=2.3", diff --git a/sumpy/e2e.py b/sumpy/e2e.py index bff0f508..749585e0 100644 --- a/sumpy/e2e.py +++ b/sumpy/e2e.py @@ -211,9 +211,8 @@ class E2EFromCSR(E2EBase): name=self.name, assumptions="ntgt_boxes>=1", silenced_warnings="write_race(write_expn*)", - default_offset=lp.auto) - - loopy_knl = lp.fix_parameters(loopy_knl, dim=self.dim) + default_offset=lp.auto, + fixed_parameters=dict(dim=self.dim)) for expn in [self.src_expansion, self.tgt_expansion]: loopy_knl = expn.prepare_loopy_kernel(loopy_knl) @@ -319,11 +318,8 @@ class E2EFromChildren(E2EBase): ] + gather_loopy_arguments([self.src_expansion, self.tgt_expansion]), name=self.name, assumptions="ntgt_boxes>=1", - silenced_warnings="write_race(write_expn*)") - - loopy_knl = lp.fix_parameters(loopy_knl, - dim=self.dim, - nchildren=2**self.dim) + silenced_warnings="write_race(write_expn*)", + fixed_parameters=dict(dim=self.dim, nchildren=2**self.dim)) for expn in [self.src_expansion, self.tgt_expansion]: loopy_knl = expn.prepare_loopy_kernel(loopy_knl) @@ -413,11 +409,9 @@ class E2EFromParent(E2EBase): "..." ] + gather_loopy_arguments([self.src_expansion, self.tgt_expansion]), name=self.name, assumptions="ntgt_boxes>=1", - silenced_warnings="write_race(write_expn*)") + silenced_warnings="write_race(write_expn*)", + fixed_parameters=dict(dim=self.dim, nchildren=2**self.dim)) - loopy_knl = lp.fix_parameters(loopy_knl, - dim=self.dim, - nchildren=2**self.dim) for expn in [self.src_expansion, self.tgt_expansion]: loopy_knl = expn.prepare_loopy_kernel(loopy_knl) diff --git a/sumpy/e2p.py b/sumpy/e2p.py index 9a2a8bc1..f21473a6 100644 --- a/sumpy/e2p.py +++ b/sumpy/e2p.py @@ -181,11 +181,8 @@ class E2PFromSingleBox(E2PBase): name=self.name, assumptions="ntgt_boxes>=1", silenced_warnings="write_race(write_result*)", - default_offset=lp.auto) - - loopy_knl = lp.fix_parameters(loopy_knl, - dim=self.dim, - nresults=len(result_names)) + default_offset=lp.auto, + fixed_parameters=dict(dim=self.dim, nresults=len(result_names))) loopy_knl = lp.tag_inames(loopy_knl, "idim*:unr") loopy_knl = self.expansion.prepare_loopy_kernel(loopy_knl) @@ -284,11 +281,10 @@ class E2PFromCSR(E2PBase): name=self.name, assumptions="ntgt_boxes>=1", silenced_warnings="write_race(write_result*)", - default_offset=lp.auto) - - loopy_knl = lp.fix_parameters(loopy_knl, - dim=self.dim, - nresults=len(result_names)) + default_offset=lp.auto, + fixed_parameters=dict( + dim=self.dim, + nresults=len(result_names))) loopy_knl = lp.tag_inames(loopy_knl, "idim*:unr") loopy_knl = lp.prioritize_loops(loopy_knl, "itgt_box,itgt,isrc_box") diff --git a/sumpy/p2e.py b/sumpy/p2e.py index b8c60a64..7bacba79 100644 --- a/sumpy/p2e.py +++ b/sumpy/p2e.py @@ -153,9 +153,8 @@ class P2EFromSingleBox(P2EBase): name=self.name, assumptions="nsrc_boxes>=1", silenced_warnings="write_race(write_expn*)", - default_offset=lp.auto) - - loopy_knl = lp.fix_parameters(loopy_knl, dim=self.dim) + default_offset=lp.auto, + fixed_parameters=dict(dim=self.dim)) loopy_knl = self.expansion.prepare_loopy_kernel(loopy_knl) loopy_knl = lp.tag_inames(loopy_knl, "idim*:unr") @@ -253,9 +252,8 @@ class P2EFromCSR(P2EBase): name=self.name, assumptions="ntgt_boxes>=1", silenced_warnings="write_race(write_expn*)", - default_offset=lp.auto) - - loopy_knl = lp.fix_parameters(loopy_knl, dim=self.dim) + default_offset=lp.auto, + fixed_parameters=dict(dim=self.dim)) loopy_knl = self.expansion.prepare_loopy_kernel(loopy_knl) loopy_knl = lp.tag_inames(loopy_knl, "idim*:unr") diff --git a/sumpy/p2p.py b/sumpy/p2p.py index 9e07fbe0..f8c925c8 100644 --- a/sumpy/p2p.py +++ b/sumpy/p2p.py @@ -163,13 +163,11 @@ class P2P(P2PBase): if self.exclude_self else [] ) + gather_loopy_source_arguments(self.kernels), name=self.name, - assumptions="nsources>=1 and ntargets>=1") - - loopy_knl = lp.fix_parameters( - loopy_knl, - dim=self.dim, - nstrengths=self.strength_count, - nresults=len(self.kernels)) + assumptions="nsources>=1 and ntargets>=1", + fixed_parameters=dict( + dim=self.dim, + nstrengths=self.strength_count, + nresults=len(self.kernels))) loopy_knl = lp.tag_inames(loopy_knl, "idim*:unr") @@ -296,13 +294,11 @@ class P2PFromCSR(P2PBase): [lp.GlobalArg("target_to_source", np.int32, shape=("ntargets",))] if self.exclude_self else [] ) + gather_loopy_source_arguments(self.kernels), - name=self.name, assumptions="ntgt_boxes>=1") - - loopy_knl = lp.fix_parameters( - loopy_knl, + name=self.name, assumptions="ntgt_boxes>=1", + fixed_parameters=dict( dim=self.dim, nstrengths=self.strength_count, - nkernels=len(self.kernels)) + nkernels=len(self.kernels))) loopy_knl = lp.tag_inames(loopy_knl, "idim*:unr") loopy_knl = lp.tag_array_axes(loopy_knl, "strength", "sep,C") diff --git a/sumpy/qbx.py b/sumpy/qbx.py index 8892739e..f1df3c38 100644 --- a/sumpy/qbx.py +++ b/sumpy/qbx.py @@ -175,10 +175,8 @@ class LayerPotentialBase(KernelComputation, KernelCacheWrapper): name=self.name, assumptions="nsources>=1 and ntargets>=1", default_offset=lp.auto, - silenced_warnings="write_race(write_lpot*)" - ) - - loopy_knl = lp.fix_parameters(loopy_knl, dim=self.dim) + silenced_warnings="write_race(write_lpot*)", + fixed_parameters=dict(dim=self.dim)) loopy_knl = lp.tag_inames(loopy_knl, "idim*:unr") -- GitLab