Skip to content

Commit 80ec64b

Browse files
committed
switching back to general python package + clean of useless files
1 parent 0725d12 commit 80ec64b

16 files changed

+169
-351
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "ext/nanobind"]
2+
path = ext/nanobind
3+
url = https://github.com/wjakob/nanobind

CMakeLists.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
cmake_minimum_required(VERSION 3.20)
2+
project(lcstorch)
3+
find_package(Python 3.8 COMPONENTS Interpreter Development.Module REQUIRED)
4+
5+
set(CMAKE_CXX_STANDARD 20)
6+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
7+
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)
8+
9+
# optimized release build
10+
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
11+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
12+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
13+
endif()
14+
15+
# find nanobind
16+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ext/nanobind)
17+
18+
# Build the extensions
19+
nanobind_add_module(lcstorch src/cpu/lcs_cpu.cpp)
20+
# target_link_libraries(lcstorch PRIVATE lcstorch)
21+
# install(TARGETS lcstorch LIBRARY DESTINATION lcstorch)

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
# LCSTorch
22

33
Longest Common Subsequence (LCS) extension for PyTorch tensors
4+
5+
## TODOs
6+
7+
* batch methods, i.e. supporting 2D arrays;
8+
* batch methods with any number of dimensions (nD array) and add a `dim` argument;
9+
* make it work with an unlimited number of sequences, and set `dim` and `pad_token` as kwargs only;

cuda/lcs_cuda.cpp

-33
This file was deleted.

cuda/lcs_cuda_kernel.cu

-116
This file was deleted.

ext/nanobind

Submodule nanobind added at 25a844a

lcs.cpp

-80
This file was deleted.

lcs.h

-8
This file was deleted.

lcs_batched.cpp

-56
This file was deleted.

old.pyproject.toml pyproject.toml

+14-6
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
requires = [
33
"setuptools>=42",
44
"scikit-build>=0.13",
5+
"nanobind>=1.8.0",
6+
"cmake>=3.20",
7+
"ninja",
58
]
6-
build-backend = "backend"
7-
backend-path = ["_custom_build"]
9+
build-backend = "scikit_build_core.build"
810

911
[project]
1012
name = "lcstorch"
@@ -15,10 +17,10 @@ authors = [
1517
maintainers = [
1618
{name = "Nathan Fradet"}
1719
]
18-
description = "Longest Common Subsequence (LCS) extension for PyTorch tensors."
20+
description = "Longest Common Subsequence (LCS) extension for scalar vectors."
1921
readme = {file = "README.md", content-type = "text/markdown"}
2022
license = {file = "LICENSE"}
21-
keywords = ["pytorch", "torch", "lcs"]
23+
keywords = ["lcs"]
2224
classifiers = [
2325
"Development Status :: 3 - Alpha",
2426
"Programming Language :: C++",
@@ -38,17 +40,23 @@ classifiers = [
3840
"Operating System :: POSIX",
3941
"Operating System :: Unix",
4042
]
43+
dependencies = []
4144

42-
dependencies = ["torch"]
45+
[project.optional-dependencies]
46+
test = ["pytest-cov", "pytest-xdist[psutil]"]
4347

4448
[project.urls]
4549
Homepage = "https://github.com/Natooz/LCSTorch"
4650
Repository = "https://github.com/Natooz/LCSTorch"
4751
Issues = "https://github.com/Natooz/LCSTorch/issues"
4852

53+
[tool.scikit-build]
54+
cmake.minimum-version = "3.26.1"
55+
ninja.minimum-version = "1.11"
56+
4957
[tool.scikit-build.metadata]
5058
version.provider = "scikit_build_core.metadata.regex"
51-
version.input = "lcstorch/__init__.py"
59+
version.input = "src/lcspy/__init__.py"
5260

5361
[tool.skbuild]
5462
packages = ["lcstorch"]

0 commit comments

Comments
 (0)