All Projects → unlimblue → Knn_cuda

unlimblue / Knn_cuda

pytorch knn [cuda version]

Labels

Projects that are alternatives of or similar to Knn cuda

Cudadtw
GPU-Suite
Stars: ✭ 63 (-26.74%)
Mutual labels:  cuda
Project Currennt Public
CURRENNNT codes and scripts
Stars: ✭ 69 (-19.77%)
Mutual labels:  cuda
2016 super resolution
ICCV2015 Image Super-Resolution Using Deep Convolutional Networks
Stars: ✭ 78 (-9.3%)
Mutual labels:  cuda
Arboretum
Gradient Boosting powered by GPU(NVIDIA CUDA)
Stars: ✭ 64 (-25.58%)
Mutual labels:  cuda
Torch sampling
Efficient reservoir sampling implementation for PyTorch
Stars: ✭ 68 (-20.93%)
Mutual labels:  cuda
Titan
A high-performance CUDA-based physics simulation sandbox for soft robotics and reinforcement learning.
Stars: ✭ 73 (-15.12%)
Mutual labels:  cuda
Cutlass
CUDA Templates for Linear Algebra Subroutines
Stars: ✭ 1,123 (+1205.81%)
Mutual labels:  cuda
Pytorch Emdloss
PyTorch 1.0 implementation of the approximate Earth Mover's Distance
Stars: ✭ 82 (-4.65%)
Mutual labels:  cuda
Deepjointfilter
The source code of ECCV16 'Deep Joint Image Filtering'.
Stars: ✭ 68 (-20.93%)
Mutual labels:  cuda
Cuda Design Patterns
Some CUDA design patterns and a bit of template magic for CUDA
Stars: ✭ 78 (-9.3%)
Mutual labels:  cuda
Autodock Gpu
AutoDock for GPUs and other accelerators
Stars: ✭ 65 (-24.42%)
Mutual labels:  cuda
Alenka
GPU database engine
Stars: ✭ 1,150 (+1237.21%)
Mutual labels:  cuda
Cudart.jl
Julia wrapper for CUDA runtime API
Stars: ✭ 75 (-12.79%)
Mutual labels:  cuda
Cudadrv.jl
A Julia wrapper for the CUDA driver API.
Stars: ✭ 64 (-25.58%)
Mutual labels:  cuda
Nnabla Ext Cuda
A CUDA Extension of Neural Network Libraries
Stars: ✭ 79 (-8.14%)
Mutual labels:  cuda
Mpn Cov
@ICCV2017: For exploiting second-order statistics, we propose Matrix Power Normalized Covariance pooling (MPN-COV) ConvNets, different from and outperforming those using global average pooling.
Stars: ✭ 63 (-26.74%)
Mutual labels:  cuda
Parenchyma
An extensible HPC framework for CUDA, OpenCL and native CPU.
Stars: ✭ 71 (-17.44%)
Mutual labels:  cuda
Mpr
Reference implementation for "Massively Parallel Rendering of Complex Closed-Form Implicit Surfaces" (SIGGRAPH 2020)
Stars: ✭ 84 (-2.33%)
Mutual labels:  cuda
Modulated Deform Conv
deformable convolution 2D 3D DeformableConvolution DeformConv Modulated Pytorch CUDA
Stars: ✭ 81 (-5.81%)
Mutual labels:  cuda
Hiop
HPC solver for nonlinear optimization problems
Stars: ✭ 75 (-12.79%)
Mutual labels:  cuda

KNN_CUDA

Modifications

  • Aten support
  • pytorch v1.0+ support
  • pytorch c++ extention

Performance

  • dim = 5
  • k = 100
  • ref = 224
  • query = 224
  • Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  • NVIDIA GeForce 940MX
Loop sklearn CUDA Memory
100 2.34 ms 0.06 ms 652/1024
1000 2.30 ms 1.40 ms 652/1024

Install

  • from source
git clone https://github.com/unlimblue/KNN_CUDA.git
cd KNN_CUDA
make && make install
  • from wheel
pip install --upgrade https://github.com/unlimblue/KNN_CUDA/releases/download/0.2/KNN_CUDA-0.2-py3-none-any.whl

And then, make sure ninja has been installed:

  1. see https://pytorch.org/tutorials/advanced/cpp_extension.html
  2. or just:
wget -P /usr/bin https://github.com/unlimblue/KNN_CUDA/raw/master/ninja

Usage

import torch

# Make sure your CUDA is available.
assert torch.cuda.is_available()

from knn_cuda import KNN
"""
if transpose_mode is True, 
    ref   is Tensor [bs x nr x dim]
    query is Tensor [bs x nq x dim]
    
    return 
        dist is Tensor [bs x nq x k]
        indx is Tensor [bs x nq x k]
else
    ref   is Tensor [bs x dim x nr]
    query is Tensor [bs x dim x nq]
    
    return 
        dist is Tensor [bs x k x nq]
        indx is Tensor [bs x k x nq]
"""

knn = KNN(k=10, transpose_mode=True)

ref = torch.rand(32, 1000, 5).cuda()
query = torch.rand(32, 50, 5).cuda()

dist, indx = knn(ref, query)  # 32 x 50 x 10
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].