From e0a85759d60b26a5e6b0b15ea876c69c25efd17a Mon Sep 17 00:00:00 2001 From: Alex Fikl Date: Thu, 8 Mar 2018 15:54:19 -0600 Subject: [PATCH 1/8] update LayerPotentialOnTargetAndCenterSubset --- .pytest_cache/v/cache/lastfailed | 21 +++++++ pytential/qbx/direct.py | 100 ++++++++++++++++++------------- 2 files changed, 81 insertions(+), 40 deletions(-) create mode 100644 .pytest_cache/v/cache/lastfailed diff --git a/.pytest_cache/v/cache/lastfailed b/.pytest_cache/v/cache/lastfailed new file mode 100644 index 00000000..fdfc5685 --- /dev/null +++ b/.pytest_cache/v/cache/lastfailed @@ -0,0 +1,21 @@ +{ + "test/test_layer_pot.py::test_off_surface_eval[ctx_getter=>-False]": true, + "test/test_layer_pot.py::test_off_surface_eval[ctx_getter=>-False]": true, + "test/test_layer_pot.py::test_off_surface_eval[ctx_getter=>-False]": true, + "test/test_layer_pot.py::test_off_surface_eval[ctx_getter=>-False]": true, + "test/test_layer_pot.py::test_off_surface_eval[ctx_getter=>-False]": true, + "test/test_layer_pot.py::test_off_surface_eval[ctx_getter=>-False]": true, + "test/test_layer_pot.py::test_off_surface_eval[ctx_getter=>-False]": true, + "test/test_layer_pot_eigenvalues.py::test_ellipse_eigenvalues[ctx_getter=>-1-5-3-False]": true, + "test/test_layer_pot_eigenvalues.py::test_ellipse_eigenvalues[ctx_getter=>-1-5-3-False]": true, + "test/test_layer_pot_eigenvalues.py::test_ellipse_eigenvalues[ctx_getter=>-1-5-4-False]": true, + "test/test_layer_pot_eigenvalues.py::test_ellipse_eigenvalues[ctx_getter=>-1-6-3-False]": true, + "test/test_layer_pot_eigenvalues.py::test_ellipse_eigenvalues[ctx_getter=>-1-7-5-False]": true, + "test/test_layer_pot_identity.py::test_identity_convergence[ctx_getter=>-case11]": true, + "test/test_layer_pot_identity.py::test_identity_convergence[ctx_getter=>-case2]": true, + "test/test_layer_pot_identity.py::test_identity_convergence[ctx_getter=>-case3]": true, + "test/test_layer_pot_identity.py::test_identity_convergence[ctx_getter=>-case4]": true, + "test/test_layer_pot_identity.py::test_identity_convergence[ctx_getter=>-case9]": true, + "test/test_scalar_int_eq.py::test_integral_equation[ctx_getter=>-case6]": true, + "test/test_scalar_int_eq.py::test_integral_equation[ctx_getter=>-case7]": true +} \ No newline at end of file diff --git a/pytential/qbx/direct.py b/pytential/qbx/direct.py index 6dc5cd9a..9eebef8f 100644 --- a/pytential/qbx/direct.py +++ b/pytential/qbx/direct.py @@ -31,54 +31,74 @@ from sumpy.qbx import LayerPotential as LayerPotentialBase # {{{ qbx applier on a target/center subset class LayerPotentialOnTargetAndCenterSubset(LayerPotentialBase): - def get_compute_a_and_b_vecs(self): - return """ - <> icenter = qbx_center_numbers[itgt] - <> itgt_overall = qbx_tgt_numbers[itgt] - for idim - <> a[idim] = center[idim,icenter] - src[idim,isrc] {id=compute_a} - <> b[idim] = tgt[idim,itgt_overall] - center[idim,icenter] \ - {id=compute_b} - <> rscale = expansion_radii[icenter] - end - """ - - def get_src_tgt_arguments(self): - return [ + default_name = "qbx_tgt_ctr_subset" + + def get_kernel(self): + loopy_insns, result_names = self.get_loopy_insns_and_result_names() + kernel_exprs = self.get_kernel_exprs(result_names) + + from sumpy.tools import gather_loopy_source_arguments + arguments = ( + gather_loopy_source_arguments(self.kernels) + + [ lp.GlobalArg("src", None, shape=(self.dim, "nsources"), order="C"), lp.GlobalArg("tgt", None, shape=(self.dim, "ntargets_total"), order="C"), lp.GlobalArg("center", None, - shape=(self.dim, "ncenters_total"), order="C"), - lp.GlobalArg("expansion_radii", None, shape="ncenters_total"), - lp.GlobalArg("qbx_tgt_numbers", None, shape="ntargets"), - lp.GlobalArg("qbx_center_numbers", None, shape="ntargets"), + shape=(self.dim, "ncenters_total"), dim_tags="sep,C"), + lp.GlobalArg("expansion_radii", None, + shape="ncenters_total"), + lp.GlobalArg("qbx_tgt_numbers", None, + shape="ntargets"), + lp.GlobalArg("qbx_center_numbers", None, + shape="ntargets"), lp.ValueArg("nsources", np.int32), lp.ValueArg("ntargets", np.int32), lp.ValueArg("ntargets_total", np.int32), - lp.ValueArg("ncenters_total", np.int32), - ] - - def get_input_and_output_arguments(self): - return [ - lp.GlobalArg("strength_%d" % i, None, shape="nsources", order="C") - for i in range(self.strength_count) - ]+[ - lp.GlobalArg("result_%d" % i, None, shape="ntargets_total", - order="C") - for i in range(len(self.kernels)) - ] - - def get_result_store_instructions(self): - return [ - """ - result_KNLIDX[itgt_overall] = \ - knl_KNLIDX_scaling*simul_reduce(\ - sum, isrc, pair_result_KNLIDX) {inames=itgt} - """.replace("KNLIDX", str(iknl)) - for iknl in range(len(self.expansions)) - ] + lp.ValueArg("ncenters_total", np.int32)] + + [lp.GlobalArg("strength_%d" % i, None, + shape="nsources", order="C") + for i in range(self.strength_count)] + + [lp.GlobalArg("result_%d" % i, self.value_dtypes[i], + shape="ntargets_total", order="C") + for i in range(len(self.kernels))]) + + loopy_knl = lp.make_kernel([ + "{[itgt]: 0 <= itgt < ntargets}", + "{[isrc]: 0 <= isrc < nsources}", + "{[idim]: 0 <= idim < dim}" + ], + self.get_kernel_scaling_assignments() + + ["for itgt, isrc"] + + [""" + <> icenter = qbx_center_numbers[itgt] + <> itgt_overall = qbx_tgt_numbers[itgt] + + <> a[idim] = center[idim, icenter] - src[idim, isrc] \ + {dup=idim} + <> b[idim] = tgt[idim, itgt_overall] - center[idim, icenter] \ + {dup=idim} + <> rscale = expansion_radii[icenter] + """] + + loopy_insns + kernel_exprs + + [""" + result_{i}[itgt_overall] = knl_{i}_scaling * \ + simul_reduce(sum, isrc, pair_result_{i}) \ + {{inames=itgt}} + """.format(i=iknl) + for iknl in range(len(self.expansions))] + +["end"], + arguments, + name=self.name, + assumptions="ntargets>=1 and nsources>=1", + fixed_parameters=dict(dim=self.dim)) + + loopy_knl = lp.tag_inames(loopy_knl, "idim*:unr") + for expn in self.expansions: + loopy_knl = expn.prepare_loopy_kernel(loopy_knl) + + return loopy_knl # }}} -- GitLab From 203b6c134ba2c2bf19be90f08a98305d9bd3ee08 Mon Sep 17 00:00:00 2001 From: Alex Fikl Date: Thu, 8 Mar 2018 16:44:08 -0600 Subject: [PATCH 2/8] update requirements --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8925c34e..abad1181 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,5 +7,5 @@ git+https://github.com/inducer/islpy git+https://github.com/inducer/loopy git+https://gitlab.tiker.net/inducer/boxtree git+https://github.com/inducer/meshmode -git+https://gitlab.tiker.net/inducer/sumpy +git+https://gitlab.tiker.net/fikl2/sumpy@p2p-cleanup git+https://github.com/inducer/pyfmmlib -- GitLab From 087a9d4ef805d7d76674b9b3e8089d3352c5ede6 Mon Sep 17 00:00:00 2001 From: Alex Fikl Date: Thu, 8 Mar 2018 16:53:30 -0600 Subject: [PATCH 3/8] flake8 fix --- pytential/qbx/direct.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytential/qbx/direct.py b/pytential/qbx/direct.py index 9eebef8f..5ea022f7 100644 --- a/pytential/qbx/direct.py +++ b/pytential/qbx/direct.py @@ -88,7 +88,7 @@ class LayerPotentialOnTargetAndCenterSubset(LayerPotentialBase): {{inames=itgt}} """.format(i=iknl) for iknl in range(len(self.expansions))] - +["end"], + + ["end"], arguments, name=self.name, assumptions="ntargets>=1 and nsources>=1", -- GitLab From c7f56b462fb41ace21bbcbfb791a670deeec969b Mon Sep 17 00:00:00 2001 From: Alex Fikl Date: Thu, 8 Mar 2018 21:55:41 -0600 Subject: [PATCH 4/8] remove .pytest_cache --- .pytest_cache/v/cache/lastfailed | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 .pytest_cache/v/cache/lastfailed diff --git a/.pytest_cache/v/cache/lastfailed b/.pytest_cache/v/cache/lastfailed deleted file mode 100644 index fdfc5685..00000000 --- a/.pytest_cache/v/cache/lastfailed +++ /dev/null @@ -1,21 +0,0 @@ -{ - "test/test_layer_pot.py::test_off_surface_eval[ctx_getter=>-False]": true, - "test/test_layer_pot.py::test_off_surface_eval[ctx_getter=>-False]": true, - "test/test_layer_pot.py::test_off_surface_eval[ctx_getter=>-False]": true, - "test/test_layer_pot.py::test_off_surface_eval[ctx_getter=>-False]": true, - "test/test_layer_pot.py::test_off_surface_eval[ctx_getter=>-False]": true, - "test/test_layer_pot.py::test_off_surface_eval[ctx_getter=>-False]": true, - "test/test_layer_pot.py::test_off_surface_eval[ctx_getter=>-False]": true, - "test/test_layer_pot_eigenvalues.py::test_ellipse_eigenvalues[ctx_getter=>-1-5-3-False]": true, - "test/test_layer_pot_eigenvalues.py::test_ellipse_eigenvalues[ctx_getter=>-1-5-3-False]": true, - "test/test_layer_pot_eigenvalues.py::test_ellipse_eigenvalues[ctx_getter=>-1-5-4-False]": true, - "test/test_layer_pot_eigenvalues.py::test_ellipse_eigenvalues[ctx_getter=>-1-6-3-False]": true, - "test/test_layer_pot_eigenvalues.py::test_ellipse_eigenvalues[ctx_getter=>-1-7-5-False]": true, - "test/test_layer_pot_identity.py::test_identity_convergence[ctx_getter=>-case11]": true, - "test/test_layer_pot_identity.py::test_identity_convergence[ctx_getter=>-case2]": true, - "test/test_layer_pot_identity.py::test_identity_convergence[ctx_getter=>-case3]": true, - "test/test_layer_pot_identity.py::test_identity_convergence[ctx_getter=>-case4]": true, - "test/test_layer_pot_identity.py::test_identity_convergence[ctx_getter=>-case9]": true, - "test/test_scalar_int_eq.py::test_integral_equation[ctx_getter=>-case6]": true, - "test/test_scalar_int_eq.py::test_integral_equation[ctx_getter=>-case7]": true -} \ No newline at end of file -- GitLab From 7f520078e0236c0cd120a14ab93a1d57a60d711d Mon Sep 17 00:00:00 2001 From: Alex Fikl Date: Sun, 11 Mar 2018 17:02:43 -0500 Subject: [PATCH 5/8] update conda test requirements --- .test-conda-env-py3-requirements.txt | 2 +- pytential/qbx/direct.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.test-conda-env-py3-requirements.txt b/.test-conda-env-py3-requirements.txt index fa6c0426..69094225 100644 --- a/.test-conda-env-py3-requirements.txt +++ b/.test-conda-env-py3-requirements.txt @@ -1,5 +1,5 @@ git+https://gitlab.tiker.net/inducer/boxtree git+https://github.com/inducer/pymbolic git+https://github.com/inducer/loopy -git+https://gitlab.tiker.net/inducer/sumpy +git+https://gitlab.tiker.net/fikl2/sumpy@p2p-cleanup git+https://github.com/inducer/meshmode diff --git a/pytential/qbx/direct.py b/pytential/qbx/direct.py index 5ea022f7..8f65e436 100644 --- a/pytential/qbx/direct.py +++ b/pytential/qbx/direct.py @@ -25,7 +25,7 @@ THE SOFTWARE. import loopy as lp import numpy as np -from sumpy.qbx import LayerPotential as LayerPotentialBase +from sumpy.qbx import LayerPotentialBase # {{{ qbx applier on a target/center subset -- GitLab From d4abe00df8bb55ff34afb49c001d58fcb9332c73 Mon Sep 17 00:00:00 2001 From: Alex Fikl Date: Sun, 11 Mar 2018 18:29:31 -0500 Subject: [PATCH 6/8] LayerPotentialOnTargetAndCenterSubset: make class callable again --- pytential/qbx/direct.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pytential/qbx/direct.py b/pytential/qbx/direct.py index 8f65e436..70fa0d1a 100644 --- a/pytential/qbx/direct.py +++ b/pytential/qbx/direct.py @@ -100,7 +100,16 @@ class LayerPotentialOnTargetAndCenterSubset(LayerPotentialBase): return loopy_knl -# }}} + def __call__(self, queue, targets, sources, centers, strengths, expansion_radii, + **kwargs): + knl = self.get_cached_optimized_kernel() + + for i, dens in enumerate(strengths): + kwargs["strength_%d" % i] = dens + return knl(queue, src=sources, tgt=targets, center=centers, + expansion_radii=expansion_radii, **kwargs) + +# }}} # vim: foldmethod=marker -- GitLab From c53d4fb788c14116314d7e9cd39abc847306803c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kl=C3=B6ckner?= Date: Thu, 15 Mar 2018 16:16:17 -0400 Subject: [PATCH 7/8] Point .test-conda-env-py3-requirements.txt back at sumpy master --- .test-conda-env-py3-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.test-conda-env-py3-requirements.txt b/.test-conda-env-py3-requirements.txt index 69094225..fa6c0426 100644 --- a/.test-conda-env-py3-requirements.txt +++ b/.test-conda-env-py3-requirements.txt @@ -1,5 +1,5 @@ git+https://gitlab.tiker.net/inducer/boxtree git+https://github.com/inducer/pymbolic git+https://github.com/inducer/loopy -git+https://gitlab.tiker.net/fikl2/sumpy@p2p-cleanup +git+https://gitlab.tiker.net/inducer/sumpy git+https://github.com/inducer/meshmode -- GitLab From 9a8eddda2c9933d193209fd758037b2bb28cc306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kl=C3=B6ckner?= Date: Thu, 15 Mar 2018 16:33:12 -0400 Subject: [PATCH 8/8] Point requirements.txt back at sumpy master --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index abad1181..8925c34e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,5 +7,5 @@ git+https://github.com/inducer/islpy git+https://github.com/inducer/loopy git+https://gitlab.tiker.net/inducer/boxtree git+https://github.com/inducer/meshmode -git+https://gitlab.tiker.net/fikl2/sumpy@p2p-cleanup +git+https://gitlab.tiker.net/inducer/sumpy git+https://github.com/inducer/pyfmmlib -- GitLab