This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new eb3e21d9af4 branch-4.0: [fix](ann index)Remove redundant
omp_set_num_threads #57224 (#57298)
eb3e21d9af4 is described below
commit eb3e21d9af436e496930336ea87c23aaacf4bb40
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sun Oct 26 17:08:14 2025 +0800
branch-4.0: [fix](ann index)Remove redundant omp_set_num_threads #57224
(#57298)
Cherry-picked from #57224
Co-authored-by: ivin <[email protected]>
---
be/src/olap/rowset/segment_v2/ann_index/faiss_ann_index.cpp | 7 +++----
be/src/olap/rowset/segment_v2/ann_index/faiss_ann_index.h | 13 ++++++++++++-
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/be/src/olap/rowset/segment_v2/ann_index/faiss_ann_index.cpp
b/be/src/olap/rowset/segment_v2/ann_index/faiss_ann_index.cpp
index e4d6061941e..621fe7fe4ee 100644
--- a/be/src/olap/rowset/segment_v2/ann_index/faiss_ann_index.cpp
+++ b/be/src/olap/rowset/segment_v2/ann_index/faiss_ann_index.cpp
@@ -222,8 +222,8 @@ public:
lucene::store::IndexInput* _input = nullptr;
};
-doris::Status FaissVectorIndex::train(vectorized::Int64 n, const float* x) {
- DCHECK(x != nullptr);
+doris::Status FaissVectorIndex::train(vectorized::Int64 n, const float* vec) {
+ DCHECK(vec != nullptr);
DCHECK(_index != nullptr);
// For PQ index, check if we have enough training data
@@ -239,9 +239,8 @@ doris::Status FaissVectorIndex::train(vectorized::Int64 n,
const float* x) {
ScopedThreadName scoped_name("faiss_train_idx");
// Reserve OpenMP threads globally so concurrent builds stay under
omp_threads_limit.
ScopedOmpThreadBudget thread_budget;
- omp_set_num_threads(config::omp_threads_limit);
try {
- _index->train(n, x);
+ _index->train(n, vec);
} catch (faiss::FaissException& e) {
return doris::Status::RuntimeError("exception occurred during
training: {}", e.what());
}
diff --git a/be/src/olap/rowset/segment_v2/ann_index/faiss_ann_index.h
b/be/src/olap/rowset/segment_v2/ann_index/faiss_ann_index.h
index 8d8e3354f5f..c06402157ae 100644
--- a/be/src/olap/rowset/segment_v2/ann_index/faiss_ann_index.h
+++ b/be/src/olap/rowset/segment_v2/ann_index/faiss_ann_index.h
@@ -178,7 +178,18 @@ public:
~FaissVectorIndex();
- doris::Status train(vectorized::Int64 n, const float* x) override;
+ /**
+ * @brief Trains the index with the provided data.
+ *
+ * This method is used to train the FAISS index with a set of vectors.
+ * Training is required for certain index types that need to learn
+ * parameters from the data before adding vectors.
+ *
+ * @param n Number of training vectors
+ * @param vec Pointer to training vector data (n * dim float values)
+ * @return Status indicating success or failure
+ */
+ doris::Status train(vectorized::Int64 n, const float* vec) override;
/**
* @brief Adds vectors to the index for future searches.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]