-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate dataset of select_k times (#1497)
This adds an optional flag (`--select_k_dataset`) to the MATRIX_BENCH that will turn on generating a grid search of benchmarks for different select_k algorithms. Since this adds about 100x as many benchmarks to run as previous (90k vs 900), this is opt-in only right now. This will be used to learn a heuristic function in #1455 This also integrates the faiss block select top-k algorithm into this benchmarking, so that we can compare how it performs against the other select_k algorithms Authors: - Ben Frederickson (https://github.com/benfred) Approvers: - Corey J. Nolet (https://github.com/cjnolet) URL: #1497
- Loading branch information
Showing
11 changed files
with
337 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) 2023, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <benchmark/benchmark.h> | ||
#include <cstring> | ||
|
||
namespace raft::matrix { | ||
void add_select_k_dataset_benchmarks(); | ||
} | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
// if we're passed a 'select_k_dataset' flag, add in extra benchmarks | ||
for (int i = 1; i < argc; ++i) { | ||
if (strcmp(argv[i], "--select_k_dataset") == 0) { | ||
raft::matrix::add_select_k_dataset_benchmarks(); | ||
|
||
// pop off the cmdline argument from argc/argv | ||
for (int j = i; j < argc - 1; ++j) | ||
argv[j] = argv[j + 1]; | ||
argc--; | ||
break; | ||
} | ||
} | ||
benchmark::Initialize(&argc, argv); | ||
if (::benchmark::ReportUnrecognizedArguments(argc, argv)) return 1; | ||
benchmark::RunSpecifiedBenchmarks(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
cpp/src/neighbors/detail/selection_faiss_int64_t_double.cu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
/* | ||
* Copyright (c) 2023, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* | ||
* NOTE: this file is generated by selection_faiss_00_generate.py | ||
* | ||
* Make changes there and run in this directory: | ||
* | ||
* > python selection_faiss_00_generate.py | ||
* | ||
*/ | ||
|
||
#include <cstddef> // size_t | ||
#include <cstdint> // uint32_t | ||
#include <raft/neighbors/detail/selection_faiss-inl.cuh> | ||
|
||
#define instantiate_raft_neighbors_detail_select_k(payload_t, key_t) \ | ||
template void raft::neighbors::detail::select_k(const key_t* inK, \ | ||
const payload_t* inV, \ | ||
size_t n_rows, \ | ||
size_t n_cols, \ | ||
key_t* outK, \ | ||
payload_t* outV, \ | ||
bool select_min, \ | ||
int k, \ | ||
cudaStream_t stream) | ||
|
||
instantiate_raft_neighbors_detail_select_k(int64_t, double); | ||
|
||
#undef instantiate_raft_neighbors_detail_select_k |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
/* | ||
* Copyright (c) 2023, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* | ||
* NOTE: this file is generated by selection_faiss_00_generate.py | ||
* | ||
* Make changes there and run in this directory: | ||
* | ||
* > python selection_faiss_00_generate.py | ||
* | ||
*/ | ||
|
||
#include <cstddef> // size_t | ||
#include <cstdint> // uint32_t | ||
#include <raft/neighbors/detail/selection_faiss-inl.cuh> | ||
|
||
#define instantiate_raft_neighbors_detail_select_k(payload_t, key_t) \ | ||
template void raft::neighbors::detail::select_k(const key_t* inK, \ | ||
const payload_t* inV, \ | ||
size_t n_rows, \ | ||
size_t n_cols, \ | ||
key_t* outK, \ | ||
payload_t* outV, \ | ||
bool select_min, \ | ||
int k, \ | ||
cudaStream_t stream) | ||
|
||
instantiate_raft_neighbors_detail_select_k(int64_t, half); | ||
|
||
#undef instantiate_raft_neighbors_detail_select_k |
44 changes: 44 additions & 0 deletions
44
cpp/src/neighbors/detail/selection_faiss_uint32_t_double.cu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
/* | ||
* Copyright (c) 2023, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* | ||
* NOTE: this file is generated by selection_faiss_00_generate.py | ||
* | ||
* Make changes there and run in this directory: | ||
* | ||
* > python selection_faiss_00_generate.py | ||
* | ||
*/ | ||
|
||
#include <cstddef> // size_t | ||
#include <cstdint> // uint32_t | ||
#include <raft/neighbors/detail/selection_faiss-inl.cuh> | ||
|
||
#define instantiate_raft_neighbors_detail_select_k(payload_t, key_t) \ | ||
template void raft::neighbors::detail::select_k(const key_t* inK, \ | ||
const payload_t* inV, \ | ||
size_t n_rows, \ | ||
size_t n_cols, \ | ||
key_t* outK, \ | ||
payload_t* outV, \ | ||
bool select_min, \ | ||
int k, \ | ||
cudaStream_t stream) | ||
|
||
instantiate_raft_neighbors_detail_select_k(uint32_t, double); | ||
|
||
#undef instantiate_raft_neighbors_detail_select_k |
Oops, something went wrong.