From f8cd38b860094b2669decef74e74cf23e51db208 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Mon, 19 Feb 2018 15:40:55 -0600 Subject: [PATCH 1/6] Silence loopy language version warnings --- pytential/qbx/geometry.py | 10 +++++++--- pytential/qbx/interactions.py | 13 +++++++++---- pytential/qbx/refinement.py | 4 +++- pytential/qbx/utils.py | 13 +++++++++---- pytential/unregularized.py | 4 +++- 5 files changed, 31 insertions(+), 13 deletions(-) diff --git a/pytential/qbx/geometry.py b/pytential/qbx/geometry.py index ca53df5a..7cc8e8ea 100644 --- a/pytential/qbx/geometry.py +++ b/pytential/qbx/geometry.py @@ -30,6 +30,7 @@ import pyopencl.array # noqa from pytools import memoize_method from boxtree.tools import DeviceDataRecord import loopy as lp +from loopy.version import MOST_RECENT_LANGUAGE_VERSION from cgen import Enum @@ -125,7 +126,8 @@ class QBXFMMGeometryCodeGetter(TreeCodeContainerMixin): """ targets[dim, i] = points[dim, i] """, - default_offset=lp.auto, name="copy_targets") + default_offset=lp.auto, name="copy_targets", + lang_version=MOST_RECENT_LANGUAGE_VERSION) knl = lp.fix_parameters(knl, ndims=self.ambient_dim) @@ -182,7 +184,8 @@ class QBXFMMGeometryCodeGetter(TreeCodeContainerMixin): "..." ], name="qbx_center_to_target_box_lookup", - silenced_warnings="write_race(tgt_write)") + silenced_warnings="write_race(tgt_write)", + lang_version=MOST_RECENT_LANGUAGE_VERSION) knl = lp.split_iname(knl, "ibox", 128, inner_tag="l.0", outer_tag="g.0") @@ -244,7 +247,8 @@ class QBXFMMGeometryCodeGetter(TreeCodeContainerMixin): lp.ValueArg("ntargets", np.int32), ], name="pick_used_centers", - silenced_warnings="write_race(center_is_used_write)") + silenced_warnings="write_race(center_is_used_write)", + lang_version=MOST_RECENT_LANGUAGE_VERSION) knl = lp.split_iname(knl, "i", 128, inner_tag="l.0", outer_tag="g.0") return knl diff --git a/pytential/qbx/interactions.py b/pytential/qbx/interactions.py index 6105472d..d759763b 100644 --- a/pytential/qbx/interactions.py +++ b/pytential/qbx/interactions.py @@ -24,6 +24,7 @@ THE SOFTWARE. import numpy as np import loopy as lp +from loopy.version import MOST_RECENT_LANGUAGE_VERSION from pytools import memoize_method from six.moves import range @@ -113,7 +114,8 @@ class P2QBXLFromCSR(P2EBase): arguments, name=self.name, assumptions="ntgt_centers>=1", silenced_warnings="write_race(write_expn*)", - fixed_parameters=dict(dim=self.dim)) + fixed_parameters=dict(dim=self.dim), + lang_version=MOST_RECENT_LANGUAGE_VERSION) loopy_knl = self.expansion.prepare_loopy_kernel(loopy_knl) loopy_knl = lp.tag_inames(loopy_knl, "idim*:unr") @@ -209,7 +211,8 @@ class M2QBXL(E2EBase): ] + gather_loopy_arguments([self.src_expansion, self.tgt_expansion]), name=self.name, assumptions="ncenters>=1", silenced_warnings="write_race(write_expn*)", - fixed_parameters=dict(dim=self.dim)) + fixed_parameters=dict(dim=self.dim), + lang_version=MOST_RECENT_LANGUAGE_VERSION) for expn in [self.src_expansion, self.tgt_expansion]: loopy_knl = expn.prepare_loopy_kernel(loopy_knl) @@ -309,7 +312,8 @@ class L2QBXL(E2EBase): name=self.name, assumptions="ncenters>=1", silenced_warnings="write_race(write_expn*)", - fixed_parameters=dict(dim=self.dim, nchildren=2**self.dim)) + fixed_parameters=dict(dim=self.dim, nchildren=2**self.dim), + lang_version=MOST_RECENT_LANGUAGE_VERSION) for expn in [self.src_expansion, self.tgt_expansion]: loopy_knl = expn.prepare_loopy_kernel(loopy_knl) @@ -405,7 +409,8 @@ class QBXL2P(E2PBase): name=self.name, assumptions="nglobal_qbx_centers>=1", silenced_warnings="write_race(write_result*)", - fixed_parameters=dict(dim=self.dim, nresults=len(result_names))) + fixed_parameters=dict(dim=self.dim, nresults=len(result_names)), + lang_version=MOST_RECENT_LANGUAGE_VERSION) loopy_knl = lp.tag_inames(loopy_knl, "idim*:unr") loopy_knl = self.expansion.prepare_loopy_kernel(loopy_knl) diff --git a/pytential/qbx/refinement.py b/pytential/qbx/refinement.py index 5d90a320..08539c68 100644 --- a/pytential/qbx/refinement.py +++ b/pytential/qbx/refinement.py @@ -28,6 +28,7 @@ THE SOFTWARE. import loopy as lp +from loopy.version import MOST_RECENT_LANGUAGE_VERSION import numpy as np import pyopencl as cl @@ -255,7 +256,8 @@ class RefinerCodeContainer(TreeCodeContainerMixin): """, options="return_dict", silenced_warnings="write_race(write_refine_flags_updated)", - name="refine_kernel_length_scale_to_panel_size_ratio") + name="refine_kernel_length_scale_to_panel_size_ratio", + lang_version=MOST_RECENT_LANGUAGE_VERSION) knl = lp.split_iname(knl, "panel", 128, inner_tag="l.0", outer_tag="g.0") return knl diff --git a/pytential/qbx/utils.py b/pytential/qbx/utils.py index ecb939de..6673b450 100644 --- a/pytential/qbx/utils.py +++ b/pytential/qbx/utils.py @@ -32,6 +32,7 @@ from boxtree.tree import Tree import pyopencl as cl import pyopencl.array # noqa from pytools import memoize, memoize_method +from loopy.version import MOST_RECENT_LANGUAGE_VERSION import logging logger = logging.getLogger(__name__) @@ -84,7 +85,8 @@ def get_interleaver_kernel(dtype): lp.GlobalArg("dst", shape=(var("dstlen"),), dtype=dtype), "..." ], - assumptions="2*srclen = dstlen") + assumptions="2*srclen = dstlen", + lang_version=MOST_RECENT_LANGUAGE_VERSION) knl = lp.split_iname(knl, "i", 128, inner_tag="l.0", outer_tag="g.0") return knl @@ -217,7 +219,8 @@ def panel_sizes(discr, last_dim_length): knl = lp.make_kernel( "{[i,j,k]: 0<=i Date: Mon, 19 Feb 2018 16:17:09 -0600 Subject: [PATCH 2/6] Add nosync where appropriate --- pytential/qbx/interactions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pytential/qbx/interactions.py b/pytential/qbx/interactions.py index d759763b..98c4ba94 100644 --- a/pytential/qbx/interactions.py +++ b/pytential/qbx/interactions.py @@ -106,7 +106,7 @@ class P2QBXLFromCSR(P2EBase): """] + [""" qbx_expansions[tgt_icenter, {i}] = \ simul_reduce(sum, (isrc_box, isrc), strength*coeff{i}) \ - {{id_prefix=write_expn}} + {{id_prefix=write_expn,nosync=write_expn*}} """.format(i=i) for i in range(ncoeffs)] + [""" end @@ -188,7 +188,7 @@ class M2QBXL(E2EBase): """] + [""" qbx_expansions[icenter, {i}] = qbx_expansions[icenter, {i}] + \ simul_reduce(sum, isrc_box, coeff{i}) \ - {{id_prefix=write_expn}} + {{id_prefix=write_expn,nosync=write_expn*}} """.format(i=i) for i in range(ncoeff_tgt)] + [""" end @@ -291,7 +291,7 @@ class L2QBXL(E2EBase): ] + self.get_translation_loopy_insns() + [""" qbx_expansions[icenter, {i}] = \ qbx_expansions[icenter, {i}] + coeff{i} \ - {{id_prefix=write_expn}} + {{id_prefix=write_expn,nosync=write_expn*}} """.format(i=i) for i in range(ncoeff_tgt)] + [""" end end -- GitLab From f28fae57b4eb91eb1c748e817c916adfe91d5877 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Tue, 20 Feb 2018 17:08:20 -0600 Subject: [PATCH 3/6] Add another nosync --- pytential/qbx/interactions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytential/qbx/interactions.py b/pytential/qbx/interactions.py index 98c4ba94..061cec36 100644 --- a/pytential/qbx/interactions.py +++ b/pytential/qbx/interactions.py @@ -387,7 +387,7 @@ class QBXL2P(E2PBase): ] + loopy_insns + [""" result[{i},center_itgt] = kernel_scaling * result_{i}_p \ - {{id_prefix=write_result}} + {{id_prefix=write_result,nosync=write_result*}} """.format(i=i) for i in range(len(result_names))] + [""" end end -- GitLab From a6e8a32fb9338a51699a74788b8e170da320c1cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kl=C3=B6ckner?= Date: Wed, 21 Feb 2018 01:40:21 -0500 Subject: [PATCH 4/6] Bump PYTENTIAL_KERNEL_VERSION --- pytential/qbx/interactions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytential/qbx/interactions.py b/pytential/qbx/interactions.py index 061cec36..8426bbf5 100644 --- a/pytential/qbx/interactions.py +++ b/pytential/qbx/interactions.py @@ -33,7 +33,7 @@ from sumpy.e2e import E2EBase from sumpy.e2p import E2PBase -PYTENTIAL_KERNEL_VERSION = 5 +PYTENTIAL_KERNEL_VERSION = 6 # {{{ form qbx expansions from points -- GitLab From c86ab25015e0cc3176757491dc86808d81cde8e1 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Wed, 21 Feb 2018 03:47:43 -0600 Subject: [PATCH 5/6] Use nosync only when there is >1 write statement --- pytential/qbx/interactions.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/pytential/qbx/interactions.py b/pytential/qbx/interactions.py index 061cec36..9430dbca 100644 --- a/pytential/qbx/interactions.py +++ b/pytential/qbx/interactions.py @@ -106,8 +106,11 @@ class P2QBXLFromCSR(P2EBase): """] + [""" qbx_expansions[tgt_icenter, {i}] = \ simul_reduce(sum, (isrc_box, isrc), strength*coeff{i}) \ - {{id_prefix=write_expn,nosync=write_expn*}} - """.format(i=i) for i in range(ncoeffs)] + [""" + {{id_prefix=write_expn{nosync}}} + """.format(i=i, + nosync=",nosync=write_expn*" + if ncoeffs > 1 else "") + for i in range(ncoeffs)] + [""" end """], @@ -188,8 +191,11 @@ class M2QBXL(E2EBase): """] + [""" qbx_expansions[icenter, {i}] = qbx_expansions[icenter, {i}] + \ simul_reduce(sum, isrc_box, coeff{i}) \ - {{id_prefix=write_expn,nosync=write_expn*}} - """.format(i=i) for i in range(ncoeff_tgt)] + [""" + {{id_prefix=write_expn{nosync}}} + """.format(i=i, + nosync=",nosync=write_expn*" + if ncoeff_tgt > 1 else "") + for i in range(ncoeff_tgt)] + [""" end """], @@ -291,8 +297,11 @@ class L2QBXL(E2EBase): ] + self.get_translation_loopy_insns() + [""" qbx_expansions[icenter, {i}] = \ qbx_expansions[icenter, {i}] + coeff{i} \ - {{id_prefix=write_expn,nosync=write_expn*}} - """.format(i=i) for i in range(ncoeff_tgt)] + [""" + {{id_prefix=write_expn{nosync}}} + """.format(i=i, + nosync=",nosync=write_expn*" + if ncoeff_tgt > 1 else "") + for i in range(ncoeff_tgt)] + [""" end end """], @@ -387,8 +396,11 @@ class QBXL2P(E2PBase): ] + loopy_insns + [""" result[{i},center_itgt] = kernel_scaling * result_{i}_p \ - {{id_prefix=write_result,nosync=write_result*}} - """.format(i=i) for i in range(len(result_names))] + [""" + {{id_prefix=write_result{nosync}}} + """.format(i=i, + nosync=",nosync=write_result*" + if len(result_names) > 1 else "") + for i in range(len(result_names))] + [""" end end """], -- GitLab From 8b1f7898ee573a9405759b698cc23f56df58bfeb Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Wed, 21 Feb 2018 15:29:20 -0600 Subject: [PATCH 6/6] Bump kernel version again --- pytential/qbx/interactions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytential/qbx/interactions.py b/pytential/qbx/interactions.py index e952592e..470151f3 100644 --- a/pytential/qbx/interactions.py +++ b/pytential/qbx/interactions.py @@ -33,7 +33,7 @@ from sumpy.e2e import E2EBase from sumpy.e2p import E2PBase -PYTENTIAL_KERNEL_VERSION = 6 +PYTENTIAL_KERNEL_VERSION = 7 # {{{ form qbx expansions from points -- GitLab