cuhc 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cuhc-0.1.0/.gitignore +20 -0
- cuhc-0.1.0/.readthedocs.yaml +14 -0
- cuhc-0.1.0/CMakeLists.txt +44 -0
- cuhc-0.1.0/LICENSE +21 -0
- cuhc-0.1.0/PKG-INFO +664 -0
- cuhc-0.1.0/README.md +639 -0
- cuhc-0.1.0/bench/bench_distance.cu +146 -0
- cuhc-0.1.0/bench/bench_hdbscan.py +61 -0
- cuhc-0.1.0/bench/bench_linkage.py +60 -0
- cuhc-0.1.0/bench/bench_pruning.py +78 -0
- cuhc-0.1.0/docs/all_pairs_passes.md +323 -0
- cuhc-0.1.0/docs/api.md +17 -0
- cuhc-0.1.0/docs/architecture.md +392 -0
- cuhc-0.1.0/docs/assets/customer_segments.png +0 -0
- cuhc-0.1.0/docs/boruvka_mst.md +248 -0
- cuhc-0.1.0/docs/dense_linkage.md +279 -0
- cuhc-0.1.0/docs/distance_matrix.md +685 -0
- cuhc-0.1.0/docs/hdbscan.md +364 -0
- cuhc-0.1.0/docs/index.md +3 -0
- cuhc-0.1.0/docs/nn_chain.md +181 -0
- cuhc-0.1.0/docs/requirements.txt +7 -0
- cuhc-0.1.0/docs/rnn_ward.md +259 -0
- cuhc-0.1.0/docs/tutorial_customer_segments.md +191 -0
- cuhc-0.1.0/examples/customer_segments/README.md +27 -0
- cuhc-0.1.0/examples/customer_segments/cluster_customers.py +177 -0
- cuhc-0.1.0/mkdocs.yml +78 -0
- cuhc-0.1.0/pyproject.toml +43 -0
- cuhc-0.1.0/python/cuhc/__init__.py +20 -0
- cuhc-0.1.0/python/cuhc/_distances.py +134 -0
- cuhc-0.1.0/python/cuhc/_estimators.py +121 -0
- cuhc-0.1.0/python/cuhc/_hdbscan.py +474 -0
- cuhc-0.1.0/python/cuhc/_lib.py +109 -0
- cuhc-0.1.0/python/cuhc/_linkage.py +216 -0
- cuhc-0.1.0/scripts/profile_distance.sh +37 -0
- cuhc-0.1.0/src/capi.cu +366 -0
- cuhc-0.1.0/src/distance_matrix.cuh +424 -0
- cuhc-0.1.0/src/distances.cuh +115 -0
- cuhc-0.1.0/src/hdbscan.cuh +485 -0
- cuhc-0.1.0/src/linkage.cuh +289 -0
- cuhc-0.1.0/src/mst.cuh +237 -0
- cuhc-0.1.0/src/nn_chain.cuh +291 -0
- cuhc-0.1.0/src/reductions.cuh +84 -0
- cuhc-0.1.0/src/rnn_ward.cuh +370 -0
- cuhc-0.1.0/src/spatial.cuh +471 -0
- cuhc-0.1.0/tests/_helpers.py +82 -0
- cuhc-0.1.0/tests/conftest.py +15 -0
- cuhc-0.1.0/tests/test_agglomerative.py +112 -0
- cuhc-0.1.0/tests/test_fcluster.py +44 -0
- cuhc-0.1.0/tests/test_hdbscan.py +285 -0
- cuhc-0.1.0/tests/test_linkage.py +167 -0
- cuhc-0.1.0/tests/test_mst.py +99 -0
- cuhc-0.1.0/tests/test_nn_chain.py +80 -0
- cuhc-0.1.0/tests/test_pairwise_distances.py +110 -0
- cuhc-0.1.0/tests/test_rnn_ward.py +121 -0
- cuhc-0.1.0/tests/test_spatial_pruning.py +106 -0
cuhc-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Build output
|
|
2
|
+
build/
|
|
3
|
+
dist/
|
|
4
|
+
*.egg-info/
|
|
5
|
+
python/cuhc/libcuhc.so
|
|
6
|
+
|
|
7
|
+
# Python
|
|
8
|
+
__pycache__/
|
|
9
|
+
*.pyc
|
|
10
|
+
.venv/
|
|
11
|
+
venv/
|
|
12
|
+
.pytest_cache/
|
|
13
|
+
|
|
14
|
+
# Documentation site (mkdocs build)
|
|
15
|
+
site/
|
|
16
|
+
|
|
17
|
+
# Editors and OS
|
|
18
|
+
.vscode/
|
|
19
|
+
.idea/
|
|
20
|
+
.DS_Store
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Read the Docs configuration: https://docs.readthedocs.io/en/stable/config-file/v2.html
|
|
2
|
+
version: 2
|
|
3
|
+
|
|
4
|
+
build:
|
|
5
|
+
os: ubuntu-24.04
|
|
6
|
+
tools:
|
|
7
|
+
python: "3.12"
|
|
8
|
+
|
|
9
|
+
mkdocs:
|
|
10
|
+
configuration: mkdocs.yml
|
|
11
|
+
|
|
12
|
+
python:
|
|
13
|
+
install:
|
|
14
|
+
- requirements: docs/requirements.txt
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.24)
|
|
2
|
+
|
|
3
|
+
# Must be set before project(), which otherwise fills in nvcc's default (sm_75).
|
|
4
|
+
# "native" compiles real machine code for the GPUs in this computer. That matters:
|
|
5
|
+
# a driver can refuse to JIT PTX from a newer nvcc ("the provided PTX was compiled
|
|
6
|
+
# with an unsupported toolchain"). To build for other GPUs (e.g. without a GPU, or
|
|
7
|
+
# for a wheel), pass -DCMAKE_CUDA_ARCHITECTURES="80;86;89", or with pip:
|
|
8
|
+
# CMAKE_ARGS="-DCMAKE_CUDA_ARCHITECTURES=80;86;89" pip install .
|
|
9
|
+
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
|
|
10
|
+
set(CMAKE_CUDA_ARCHITECTURES native)
|
|
11
|
+
endif()
|
|
12
|
+
|
|
13
|
+
project(cuHierarchicalClustering LANGUAGES CXX CUDA)
|
|
14
|
+
|
|
15
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
16
|
+
set(CMAKE_CUDA_STANDARD 17)
|
|
17
|
+
if(NOT CMAKE_BUILD_TYPE)
|
|
18
|
+
set(CMAKE_BUILD_TYPE Release)
|
|
19
|
+
endif()
|
|
20
|
+
|
|
21
|
+
find_package(CUDAToolkit REQUIRED)
|
|
22
|
+
|
|
23
|
+
# The benchmark is for development only; pip builds (SKBUILD) skip it.
|
|
24
|
+
if(NOT SKBUILD)
|
|
25
|
+
add_executable(bench_distance bench/bench_distance.cu)
|
|
26
|
+
target_include_directories(bench_distance PRIVATE src)
|
|
27
|
+
target_link_libraries(bench_distance PRIVATE CUDA::cublas)
|
|
28
|
+
# -lineinfo lets Nsight Compute map stalls back to source lines.
|
|
29
|
+
target_compile_options(bench_distance PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-lineinfo>)
|
|
30
|
+
endif()
|
|
31
|
+
|
|
32
|
+
# Shared library behind the Python package (loaded with ctypes). A development
|
|
33
|
+
# build writes it into python/cuhc/, so the package works straight from the
|
|
34
|
+
# source tree; a pip build installs it into the package instead (below).
|
|
35
|
+
add_library(cuhc SHARED src/capi.cu)
|
|
36
|
+
target_include_directories(cuhc PRIVATE src)
|
|
37
|
+
set_target_properties(cuhc PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
|
38
|
+
if(NOT SKBUILD)
|
|
39
|
+
set_target_properties(cuhc PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/python/cuhc)
|
|
40
|
+
endif()
|
|
41
|
+
target_compile_options(cuhc PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-lineinfo>)
|
|
42
|
+
|
|
43
|
+
# pip install (scikit-build-core): put the library into the installed cuhc package.
|
|
44
|
+
install(TARGETS cuhc LIBRARY DESTINATION cuhc)
|
cuhc-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 shangar21
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|