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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
with:
fetch-depth: 0
- name: setup Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: "3.14"
- run: python -m pip install tox
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
fetch-depth: 0
- name: setup Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: "3.14"
- name: install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: "3.14"
- run: python -m pip install tox
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
fetch-depth: 0
- name: setup Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: "3.14"
- run: python -m pip install tox
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: activate MSVC (for torch.compile)
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: activate MSVC (for torch.compile / inductor codegen)
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ line-length = 88

[tool.ruff.lint]
# See https://docs.astral.sh/ruff/rules for additional details
extend-select = [
select = [
"B", # Pyflakes checks (e.g., unused imports, undefined variables)
"D", # PEP 257 docstring conventions (e.g., formatting, consistency)
"E", # Pycodestyle errors (e.g., indentation, whitespace, syntax)
"F", # Pyflakes (e.g., unused imports, undefined names)
"UP", # PyUpgrade rules (e.g., upgrading to modern Python syntax)
"I", # Import conventions (e.g., sorting imports, duplicate imports)
"SIM", # Simplification suggestions (e.g., refactoring redundant code)
Expand Down
10 changes: 9 additions & 1 deletion src/torchpme/lib/mesh_interpolator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import torch


# Runs eagerly: Inductor's CPU backend spuriously raises ZeroDivisionError on
# vectorized `%` with an odd-length divisor (here always 3), see
# https://github.com/pytorch/pytorch/issues/143649
@torch.compiler.disable
def _mesh_index_remainder(indices: torch.Tensor, ns_mesh: torch.Tensor) -> torch.Tensor:
return indices % ns_mesh
Comment thread
PicoCentauri marked this conversation as resolved.


class MeshInterpolator(torch.nn.Module):
"""
Class for handling all steps related to interpolations in the context of a mesh
Expand Down Expand Up @@ -349,7 +357,7 @@ def compute_weights(self, positions: torch.Tensor):
# below.
indices_to_interpolate = torch.stack(
[
(positions_rel_idx + i) % self.ns_mesh
_mesh_index_remainder(positions_rel_idx + i, self.ns_mesh)
for i in range(
1 - (self.interpolation_nodes + 1) // 2,
1 + self.interpolation_nodes // 2,
Expand Down
3 changes: 1 addition & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ deps =
twine
allowlist_externals = bash
commands_pre =
bash -c "if [ -e {toxinidir}/dist/*tar.gz ]; then unlink {toxinidir}/dist/*.whl; fi"
bash -c "if [ -e {toxinidir}/dist/*tar.gz ]; then unlink {toxinidir}/dist/*.tar.gz; fi"
bash -c "rm -f {toxinidir}/dist/*.whl {toxinidir}/dist/*.tar.gz"
commands =
python -m build
twine check dist/*.tar.gz dist/*.whl
Expand Down
Loading