Skip to content

Commit

Permalink
working
Browse files Browse the repository at this point in the history
  • Loading branch information
tarang-jain committed Jan 9, 2025
1 parent c0ff9ba commit 21f92fd
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 34 deletions.
1 change: 1 addition & 0 deletions cpp/bench/ann/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ function(ConfigureAnnBench)
target_link_libraries(
${BENCH_NAME}
PRIVATE ${ConfigureAnnBench_LINKS}
raft::raft
nlohmann_json::nlohmann_json
Threads::Threads
$<TARGET_NAME_IF_EXISTS:raft::raft_logger>
Expand Down
2 changes: 1 addition & 1 deletion cpp/bench/ann/src/faiss/faiss_gpu_benchmark.cu
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ int main(int argc, char** argv)
&cuda_mr, rmm::percent_of_free_device_memory(50)};
// Updates the current device resource pointer to `pool_mr`
auto old_mr = rmm::mr::set_current_device_resource(&pool_mr);
auto ret = raft::bench::ann::run_main(argc, argv);
auto ret = cuvs::bench::run_main(argc, argv);
// Restores the current device resource pointer to its previous value
rmm::mr::set_current_device_resource(old_mr);
return ret;
Expand Down
14 changes: 8 additions & 6 deletions cpp/bench/ann/src/faiss/faiss_gpu_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#include "../common/ann_types.hpp"
#include "../common/util.hpp"
#include <cuvs/neighbors/refine.hpp>
#include "../cuvs/cuvs_ann_bench_utils.h"

#include <faiss/IndexFlat.h>
#include <faiss/IndexIVFFlat.h>
Expand Down Expand Up @@ -204,7 +206,7 @@ template <typename T>
void faiss_gpu<T>::search(
const T* queries, int batch_size, int k, algo_base::index_type* neighbors, float* distances) const
{
ASSERT(Mode::kLatency, "l2Knn: rowMajorIndex and rowMajorQuery should have same layout");
// ASSERT(Mode::kLatency, "l2Knn: rowMajorIndex and rowMajorQuery should have same layout");
using IdxT = faiss::idx_t;
static_assert(sizeof(size_t) == sizeof(faiss::idx_t),
"sizes of size_t and faiss::idx_t are different");
Expand Down Expand Up @@ -241,16 +243,16 @@ void faiss_gpu<T>::search(
// wait for the queries to copy to host in 'stream`
handle_.sync_stream();

raft::runtime::neighbors::refine(handle_,
cuvs::neighbors::refine(handle_,
dataset_v,
queries_host.view(),
candidates_host.view(),
neighbors_host.view(),
distances_host.view(),
parse_metric_faiss(this->metric_));
parse_metric_type(this->metric_));

raft::copy(neighbors,
(size_t*)neighbors_host.data_handle(),
neighbors_host.data_handle(),
neighbors_host.size(),
handle_.get_stream());
raft::copy(
Expand Down Expand Up @@ -353,7 +355,7 @@ class faiss_gpu_ivfpq : public faiss_gpu<T> {
bool use_float16;
bool use_precomputed;
bool use_cuvs;
int bits_per_code;
int bitsPerCode;
};
using typename faiss_gpu<T>::search_param_base;

Expand All @@ -372,7 +374,7 @@ class faiss_gpu_ivfpq : public faiss_gpu<T> {
dim,
param.nlist,
param.m,
param.bits_per_code,
param.bitsPerCode,
this->metric_type_,
config);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ groups:
nlist: [2048]
ratio: [10]
useFloat16: [False, True]
use_raft: [False]
use_cuvs: [False]
search:
nprobe: [1, 5, 10, 50, 100, 200]
refine_ratio: [1]
Expand All @@ -15,7 +15,7 @@ groups:
nlist: [2048]
ratio: [10]
useFloat16: [False, True]
use_raft: [True]
use_cuvs: [True]
search:
nprobe: [1, 5, 10, 50, 100, 200]
refine_ratio: [1]
18 changes: 9 additions & 9 deletions python/cuvs_bench/cuvs_bench/config/algos/faiss_gpu_ivf_pq.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ groups:
ratio: [10]
usePrecomputed: [False, True]
useFloat16: [False, True]
use_raft: [False]
use_cuvs: [False]
bitsPerCode: [8]
search:
nprobe: [1, 5, 10, 50, 100, 200]
refine_ratio: [1, 2, 4]
baseraft:
basecuvs:
build:
nlist: [1024, 2048, 4096, 8192]
M: [64, 32, 16]
ratio: [10]
usePrecomputed: [False]
useFloat16: [False, True]
use_raft: [True]
use_cuvs: [True]
bitsPerCode: [8, 6, 5, 4]
search:
nprobe: [1, 5, 10, 50, 100, 200]
Expand All @@ -34,19 +34,19 @@ groups:
ratio: [4]
usePrecomputed: [False, True]
useFloat16: [False, True]
use_raft: [False]
use_cuvs: [False]
bitsPerCode: [8]
search:
nprobe: [20, 30, 40, 50, 100, 200, 500, 1000]
refine_ratio: [1, 2, 4]
largeraft:
largecuvs:
build:
nlist: [8192, 16384, 32768, 65536]
M: [48, 32, 16]
ratio: [4]
usePrecomputed: [False]
useFloat16: [False, True]
use_raft: [True]
use_cuvs: [True]
bitsPerCode: [8, 6, 5, 4]
search:
nprobe: [20, 30, 40, 50, 100, 200, 500, 1000]
Expand All @@ -58,19 +58,19 @@ groups:
ratio: [10]
usePrecomputed: [False, True]
useFloat16: [False, True]
use_raft: [False]
use_cuvs: [False]
bitsPerCode: [8]
search:
nprobe: [20, 30, 40, 50, 100, 200, 500, 1000]
refine_ratio: [1]
100Mraft:
100Mcuvs:
build:
nlist: [50000]
M: [48]
ratio: [10]
usePrecomputed: [False, True]
useFloat16: [False, True]
use_raft: [True]
use_cuvs: [True]
bitsPerCode: [8, 6, 5, 4]
search:
nprobe: [20, 30, 40, 50, 100, 200, 500, 1000]
Expand Down
22 changes: 11 additions & 11 deletions python/cuvs_bench/cuvs_bench/run/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,16 @@
"were interrupted, use this option to convert those intermediate "
"files manually.",
)
@click.option(
"--raft-log-level",
default="info",
show_default=True,
prompt="Enter the log level",
help="Log level, possible values are [off, error, warn, info, debug, "
"trace]. Default: 'info'. Note that 'debug' or more detailed "
"logging level requires that the library is compiled with "
"-DRAFT_ACTIVE_LEVEL=<L> where <L> >= <requested log level>.",
)
# @click.option(
# "--raft-log-level",
# default="info",
# show_default=True,
# prompt="Enter the log level",
# help="Log level, possible values are [off, error, warn, info, debug, "
# "trace]. Default: 'info'. Note that 'debug' or more detailed "
# "logging level requires that the library is compiled with "
# "-DRAFT_ACTIVE_LEVEL=<L> where <L> >= <requested log level>.",
# )
def main(
subset_size: Optional[int],
count: int,
Expand All @@ -178,7 +178,7 @@ def main(
search_threads: Optional[str],
dry_run: bool,
data_export: bool,
raft_log_level: str,
# raft_log_level: str,
) -> None:
"""
Main function to run the benchmark with the provided options.
Expand Down
4 changes: 2 additions & 2 deletions python/cuvs_bench/cuvs_bench/run/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ def run_benchmark(
search_threads: int,
dry_run: bool,
data_export: bool,
raft_log_level: int,
# raft_log_level: int,
) -> None:
"""
Runs a benchmarking process based on the provided configurations.
Expand Down Expand Up @@ -683,5 +683,5 @@ def run_benchmark(
batch_size,
search_threads,
search_mode,
raft_log_level,
# raft_log_level,
)
6 changes: 3 additions & 3 deletions python/cuvs_bench/cuvs_bench/run/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def cuvs_bench_cpp(
batch_size: int,
search_threads: Optional[int],
mode: str = "throughput",
raft_log_level: str = "info",
# raft_log_level: str = "info",
) -> None:
"""
Run the CUVS benchmarking tool with the provided configuration.
Expand Down Expand Up @@ -117,7 +117,7 @@ def cuvs_bench_cpp(
"--benchmark_out_format=json",
"--benchmark_counters_tabular=true",
f"--benchmark_out={os.path.join(benchmark_out)}",
f"--raft_log_level={parse_log_level(raft_log_level)}",
# f"--raft_log_level={parse_log_level(raft_log_level)}",
]
if force:
cmd.append("--force")
Expand Down Expand Up @@ -156,7 +156,7 @@ def cuvs_bench_cpp(
"--benchmark_out_format=json",
f"--mode={mode}",
f"--benchmark_out={os.path.join(search_folder, search_file)}",
f"--raft_log_level={parse_log_level(raft_log_level)}",
# f"--raft_log_level={parse_log_level(raft_log_level)}",
]
if force:
cmd.append("--force")
Expand Down

0 comments on commit 21f92fd

Please sign in to comment.