Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions F/Faiss/Faiss/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ include(joinpath(@__DIR__, "..", "common.jl"))

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies;
julia_compat="1.6",
preferred_gcc_version=v"10", # Not using v"7", since OpenBLAS v0.3.29+ on PowerPC64LE requires libgfortran5, and not using v"8", and v"9" due to internal compiler errors on aarch64-linux-gnu
julia_compat="1.9",
preferred_gcc_version=v"7",
)
2 changes: 1 addition & 1 deletion F/Faiss/Faiss_CUDA/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ for platform in platforms

build_tarballs(ARGS, name, version, sources, script, [platform], products, [dependencies; cuda_deps];
lazy_artifacts=true,
julia_compat="1.6",
julia_compat="1.9",
preferred_gcc_version=v"7",
augment_platform_block=CUDA.augment,
skip_audit=true,
Expand Down
27 changes: 27 additions & 0 deletions F/Faiss/bundled/patches/faiss-cmake-mkl-optional.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c4fea46a..12f8aef5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,6 +59,7 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# Valid values are "generic", "avx2", "avx512", "sve".
option(FAISS_OPT_LEVEL "" "generic")
option(FAISS_ENABLE_GPU "Enable support for GPU indexes." ON)
+option(FAISS_ENABLE_MKL "Enable MKL." ON)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

option(FAISS_ENABLE_RAFT "Enable RAFT for GPU indexes." OFF)
option(FAISS_ENABLE_ROCM "Enable ROCm for GPU indexes." OFF)
option(FAISS_ENABLE_PYTHON "Build Python extension." ON)
diff --git a/faiss/CMakeLists.txt b/faiss/CMakeLists.txt
index 2871d974..6588b2d2 100644
--- a/faiss/CMakeLists.txt
+++ b/faiss/CMakeLists.txt
@@ -354,7 +354,9 @@ target_link_libraries(faiss_avx2 PRIVATE OpenMP::OpenMP_CXX)
target_link_libraries(faiss_avx512 PRIVATE OpenMP::OpenMP_CXX)
target_link_libraries(faiss_sve PRIVATE OpenMP::OpenMP_CXX)

-find_package(MKL)
+if(FAISS_ENABLE_MKL)
+ find_package(MKL)
+endif()
if(MKL_FOUND)
target_link_libraries(faiss PRIVATE ${MKL_LIBRARIES})
target_link_libraries(faiss_avx2 PRIVATE ${MKL_LIBRARIES})
29 changes: 14 additions & 15 deletions F/Faiss/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,21 @@ apk del cmake

cd faiss

atomic_patch -p1 ../patches/faiss-cmake-mkl-optional.patch
atomic_patch -p1 ../patches/faiss-mingw32-cmake.patch
atomic_patch -p1 ../patches/faiss-mingw32-InvertedListsIOHook.patch
atomic_patch -p1 ../patches/faiss-mingw32.patch

cmake_extra_args=()

if [[ "$bb_full_target" != armv6l-linux-* ]]; then
libblastrampoline=$(find $libdir -name libblastrampoline'*'.$dlext) # Enable Windows builds to find libblastrampoline
cmake_extra_args+=(
"-DBLAS_LIBRARIES=$libblastrampoline"
"-DLAPACK_LIBRARIES=$libblastrampoline"
)
fi

if [[ $bb_full_target == *cuda* ]]; then
cuda_version=${bb_full_target##*-cuda+}
if [[ $cuda_version == "11.8" ]]; then
Expand Down Expand Up @@ -45,6 +54,7 @@ cmake -B build \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
-DCMAKE_BUILD_TYPE=Release \
-DFAISS_ENABLE_GPU=OFF \
-DFAISS_ENABLE_MKL=OFF \
-DFAISS_ENABLE_PYTHON=OFF \
-DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=ON \
Expand All @@ -62,19 +72,10 @@ fi

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = supported_platforms()

mkl_platforms = Platform[
Platform("x86_64", "Linux"),
Platform("x86_64", "MacOS"),
Platform("x86_64", "Windows"),
]

openblas_platforms = filter(p -> p ∉ mkl_platforms, platforms)
platforms = expand_cxxstring_abis(supported_platforms())

platforms = expand_cxxstring_abis(platforms)
mkl_platforms = expand_cxxstring_abis(mkl_platforms)
openblas_platforms = expand_cxxstring_abis(openblas_platforms)
openblas_platforms = filter(p -> arch(p) == "armv6l", platforms)
libblastrampoline_platforms = filter(p -> p ∉ openblas_platforms, platforms)

# The products that we will ensure are always built
products = Product[
Expand All @@ -90,9 +91,7 @@ dependencies = [
# systems), and libgomp from `CompilerSupportLibraries_jll` everywhere else.
Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae"); platforms=filter(!Sys.isbsd, platforms)),
Dependency(PackageSpec(name="LLVMOpenMP_jll", uuid="1d63c593-3942-5779-bab2-d838dc0a180e"); platforms=filter(Sys.isbsd, platforms)),
Dependency("LAPACK_jll"; platforms = openblas_platforms),
Dependency("MKL_jll"; platforms = mkl_platforms),
BuildDependency("MKL_Headers_jll"; platforms = mkl_platforms),
Dependency("libblastrampoline_jll"; compat="5.4", platforms = libblastrampoline_platforms),
Dependency("OpenBLAS32_jll"; platforms = openblas_platforms),
HostBuildDependency(PackageSpec("CMake_jll", v"3.28.1")),
]