Skip to content

Commit

Permalink
Merge branch 'branch-24.02' into improve_parallelism_of_refine_host
Browse files Browse the repository at this point in the history
  • Loading branch information
cjnolet authored Jan 3, 2024
2 parents b0a4a55 + 6d3572b commit fda1a7e
Show file tree
Hide file tree
Showing 8 changed files with 152 additions and 85 deletions.
8 changes: 4 additions & 4 deletions cpp/include/raft/core/cublas_macros.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2023, NVIDIA CORPORATION.
* Copyright (c) 2022-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,7 +33,7 @@
namespace raft {

/**
* @ingroup error_handling
* @addtogroup error_handling
* @{
*/

Expand Down Expand Up @@ -76,7 +76,7 @@ inline const char* cublas_error_to_string(cublasStatus_t err)
#undef _CUBLAS_ERR_TO_STR

/**
* @ingroup assertion
* @addtogroup assertion
* @{
*/

Expand Down Expand Up @@ -135,4 +135,4 @@ inline const char* cublas_error_to_string(cublasStatus_t err)
#define CUBLAS_CHECK_NO_THROW(call) RAFT_CUBLAS_TRY_NO_THROW(call)
#endif

#endif
#endif
12 changes: 9 additions & 3 deletions cpp/include/raft/linalg/add.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2023, NVIDIA CORPORATION.
* Copyright (c) 2022-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,7 +29,11 @@ namespace raft {
namespace linalg {

/**
* @ingroup arithmetic
* @defgroup arithmetic Arithmetic functions
* @{
*/

/**
* @brief Elementwise scalar add operation on the input buffer
*
* @tparam InT input data-type. Also the data-type upon which the math ops
Expand Down Expand Up @@ -87,6 +91,8 @@ void addDevScalar(
detail::addDevScalar(outDev, inDev, singleScalarDev, len, stream);
}

/** @} */ // end of group add

/**
* @defgroup add_dense Addition Arithmetic
* @{
Expand Down Expand Up @@ -220,4 +226,4 @@ void add_scalar(raft::resources const& handle,
}; // end namespace linalg
}; // end namespace raft

#endif
#endif
2 changes: 1 addition & 1 deletion cpp/include/raft/neighbors/detail/refine_device.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void refine_device(raft::resources const& handle,
uint32_t k = static_cast<uint32_t>(indices.extent(1));

RAFT_EXPECTS(k <= raft::matrix::detail::select::warpsort::kMaxCapacity,
"k must be lest than topk::kMaxCapacity (%d).",
"k must be less than topk::kMaxCapacity (%d).",
raft::matrix::detail::select::warpsort::kMaxCapacity);

common::nvtx::range<common::nvtx::domain::raft> fun_scope(
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/raft/neighbors/nn_descent_types.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, NVIDIA CORPORATION.
* Copyright (c) 2023-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,7 +27,7 @@

namespace raft::neighbors::experimental::nn_descent {
/**
* @ingroup nn_descent
* @ingroup nn-descent
* @{
*/

Expand Down
13 changes: 7 additions & 6 deletions docs/source/raft_ann_benchmarks.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ options:
`algo-groups`: this parameter is helpful to append any specific algorithm+group combination to run the benchmark for in addition to all the arguments from `algorithms` and `groups`. It is of the format `<algorithm>.<group>`, or for example, `raft_cagra.large`
For every algorithm run by this script, it outputs an index build statistics JSON file in `<dataset-path/<dataset>/result/build/<algo_{group}-{k}-{batch_size}.json>`
and an index search statistics JSON file in `<dataset-path/<dataset>/result/search/<algo_{group}-{k}-{batch_size}.json>`. NOTE: The filenams will not have "_{group}" if `group = "base"`.
For every algorithm run by this script, it outputs an index build statistics JSON file in `<dataset-path/<dataset>/result/build/<{algo},{group}.json>`
and an index search statistics JSON file in `<dataset-path/<dataset>/result/search/<{algo},{group},k{k},bs{batch_size}.json>`. NOTE: The filenames will not have ",{group}" if `group = "base"`.
`dataset-path` :
1. data is read from `<dataset-path>/<dataset>`
Expand All @@ -198,8 +198,8 @@ options:
--dataset-path DATASET_PATH
path to dataset folder (default: ${RAPIDS_DATASET_ROOT_DIR})
```
Build statistics CSV file is stored in `<dataset-path/<dataset>/result/build/<algo_group.csv>`
and index search statistics CSV file in `<dataset-path/<dataset>/result/search/<algo_group-k{k}-batch_size{batch_size}_{suffix}.csv>`, where suffix has three values:
Build statistics CSV file is stored in `<dataset-path/<dataset>/result/build/<{algo},{group}.csv>`
and index search statistics CSV file in `<dataset-path/<dataset>/result/search/<{algo},{group},k{k},bs{batch_size},{suffix}.csv>`, where suffix has three values:
1. `raw`: All search results are exported
2. `throughput`: Pareto frontier of throughput results is exported
3. `latency`: Pareto frontier of latency results is exported
Expand All @@ -212,8 +212,8 @@ CSV files `<dataset-path/<dataset>/result/search/*.csv`.
The usage of this script is:
```bash
usage: [-h] [--dataset DATASET] [--dataset-path DATASET_PATH] [--output-filepath OUTPUT_FILEPATH] [--algorithms ALGORITHMS] [--groups GROUPS] [--algo-groups ALGO_GROUPS]
[-k COUNT] [-bs BATCH_SIZE] [--build] [--search] [--x-scale X_SCALE] [--y-scale {linear,log,symlog,logit}] [--mode {throughput,latency}] [--time-unit {s,ms,us}]
[--raw]
[-k COUNT] [-bs BATCH_SIZE] [--build] [--search] [--x-scale X_SCALE] [--y-scale {linear,log,symlog,logit}] [--x-start X_START] [--mode {throughput,latency}]
[--time-unit {s,ms,us}] [--raw]
options:
-h, --help show this help message and exit
Expand All @@ -237,6 +237,7 @@ options:
--x-scale X_SCALE Scale to use when drawing the X-axis. Typically linear, logit or a2 (default: linear)
--y-scale {linear,log,symlog,logit}
Scale to use when drawing the Y-axis (default: linear)
--x-start X_START Recall values to start the x-axis from (default: 0.8)
--mode {throughput,latency}
search mode whose Pareto frontier is used on the y-axis (default: throughput)
--time-unit {s,ms,us}
Expand Down
34 changes: 21 additions & 13 deletions python/raft-ann-bench/src/raft-ann-bench/data_export/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def read_file(dataset, dataset_path, method):
try:
data = json.load(f)
df = pd.DataFrame(data["benchmarks"])
yield os.path.join(dir, file), file.split("-")[0], df
filename_split = file.split(",")
algo_name = (filename_split[0], filename_split[1])
yield os.path.join(dir, file), algo_name, df
except Exception as e:
print(
"An error occurred processing file %s (%s). "
Expand All @@ -85,7 +87,10 @@ def read_file(dataset, dataset_path, method):
def convert_json_to_csv_build(dataset, dataset_path):
for file, algo_name, df in read_file(dataset, dataset_path, "build"):
try:
algo_name = algo_name.replace("_base", "")
if "base" in algo_name[1]:
algo_name = algo_name[0]
else:
algo_name = "_".join(algo_name)
df["name"] = df["name"].str.split("/").str[0]
write = pd.DataFrame(
{
Expand All @@ -97,12 +102,7 @@ def convert_json_to_csv_build(dataset, dataset_path):
for name in df:
if name not in skip_build_cols:
write[name] = df[name]
filepath = os.path.normpath(file).split(os.sep)
filename = filepath[-1].split("-")[0] + ".csv"
write.to_csv(
os.path.join(f"{os.sep}".join(filepath[:-1]), filename),
index=False,
)
write.to_csv(file.replace(".json", ".csv"), index=False)
except Exception as e:
print(
"An error occurred processing file %s (%s). Skipping..."
Expand Down Expand Up @@ -140,9 +140,17 @@ def convert_json_to_csv_search(dataset, dataset_path):
for file, algo_name, df in read_file(dataset, dataset_path, "search"):
try:
build_file = os.path.join(
dataset_path, dataset, "result", "build", f"{algo_name}.csv"
dataset_path,
dataset,
"result",
"build",
f"{','.join(algo_name)}.csv",
)
algo_name = algo_name.replace("_base", "")
print(build_file)
if "base" in algo_name[1]:
algo_name = algo_name[0]
else:
algo_name = "_".join(algo_name)
df["name"] = df["name"].str.split("/").str[0]
try:
write = pd.DataFrame(
Expand Down Expand Up @@ -201,13 +209,13 @@ def convert_json_to_csv_search(dataset, dataset_path):
"appended in the Search CSV"
)

write.to_csv(file.replace(".json", "_raw.csv"), index=False)
write.to_csv(file.replace(".json", ",raw.csv"), index=False)
throughput = get_frontier(write, "throughput")
throughput.to_csv(
file.replace(".json", "_throughput.csv"), index=False
file.replace(".json", ",throughput.csv"), index=False
)
latency = get_frontier(write, "latency")
latency.to_csv(file.replace(".json", "_latency.csv"), index=False)
latency.to_csv(file.replace(".json", ",latency.csv"), index=False)
except Exception as e:
print(
"An error occurred processing file %s (%s). Skipping..."
Expand Down
Loading

0 comments on commit fda1a7e

Please sign in to comment.