From 3e0bd06ee4f6d83f3a94641ff1c0f52b7d008e3c Mon Sep 17 00:00:00 2001 From: Matthias Diener Date: Tue, 10 Jan 2023 12:36:56 -0600 Subject: [PATCH 1/5] Support new find_distributed_partition https://github.com/inducer/pytato/pull/393 changes the function signature. --- grudge/array_context.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/grudge/array_context.py b/grudge/array_context.py index 00e6fb0d6..a9018d3dc 100644 --- a/grudge/array_context.py +++ b/grudge/array_context.py @@ -232,7 +232,15 @@ def _dag_to_compiled_func(self, dict_of_named_arrays, self.actx._compile_trace_callback(self.f, "pre_find_distributed_partition", dict_of_named_arrays) - distributed_partition = pt.find_distributed_partition(dict_of_named_arrays) + try: + distributed_partition = pt.find_distributed_partition( + dict_of_named_arrays) + except TypeError: + # https://github.com/inducer/pytato/pull/393 changes the + # function signature + distributed_partition = pt.find_distributed_partition( + self.actx.mpi_communicator, + dict_of_named_arrays) if __debug__: # pylint-ignore-reason: From 6e83bbdb0cabcd86d9a67788b901c0a1279a0f30 Mon Sep 17 00:00:00 2001 From: Matthias Diener Date: Tue, 10 Jan 2023 13:00:13 -0600 Subject: [PATCH 2/5] pylint --- grudge/array_context.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/grudge/array_context.py b/grudge/array_context.py index a9018d3dc..5360caf17 100644 --- a/grudge/array_context.py +++ b/grudge/array_context.py @@ -238,7 +238,11 @@ def _dag_to_compiled_func(self, dict_of_named_arrays, except TypeError: # https://github.com/inducer/pytato/pull/393 changes the # function signature + # pylint: disable=too-many-function-args distributed_partition = pt.find_distributed_partition( + # pylint-ignore-reason: + # '_BasePytatoArrayContext' has no 'mpi_communicator' member + # pylint: disable=no-member self.actx.mpi_communicator, dict_of_named_arrays) From 39ecfed395e5c146185a0b993c9a36471bc5c4fc Mon Sep 17 00:00:00 2001 From: Matthias Diener Date: Tue, 10 Jan 2023 14:04:35 -0600 Subject: [PATCH 3/5] flake8 --- grudge/array_context.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grudge/array_context.py b/grudge/array_context.py index 5360caf17..c8a78d745 100644 --- a/grudge/array_context.py +++ b/grudge/array_context.py @@ -240,8 +240,9 @@ def _dag_to_compiled_func(self, dict_of_named_arrays, # function signature # pylint: disable=too-many-function-args distributed_partition = pt.find_distributed_partition( - # pylint-ignore-reason: - # '_BasePytatoArrayContext' has no 'mpi_communicator' member + # pylint-ignore-reason: + # '_BasePytatoArrayContext' has no + # 'mpi_communicator' member # pylint: disable=no-member self.actx.mpi_communicator, dict_of_named_arrays) From 33bf9c5b2c5e79474eb8acf47cd7b8aaf21a7265 Mon Sep 17 00:00:00 2001 From: Matthias Diener Date: Thu, 19 Jan 2023 15:08:18 -0600 Subject: [PATCH 4/5] only catch one type of TypeError Co-authored-by: Matt Smith --- grudge/array_context.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/grudge/array_context.py b/grudge/array_context.py index c8a78d745..30a3b5311 100644 --- a/grudge/array_context.py +++ b/grudge/array_context.py @@ -232,20 +232,21 @@ def _dag_to_compiled_func(self, dict_of_named_arrays, self.actx._compile_trace_callback(self.f, "pre_find_distributed_partition", dict_of_named_arrays) - try: - distributed_partition = pt.find_distributed_partition( - dict_of_named_arrays) - except TypeError: - # https://github.com/inducer/pytato/pull/393 changes the - # function signature - # pylint: disable=too-many-function-args - distributed_partition = pt.find_distributed_partition( - # pylint-ignore-reason: - # '_BasePytatoArrayContext' has no - # 'mpi_communicator' member - # pylint: disable=no-member - self.actx.mpi_communicator, - dict_of_named_arrays) + # https://github.com/inducer/pytato/pull/393 changes the function signature + try: + # pylint: disable=too-many-function-args + distributed_partition = pt.find_distributed_partition( + # pylint-ignore-reason: + # '_BasePytatoArrayContext' has no + # 'mpi_communicator' member + # pylint: disable=no-member + self.actx.mpi_communicator, dict_of_named_arrays) + except TypeError as e: + if "find_distributed_partition() takes 1 positional" in str(e): + distributed_partition = pt.find_distributed_partition( + dict_of_named_arrays) + else: + raise if __debug__: # pylint-ignore-reason: From 6e8e23bba6eada34407c2925642b19bde45a4ea4 Mon Sep 17 00:00:00 2001 From: Matthias Diener Date: Thu, 19 Jan 2023 15:10:04 -0600 Subject: [PATCH 5/5] flake8 --- grudge/array_context.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/grudge/array_context.py b/grudge/array_context.py index 30a3b5311..d672a68ad 100644 --- a/grudge/array_context.py +++ b/grudge/array_context.py @@ -232,21 +232,21 @@ def _dag_to_compiled_func(self, dict_of_named_arrays, self.actx._compile_trace_callback(self.f, "pre_find_distributed_partition", dict_of_named_arrays) - # https://github.com/inducer/pytato/pull/393 changes the function signature - try: - # pylint: disable=too-many-function-args - distributed_partition = pt.find_distributed_partition( - # pylint-ignore-reason: - # '_BasePytatoArrayContext' has no - # 'mpi_communicator' member - # pylint: disable=no-member - self.actx.mpi_communicator, dict_of_named_arrays) - except TypeError as e: - if "find_distributed_partition() takes 1 positional" in str(e): - distributed_partition = pt.find_distributed_partition( - dict_of_named_arrays) - else: - raise + # https://github.com/inducer/pytato/pull/393 changes the function signature + try: + # pylint: disable=too-many-function-args + distributed_partition = pt.find_distributed_partition( + # pylint-ignore-reason: + # '_BasePytatoArrayContext' has no + # 'mpi_communicator' member + # pylint: disable=no-member + self.actx.mpi_communicator, dict_of_named_arrays) + except TypeError as e: + if "find_distributed_partition() takes 1 positional" in str(e): + distributed_partition = pt.find_distributed_partition( + dict_of_named_arrays) + else: + raise if __debug__: # pylint-ignore-reason: