Skip to content

Commit

Permalink
Fix myscale mode setup error with msan build flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Aed-p authored and Linpeng Tang committed Nov 5, 2024
1 parent ed7a922 commit 86bd346
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions faiss/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,23 @@ target_link_libraries(faiss PRIVATE OpenMP::OpenMP_CXX)
target_link_libraries(faiss_avx2 PRIVATE OpenMP::OpenMP_CXX)

if(MYSCALE_MODE)
if(SANITIZE STREQUAL "memory")
# When building faiss with memory sanitizer, we will link with libblas
# and liblapack, because OpenBLAS is not compatible with memory sanitizer.
# See https://git.moqi.ai/mqdb/ClickHouse/-/issues/362#note_83111
set(BLAS_LIB
${TOOLCHAIN_PATH}/blas/libblas.a
${TOOLCHAIN_PATH}/lapack/liblapack.a)
else()
set(BLAS_LIB
${TOOLCHAIN_PATH}/openblas/libopenblas.a)
endif()
message(STATUS "BLAS_LIB: ${BLAS_LIB}")
set (MYSCALE_MODE_LINK_LIBRARIES
${MYSCALE_MODE_LINK_LIBRARIES}
${TOOLCHAIN_PATH}/openblas/libopenblas.a
${TOOLCHAIN_PATH}/${CMAKE_C_COMPILER_TARGET}/lib64/libgfortran.so.5.0.0
${TOOLCHAIN_PATH}/lib/${CMAKE_C_COMPILER_TARGET}/libomp.so.5)
${MYSCALE_MODE_LINK_LIBRARIES}
${BLAS_LIB}
${TOOLCHAIN_PATH}/${CMAKE_C_COMPILER_TARGET}/lib64/libgfortran.so.5.0.0
${TOOLCHAIN_PATH}/lib/${CMAKE_C_COMPILER_TARGET}/libomp.so.5)
message(STATUS "MYSCALE_MODE_LINK_LIBRARIES: ${MYSCALE_MODE_LINK_LIBRARIES}")
target_link_libraries(faiss PRIVATE ${MYSCALE_MODE_LINK_LIBRARIES})
target_link_libraries(faiss_avx2 PRIVATE ${MYSCALE_MODE_LINK_LIBRARIES})
Expand Down

0 comments on commit 86bd346

Please sign in to comment.