Skip to content

Commit

Permalink
This patch adds builds for Windows (amd64) (#43)
Browse files Browse the repository at this point in the history
This patch adds package builds with Windows (amd64).
  • Loading branch information
ybubnov authored Oct 23, 2024
1 parent e82dacd commit d7f6c3e
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python_build_wheel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-14]
os: [macos-14, windows-latest, ubuntu-latest]

steps:
- uses: actions/checkout@v4
Expand All @@ -24,7 +24,7 @@ jobs:
platforms: all

- name: Build wheels
uses: pypa/cibuildwheel@v2.17.0
uses: pypa/cibuildwheel@v2.20

- uses: actions/upload-artifact@v4
with:
Expand Down
1 change: 0 additions & 1 deletion include/torch_delaunay/triangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ circumcircle2d_kernel(
const at::TensorAccessor<scalar_t, 1> p2
)
{
const auto ax = p0[0], ay = p0[1];
const auto bx = p1[0] - p0[0], by = p1[1] - p0[1];
const auto cx = p2[0] - p0[0], cy = p2[1] - p0[1];

Expand Down
22 changes: 16 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[project]
name = "torch-delaunay"
dynamic = ["version"]
license = {file = "LICENSE"}

description = "The Delaunay triangulation for PyTorch"
authors = [
Expand Down Expand Up @@ -31,7 +30,10 @@ classifiers = [
"Operating System :: MacOS"
]

dependencies = ["shapely>=2.0.0", "torch >= 2.3.0, < 2.4.0"]
dependencies = [
"torch >= 2.3.0, < 2.6.0; sys_platform == 'darwin' or sys_platform == 'linux'",
"torch >= 2.5.0, < 2.6.0; sys_platform == 'win32'",
]


[project.urls]
Expand All @@ -49,13 +51,18 @@ test = [
]


[tool.setuptools]
include-package-data = false

[tool.setuptools.dynamic]
version = {attr = "torch_delaunay.__version__"}


[tool.setuptools.packages.find]
include = ["torch_delaunay*"]

[tool.setuptools.package-data]
torch_delaunay = ["*.cc"]


[build-system]
build-backend = "setuptools.build_meta"
Expand All @@ -66,8 +73,10 @@ requires = [
"numpy >= 1.4.0, < 2.0.0",
"pybind11 >= 2.0.0, < 3.0.0",
"setuptools ~= 70.0.0",
"torch >= 2.3.0, < 2.4.0; sys_platform == 'linux'",
"torch >= 2.3.0, < 2.4.0; sys_platform == 'darwin' or sys_platform == 'win'",
"torch >= 2.3.0, < 2.4.0; sys_platform == 'darwin' or sys_platform == 'linux'",
# Windows package build requires a fix with library import path, which is available
# only after 2.5.0.
"torch >= 2.5.0, < 2.6.0; sys_platform == 'win32'",
"typing-extensions >= 4.8.0",
"wheel >= 0.43.0"
]
Expand Down Expand Up @@ -101,9 +110,10 @@ repair-wheel-command = ""
PIP_INDEX_URL = "https://download.pytorch.org/whl/cpu"
PIP_EXTRA_INDEX_URL = "https://pypi.python.org/simple"

[tool.cibuildwheel.windows]
archs = ["AMD64"]
[tool.cibuildwheel.macos]
archs = ["arm64"]

[tool.cibuildwheel.linux]
archs = ["aarch64", "x86_64"]
manylinux-x86_64-image = "manylinux2014"
Expand Down
9 changes: 5 additions & 4 deletions src/sweephull.cc
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,13 @@ struct shull {
inline void
push_halfedge(int64_t a, int64_t b)
{
TORCH_CHECK(a <= halfedges.size(), "shull2d: encountered wrong half-edge: ", a, " -> ", b);
int64_t halfedges_size = static_cast<int64_t>(halfedges.size());
TORCH_CHECK(a <= halfedges_size, "shull2d: encountered wrong half-edge: ", a, " -> ", b);

if (a < halfedges.size()) {
if (a < halfedges_size) {
halfedges[a] = b;
}
if (a == halfedges.size()) {
if (a == halfedges_size) {
halfedges.push_back(b);
}
}
Expand Down Expand Up @@ -399,7 +400,7 @@ shull2d_seed_kernel(const torch::Tensor& points, std::optional<scalar_t> eps)

// For points p0 and p1, radii of circumscribed circle will be set to `nan`, therefore
// at 0 index will be a point with the minimum radius.
std::size_t i = 0;
int64_t i = 0;
for (; i < values.size(0); i++) {
index2 = indices[i];
p2 = points.index({index2}).view({-1, 2});
Expand Down
2 changes: 1 addition & 1 deletion torch_delaunay/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from typing import Final

__version__: Final[str] = "1.0.0rc3"
__version__: Final[str] = "1.0.0"
3 changes: 2 additions & 1 deletion torch_delaunay/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@

from typing import Optional

import torch_delaunay._C as _C
from torch import Tensor

import torch_delaunay._C as _C


def shull2d(points: Tensor, eps: Optional[float] = None) -> Tensor:
"""Computes Delaunay tessellation for 2-dimensional coordinates.
Expand Down

0 comments on commit d7f6c3e

Please sign in to comment.