Skip to content
Merged
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
32 changes: 16 additions & 16 deletions .basedpyright/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -35504,50 +35504,50 @@
}
},
{
"code": "reportUnknownArgumentType",
"code": "reportUnknownMemberType",
"range": {
"startColumn": 21,
"endColumn": 34,
"startColumn": 4,
"endColumn": 17,
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"code": "reportUnknownArgumentType",
"range": {
"startColumn": 8,
"endColumn": 21,
"startColumn": 42,
"endColumn": 52,
"lineCount": 1
}
},
{
"code": "reportUnknownArgumentType",
"range": {
"startColumn": 46,
"endColumn": 56,
"startColumn": 25,
"endColumn": 38,
"lineCount": 1
}
},
{
"code": "reportUnknownArgumentType",
"code": "reportUnknownMemberType",
"range": {
"startColumn": 21,
"endColumn": 34,
"startColumn": 4,
"endColumn": 17,
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"code": "reportUnknownArgumentType",
"range": {
"startColumn": 8,
"endColumn": 21,
"startColumn": 41,
"endColumn": 51,
"lineCount": 1
}
},
{
"code": "reportUnknownArgumentType",
"range": {
"startColumn": 45,
"endColumn": 55,
"startColumn": 25,
"endColumn": 38,
"lineCount": 1
}
},
Expand Down
11 changes: 0 additions & 11 deletions boxtree/cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ def process_form_multipoles(self, actx: ArrayContext,
:return: an array of shape (nsource_boxes,), with each entry represents
the cost of the box.
"""
pass

@abstractmethod
def process_coarsen_multipoles(self, actx: ArrayContext,
Expand All @@ -261,7 +260,6 @@ def process_coarsen_multipoles(self, actx: ArrayContext,
immediate clear how per-box cost of upward propagation will be useful for
distributed load balancing.
"""
pass

@abstractmethod
def get_ndirect_sources_per_target_box(self, actx: ArrayContext,
Expand All @@ -273,7 +271,6 @@ def get_ndirect_sources_per_target_box(self, actx: ArrayContext,
:return: an array of shape (ntarget_boxes,), with each entry representing
the number of direct evaluation sources for that target box.
"""
pass

@abstractmethod
def process_direct(self, actx: ArrayContext,
Expand All @@ -294,7 +291,6 @@ def process_direct(self, actx: ArrayContext,
:return: an array of shape (ntarget_boxes,), with each entry represents
the cost of the box.
"""
pass

@abstractmethod
def process_list2(self, actx: ArrayContext, traversal, m2l_cost):
Expand All @@ -306,7 +302,6 @@ def process_list2(self, actx: ArrayContext, traversal, m2l_cost):
each entry representing the cost of multipole-to-local
translations to this box.
"""
pass

@abstractmethod
def process_list3(self, actx: ArrayContext, traversal, m2p_cost,
Expand All @@ -324,7 +319,6 @@ def process_list3(self, actx: ArrayContext, traversal, m2p_cost,
cost of evaluating all targets inside this box from multipole
expansions of list-3 boxes.
"""
pass

@abstractmethod
def process_list4(self, actx: ArrayContext, traversal, p2l_cost):
Expand All @@ -337,7 +331,6 @@ def process_list4(self, actx: ArrayContext, traversal, p2l_cost):
each entry representing the cost of point-to-local translations to
this box.
"""
pass

@abstractmethod
def process_eval_locals(self, actx: ArrayContext, traversal, l2p_cost,
Expand All @@ -354,7 +347,6 @@ def process_eval_locals(self, actx: ArrayContext, traversal, l2p_cost,
:return: an array of shape (ntarget_boxes,), the cost of evaluating the
potentials of all targets inside this box from its local expansion.
"""
pass

@abstractmethod
def process_refine_locals(self, actx: ArrayContext, traversal, l2l_cost):
Expand All @@ -370,7 +362,6 @@ def process_refine_locals(self, actx: ArrayContext, traversal, l2l_cost):
immediate clear how per-box cost of downward propagation will be useful
for distributed load balancing.
"""
pass

@abstractmethod
def aggregate_over_boxes(self, actx: ArrayContext, per_box_result):
Expand All @@ -379,7 +370,6 @@ def aggregate_over_boxes(self, actx: ArrayContext, per_box_result):
:arg per_box_result: an array to be sumed.
:return: a :class:`float`, the result of the sum.
"""
pass

@staticmethod
def cost_factors_to_dev(cost_factors, actx: ArrayContext | None):
Expand Down Expand Up @@ -451,7 +441,6 @@ def zero_cost_per_box(self, actx: ArrayContext, nboxes):
:param nboxes: the number of boxes
:return: an array of shape (*nboxes*,), representing the zero per-box cost.
"""
pass

def cost_per_box(self, actx: ArrayContext, traversal, level_to_order,
calibration_params,
Expand Down
1 change: 0 additions & 1 deletion boxtree/fmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ def communicate_mpoles(self, # noqa: B027
:returns: Statistics of the communication if *return_stats* is True. *None*
otherwise.
"""
pass

# }}}

Expand Down
3 changes: 1 addition & 2 deletions boxtree/pyfmmlib_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@

import numpy as np

import pytools.obj_array as obj_array
from pytools import log_process, memoize_method
from pytools import log_process, memoize_method, obj_array

from boxtree.fmm import ExpansionWranglerInterface, TreeIndependentDataForWrangler

Expand Down
2 changes: 1 addition & 1 deletion boxtree/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ def run_mpi(script: str, num_processes: int, env: dict[str, Any]) -> None:

def get_coord_vec_dtype(
coord_dtype: np.dtype, dimensions: int) -> np.dtype:
import pyopencl.cltypes as cltypes
from pyopencl import cltypes
if dimensions == 1:
return coord_dtype
else:
Expand Down
7 changes: 2 additions & 5 deletions boxtree/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,7 @@ def bounding_box(self) -> tuple[np.ndarray, np.ndarray]:

def get_box_size(self, ibox):
lev = self.box_levels[ibox]
box_size = self.root_extent * 0.5**lev
return box_size
return self.root_extent * 0.5**lev

def get_box_extent(self, ibox):
box_size = self.get_box_size(ibox)
Expand Down Expand Up @@ -1059,7 +1058,7 @@ def get_filter_target_lists_in_user_order_kernel(self, particle_id_dtype,

from boxtree.tools import VectorArg

builder = ListOfListsBuilder(self.context,
return ListOfListsBuilder(self.context,
[("filt_tgt_list", particle_id_dtype)], Template("""//CL//
typedef ${dtype_to_ctype(particle_id_dtype)} particle_id_t;

Expand Down Expand Up @@ -1087,8 +1086,6 @@ def get_filter_target_lists_in_user_order_kernel(self, particle_id_dtype,
VectorArg(particle_id_dtype, "box_target_counts_nonchild"),
])

return builder

def filter_target_lists_in_user_order(self, actx, tree, flags):
"""
:arg flags: an array of length :attr:`boxtree.Tree.ntargets` of
Expand Down
8 changes: 4 additions & 4 deletions boxtree/tree_build_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ def make_morton_bin_count_type(device, dimensions, particle_id_dtype,
fields.append(("nonchild_srcntgts", particle_id_dtype))

from boxtree.tools import padded_bin
for mnr in range(2**dimensions):
fields.append((f"pcnt{padded_bin(mnr, dimensions)}", particle_id_dtype))
fields.extend((f"pcnt{padded_bin(mnr, dimensions)}", particle_id_dtype)
for mnr in range(2**dimensions))
# Morton bin weight totals
for mnr in range(2**dimensions):
fields.append((f"pwt{padded_bin(mnr, dimensions)}", refine_weight_dtype))
fields.extend((f"pwt{padded_bin(mnr, dimensions)}", refine_weight_dtype)
for mnr in range(2**dimensions))

dtype = np.dtype(fields)

Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ required-imports = ["from __future__ import annotations"]
[tool.ruff.lint.per-file-ignores]
"doc/**/*.py" = ["I002"]
"examples/**/*.py" = ["I002"]
"test/test_*.py" = ["S102"]
"doc/conf.py" = ["S102"]

[tool.typos.default]
extend-ignore-re = [
Expand Down
8 changes: 3 additions & 5 deletions test/test_cost_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,11 +583,9 @@ def test_cost_model_op_counts_agree_with_constantone_wrangler(
if not timing_data:
return

mismatches = []
for stage in timing_data:
if timing_data[stage]["ops_elapsed"] != modeled_time[stage]:
mismatches.append(
(stage, timing_data[stage]["ops_elapsed"], modeled_time[stage]))
mismatches = [(stage, timing_data[stage]["ops_elapsed"], modeled_time[stage])
for stage in timing_data
if timing_data[stage]["ops_elapsed"] != modeled_time[stage]]

assert not mismatches, "\n".join(str(s) for s in mismatches)

Expand Down
1 change: 0 additions & 1 deletion test/test_fmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@
(2, 10**5, None, "", p_normal, p_normal, "tree", "linf", "static_linf"),
(3, 5 * 10**5, 4*10**4, "t", p_normal, p_normal, "tree", "linf", "static_linf"), # noqa: E501

(3, 5 * 10**5, 4*10**4, "t", p_normal, p_normal, None, "linf", "static_linf"), # noqa: E501
(3, 5 * 10**5, 4*10**4, "t", p_normal, p_normal, None, "linf", "precise_linf"), # noqa: E501
(3, 5 * 10**5, 4*10**4, "t", p_normal, p_normal, None, "l2", "precise_linf"), # noqa: E501
(3, 5 * 10**5, 4*10**4, "t", p_normal, p_normal, None, "l2", "static_l2"),
Expand Down Expand Up @@ -485,7 +484,7 @@
except ImportError:
have_sumpy = False
from warnings import warn
warn("sumpy unavailable: cannot compute independent reference "

Check warning on line 487 in test/test_fmm.py

View workflow job for this annotation

GitHub Actions / Conda Python 3

sumpy unavailable: cannot compute independent reference values for pyfmmlib

Check warning on line 487 in test/test_fmm.py

View workflow job for this annotation

GitHub Actions / Conda Python 3

sumpy unavailable: cannot compute independent reference values for pyfmmlib
"values for pyfmmlib", stacklevel=1)
else:
have_sumpy = True
Expand Down
2 changes: 1 addition & 1 deletion test/test_traversal.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import numpy.linalg as la
import pytest

import pytools.obj_array as obj_array
from arraycontext import pytest_generate_tests_for_array_contexts
from pytools import obj_array

from boxtree.array_context import (
PytestPyOpenCLArrayContextFactory,
Expand Down
4 changes: 1 addition & 3 deletions test/test_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,7 @@ def run_build_test(builder, actx, dims, dtype, nparticles, visualize,
def particle_tree_test_decorator(f):
f = pytest.mark.opencl(f)
f = pytest.mark.parametrize("dtype", [np.float64, np.float32])(f)
f = pytest.mark.parametrize("dims", [2, 3])(f)

return f
return pytest.mark.parametrize("dims", [2, 3])(f)


@particle_tree_test_decorator
Expand Down
2 changes: 1 addition & 1 deletion test/test_tree_of_boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import numpy as np
import pytest

import pytools.obj_array as obj_array
from arraycontext import pytest_generate_tests_for_array_contexts

# This means boxtree's tests have a hard dependency on meshmode. That's OK.
Expand All @@ -38,6 +37,7 @@
PyOpenCLArrayContext,
PytestPyOpenCLArrayContextFactory,
)
from pytools import obj_array

from boxtree import (
make_meshmode_mesh_from_leaves,
Expand Down
Loading