File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88// -*- c++ -*-
99
10+ #include < faiss/Index.h>
1011#include < faiss/utils/utils.h>
1112
1213#include < cassert>
@@ -129,6 +130,14 @@ std::string get_compile_options() {
129130 return options;
130131}
131132
133+ std::string get_version () {
134+ std::string version = std::to_string (FAISS_VERSION_MAJOR) + " ." +
135+ std::to_string (FAISS_VERSION_MINOR) + " ." +
136+ std::to_string (FAISS_VERSION_PATCH);
137+
138+ return version;
139+ }
140+
132141#ifdef _MSC_VER
133142double getmillisecs () {
134143 LARGE_INTEGER ts;
Original file line number Diff line number Diff line change @@ -37,6 +37,9 @@ std::string get_compile_options();
3737 * Get some stats about the system
3838 **************************************************/
3939
40+ // Expose FAISS version as a string
41+ std::string get_version ();
42+
4043// / ms elapsed since some arbitrary epoch
4144double getmillisecs ();
4245
Original file line number Diff line number Diff line change 1+ /* *
2+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3+ *
4+ * This source code is licensed under the MIT license found in the
5+ * LICENSE file in the root directory of this source tree.
6+ */
7+
8+ #include < gtest/gtest.h>
9+
10+ #include < faiss/utils/utils.h>
11+
12+ TEST (TestUtils, get_version) {
13+ EXPECT_EQ (" 1.8.0" , faiss::get_version ());
14+ }
You can’t perform that action at this time.
0 commit comments