From 73585f4b35eda8fd2a1ffa9f3c058ec0674bc083 Mon Sep 17 00:00:00 2001 From: Victor Lafargue Date: Wed, 19 Jan 2022 18:05:27 +0100 Subject: [PATCH] Use FAISS with RMM (#363) Answers https://github.com/rapidsai/cuml/issues/2821 Authors: - Victor Lafargue (https://github.com/viclafargue) - Corey J. Nolet (https://github.com/cjnolet) Approvers: - Corey J. Nolet (https://github.com/cjnolet) URL: https://github.com/rapidsai/raft/pull/363 --- cpp/include/raft/spatial/knn/ann.hpp | 2 +- cpp/include/raft/spatial/knn/ann_common.h | 4 +- .../knn/detail/ann_quantized_faiss.cuh | 4 +- .../spatial/knn/detail/haversine_distance.cuh | 2 +- .../knn/detail/knn_brute_force_faiss.cuh | 4 +- .../spatial/knn/detail/selection_faiss.cuh | 2 +- cpp/include/raft/spatial/knn/faiss_mr.hpp | 643 ++++++++++++++++++ cpp/test/CMakeLists.txt | 1 + cpp/test/spatial/faiss_mr.cu | 94 +++ 9 files changed, 747 insertions(+), 9 deletions(-) create mode 100644 cpp/include/raft/spatial/knn/faiss_mr.hpp create mode 100644 cpp/test/spatial/faiss_mr.cu diff --git a/cpp/include/raft/spatial/knn/ann.hpp b/cpp/include/raft/spatial/knn/ann.hpp index e8cc85256d..6ce9463e43 100644 --- a/cpp/include/raft/spatial/knn/ann.hpp +++ b/cpp/include/raft/spatial/knn/ann.hpp @@ -20,7 +20,7 @@ #include "detail/ann_quantized_faiss.cuh" #include -#include +#include #include diff --git a/cpp/include/raft/spatial/knn/ann_common.h b/cpp/include/raft/spatial/knn/ann_common.h index 573a23181d..79f75dc8ae 100644 --- a/cpp/include/raft/spatial/knn/ann_common.h +++ b/cpp/include/raft/spatial/knn/ann_common.h @@ -19,7 +19,7 @@ #include #include -#include +#include namespace raft { namespace spatial { @@ -30,7 +30,7 @@ struct knnIndex { raft::distance::DistanceType metric; float metricArg; - faiss::gpu::StandardGpuResources* gpu_res; + raft::spatial::knn::RmmGpuResources* gpu_res; int device; ~knnIndex() { diff --git a/cpp/include/raft/spatial/knn/detail/ann_quantized_faiss.cuh b/cpp/include/raft/spatial/knn/detail/ann_quantized_faiss.cuh index ff08917585..1c2f21b72c 100644 --- a/cpp/include/raft/spatial/knn/detail/ann_quantized_faiss.cuh +++ b/cpp/include/raft/spatial/knn/detail/ann_quantized_faiss.cuh @@ -28,6 +28,7 @@ #include