cuKNN ⚡
GPU-Accelerated K-Nearest Neighbors using NVIDIA CUDA and CuPy
🚀 Overview
CuPy-KNN is a GPU accelerated implementation of the K-Nearest Neighbors algorithm powered by CuPy.
It provides a scikit-learn compatible API while exploiting NVIDIA GPUs for large-scale nearest neighbor search.
Designed for:
- Machine Learning
- Deep Learning embeddings
- Computer Vision features
- Bioinformatics embeddings
- Large-scale similarity search
✨ Features
✅ GPU acceleration with CUDA
✅ Batch-based distance computation
✅ Multiple distance metrics:
- Euclidean
- Cosine
- Manhattan
✅ sklearn-like API
fit()predict()predict_proba()kneighbors()
✅ Supports large datasets
✅ Fully implemented with CuPy tensors
📦 Installation
Install from PyPI:
pip install cuknn
For CUDA-enabled systems install CuPy first:
pip install cupy-cuda12x
or select the version matching your CUDA installation.
⚡ Quick Start
from cuknn import KNN
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
X, y = make_classification(
n_samples=100000,
n_features=512,
n_classes=5
)
X_train, X_test, y_train, y_test = train_test_split(
X,
y
)
model = KNN(
k=5,
distance="euclidean",
batch_size=1024
)
model.fit(
X_train,
y_train
)
prediction = model.predict(
X_test
)
📚 Citation
If you use cuKNN in your research:
@software{cupy_knn,
author = {Calderaro, Salvatore},
title = {cuKNN: GPU Accelerated K-Nearest Neighbors},
year = {2026}
}
Metadata
Release files for cuknn 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cuknn-0.1.1.tar.gz | 4.8 kB | Without provenance | Details for cuknn-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cuknn-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for cuknn-0.1.1-py3-none-any.whl |
Total release size: 10.0 kB
Release files / cuknn-0.1.1.tar.gz
| Download URL | cuknn-0.1.1.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
caa817fcdfe88c6de659048b2f306d8169dec9312c897484f138de2fe8b40465
|
|
BLAKE2b-256 checksum How to use checksums |
61d63cff528d22af0b15938d5117249528b02a718e5946af553a7a39587a49e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / cuknn-0.1.1-py3-none-any.whl
| Download URL | cuknn-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a121aeab5a8d7d4165e853153ccce28523b2f94013b455215f7090f34d107914
|
|
BLAKE2b-256 checksum How to use checksums |
3c17f373355da3d6f798f8e2573d0856181ffa6bb9fb6ee8f6ea3b95bd0dc101
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Security for cuknn 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.