Skip to content

Commit 22583ce

Browse files
jbajicdothebart
authored andcommitted
Add faiss & openmp versions (#21909)
1 parent 46988e0 commit 22583ce

File tree

5 files changed

+36
-5
lines changed

5 files changed

+36
-5
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
devel
22
-----
33

4+
* Add faiss and openmp versions in --version output of arangod.
5+
46
* Fix BTS-2171: Reduce the amount of code executed on dedicated network threads,
57
which might have reduced its throughput or delayed processing of other network
68
responses.

CMakeLists.txt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,8 @@ if(STATIC_EXECUTABLES)
10361036
set(BLAS_LIBRARIES "/usr/lib/aarch64-linux-gnu/libblas.a" CACHE PATH "BLAS static library path")
10371037
set(OpenMP_gomp_LIBRARY "/usr/lib/gcc/aarch64-linux-gnu/13/libgomp.a")
10381038
endif()
1039-
message("LAPACK: ${LAPACK_LIBRARIES} and BLAS: to ${BLAS_LIBRARIES}")
1039+
message(STATUS "LAPACK: ${LAPACK_LIBRARIES}")
1040+
message(STATUS "BLAS: ${BLAS_LIBRARIES}")
10401041

10411042
# Setting this is necessary because we want to bind to gcc static library
10421043
# since the LLVM OpenMP implementation fails in our CI
@@ -1046,18 +1047,21 @@ if(STATIC_EXECUTABLES)
10461047
set(OpenMP_C_LIB_NAMES "gomp;pthread")
10471048
set(OpenMP_CXX_LIB_NAMES "gomp;pthread")
10481049
set(OpenMP_pthread_LIBRARY "pthread")
1050+
# This is hardcoded since we know exactly with which OpenMP version we want to build
1051+
add_definitions(-DARANGODB_OPENMP_VERSION="5.1")
10491052

1050-
# TODO avoid hard coded paths
1051-
set(FAISS_EXE_LINKER_FLAGS "-fopenmp=libgomp -L/opt/omp -llapack -lgfortran")
1053+
set(FAISS_EXE_LINKER_FLAGS "-fopenmp=libgomp -llapack -lgfortran")
1054+
message(STATUS "OpenMP version: " ${OpenMP_CXX_VERSION})
10521055
else()
10531056
set(BLA_STATIC Off)
10541057
set(BLA_VENDOR OpenBLAS)
10551058
find_package(OpenMP REQUIRED)
1059+
add_definitions(-DARANGODB_OPENMP_VERSION=${OpenMP_CXX_VERSION})
1060+
10561061
find_package(LAPACK)
10571062
find_package(BLAS)
10581063

10591064
set(FAISS_EXE_LINKER_FLAGS "${OpenMP_CXX_FLAGS}")
1060-
10611065
foreach(lapack_lib ${LAPACK_LIBRARIES})
10621066
message(STATUS "Using LAPACK library: ${lapack_lib}")
10631067
set(FAISS_EXE_LINKER_FLAGS "${FAISS_EXE_LINKER_FLAGS} ${lapack_lib}")
@@ -1078,6 +1082,9 @@ set(FAISS_ENABLE_RAFT OFF CACHE BOOL "Disable RAFT")
10781082

10791083
add_subdirectory(3rdParty/faiss EXCLUDE_FROM_ALL)
10801084

1085+
add_library(faiss_interface INTERFACE)
1086+
target_include_directories(faiss_interface SYSTEM INTERFACE ${PROJECT_SOURCE_DIR}/3rdParty/faiss)
1087+
10811088
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_ORIG}")
10821089

10831090
# ------------------------------------------------------------------------------

lib/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ target_link_libraries(arango_basic_http_client
273273
fuerte
274274
rocksdb
275275
rocksdb_interface
276+
faiss_interface
276277
)
277278
target_include_directories(arango_basic_http_client PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
278279
if (USE_ENTERPRISE)

lib/Rest/Version.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525

2626
#include <cstdint>
2727
#include <sstream>
28-
#include <string_view>
2928

3029
#include <openssl/ssl.h>
3130

3231
#include <rocksdb/convenience.h>
3332
#include <rocksdb/version.h>
33+
#include <faiss/Index.h>
3434

3535
#include <velocypack/Builder.h>
3636
#include <velocypack/Version.h>
@@ -308,6 +308,8 @@ void Version::initialize() {
308308
#else
309309
Values["libunwind"] = "false";
310310
#endif
311+
Values["faiss"] = getFaissVersion();
312+
Values["openmp"] = getOpenMPVersion();
311313

312314
if constexpr (arangodb::build_id::supportsBuildIdReader()) {
313315
Values["build-id"] =
@@ -379,6 +381,19 @@ std::string Version::getBoostVersion() {
379381
#endif
380382
}
381383

384+
std::string Version::getFaissVersion() {
385+
return std::format("{}.{}.{}", FAISS_VERSION_MAJOR, FAISS_VERSION_MINOR,
386+
FAISS_VERSION_PATCH);
387+
}
388+
389+
std::string Version::getOpenMPVersion() {
390+
#if defined(ARANGODB_OPENMP_VERSION)
391+
return std::format("{}", ARANGODB_OPENMP_VERSION);
392+
#else
393+
return {};
394+
#endif
395+
}
396+
382397
// get boost reactor type
383398
std::string Version::getBoostReactorType() {
384399
#if defined(BOOST_ASIO_HAS_IOCP)

lib/Rest/Version.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ class Version {
143143
// get endianness
144144
static std::string getEndianness();
145145

146+
// get Faiss version
147+
static std::string getFaissVersion();
148+
149+
// get OpenMP version
150+
static std::string getOpenMPVersion();
151+
146152
// get plaform
147153
static std::string getPlatform();
148154

0 commit comments

Comments
 (0)