Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions abs.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Increase timeout for CUDA builds which compile for multiple GPU architectures
# Default is 7200 seconds (2 hours), which is insufficient for Windows CUDA builds
task_timeout: 14400 # 4 hours

channels:
- build
28 changes: 22 additions & 6 deletions recipe/build-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,28 @@ cd ${SRC_DIR}
function version2int { echo "$@" | awk -F. '{ printf("%d%02d\n", $1, $2); }'; }

declare -a EXTRA_CMAKE_ARGS
# Cross builds (linux-aarch64, linux-ppc64le, linux-s390x, osx-arm64) link
# against OpenBLAS instead of MKL. Force FindBLAS to use OpenBLAS so it does
# not attempt to run detection binaries on the build host (which fails when
# cross compiling). Also hand CMake the actual library path so it does not try
# to execute detection binaries under emulation.
if [[ "${target_platform}" == linux-aarch64 || "${target_platform}" == osx-arm64 ]]; then
if [[ "${target_platform}" == osx-* ]]; then
EXTRA_CMAKE_ARGS+=(
-DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp"
-DOpenMP_CXX_LIB_NAMES=omp
-DOpenMP_omp_LIBRARY="$PREFIX/lib/libomp.dylib"
)
elif [[ "${target_platform}" == linux-* && "${blas_impl}" == "mkl" ]]; then
OPENMP_CXX_FLAG="-fopenmp"
if [[ "${CXX:-}" == *icpx* || "${CXX:-}" == *icpc* || "${CXX:-}" == *icc* ]]; then
OPENMP_CXX_FLAG="-qopenmp"
fi
EXTRA_CMAKE_ARGS+=(
-DOpenMP_CXX_FLAGS="${OPENMP_CXX_FLAG}"
-DOpenMP_CXX_LIB_NAMES=iomp5
-DOpenMP_iomp5_LIBRARY="$PREFIX/lib/libiomp5.so"
)
fi

# Force FindBLAS to use the selected OpenBLAS variant instead of probing other
# BLAS implementations. Hand CMake the actual library path so cross builds do
# not try to execute detection binaries under emulation.
if [[ "${blas_impl}" == "openblas" ]]; then
EXTRA_CMAKE_ARGS+=(-DBLA_VENDOR=OpenBLAS)
if [[ "${target_platform}" == osx-arm64 ]]; then
EXTRA_CMAKE_ARGS+=(
Expand Down
90 changes: 40 additions & 50 deletions recipe/build-pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,60 +10,50 @@ else
FAISS_ENABLE_GPU="OFF"
fi

# Build vanilla version (no avx2), see build-lib.sh
if [[ "${target_platform}" == "osx-64" ]]; then
cmake -G Ninja \
${CMAKE_ARGS} \
-Dfaiss_ROOT=_libfaiss_generic_stage/ \
-DFAISS_ENABLE_GPU=${FAISS_ENABLE_GPU} \
-DOpenMP_CXX_FLAGS=-fopenmp=libiomp5 \
-DOpenMP_CXX_LIB_NAMES=libiomp5 \
-DOpenMP_libiomp5_LIBRARY=$PREFIX/lib/libiomp5.dylib \
-DCMAKE_BUILD_TYPE=Release \
-DPython_EXECUTABLE="${PYTHON}" \
-B _build_python_generic \
faiss/python
cmake --build _build_python_generic --target swigfaiss -j $CPU_COUNT
else
cmake -G Ninja \
${CMAKE_ARGS} \
-Dfaiss_ROOT=_libfaiss_generic_stage/ \
-DFAISS_ENABLE_GPU=${FAISS_ENABLE_GPU} \
-DCMAKE_BUILD_TYPE=Release \
-DPython_EXECUTABLE="${PYTHON}" \
-B _build_python_generic \
faiss/python
cmake --build _build_python_generic --target swigfaiss -j $CPU_COUNT
declare -a OPENMP_CMAKE_ARGS
if [[ "${target_platform}" == osx-* ]]; then
OPENMP_CMAKE_ARGS+=(
-DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp"
-DOpenMP_CXX_LIB_NAMES=omp
-DOpenMP_omp_LIBRARY="$PREFIX/lib/libomp.dylib"
)
elif [[ "${target_platform}" == linux-* && "${blas_impl}" == "mkl" ]]; then
OPENMP_CXX_FLAG="-fopenmp"
if [[ "${CXX:-}" == *icpx* || "${CXX:-}" == *icpc* || "${CXX:-}" == *icc* ]]; then
OPENMP_CXX_FLAG="-qopenmp"
fi
OPENMP_CMAKE_ARGS+=(
-DOpenMP_CXX_FLAGS="${OPENMP_CXX_FLAG}"
-DOpenMP_CXX_LIB_NAMES=iomp5
-DOpenMP_iomp5_LIBRARY="$PREFIX/lib/libiomp5.so"
)
fi

# Build vanilla version (no avx2), see build-lib.sh
cmake -G Ninja \
${CMAKE_ARGS} \
${OPENMP_CMAKE_ARGS+"${OPENMP_CMAKE_ARGS[@]}"} \
-Dfaiss_ROOT=_libfaiss_generic_stage/ \
-DFAISS_ENABLE_GPU=${FAISS_ENABLE_GPU} \
-DCMAKE_BUILD_TYPE=Release \
-DPython_EXECUTABLE="${PYTHON}" \
-B _build_python_generic \
faiss/python
cmake --build _build_python_generic --target swigfaiss -j $CPU_COUNT

# Build version with avx2 support, see build-lib.sh
if [[ "${target_platform}" == *-64 ]]; then
if [[ "${target_platform}" == "osx-64" ]]; then
cmake -G Ninja \
${CMAKE_ARGS} \
-Dfaiss_ROOT=_libfaiss_avx2_stage/ \
-DOpenMP_CXX_FLAGS=-fopenmp=libiomp5 \
-DOpenMP_CXX_LIB_NAMES=libiomp5 \
-DOpenMP_libiomp5_LIBRARY=$PREFIX/lib/libiomp5.dylib \
-DFAISS_OPT_LEVEL=avx2 \
-DFAISS_ENABLE_GPU=${FAISS_ENABLE_GPU} \
-DCMAKE_BUILD_TYPE=Release \
-DPython_EXECUTABLE="${PYTHON}" \
-B _build_python_avx2 \
faiss/python
cmake --build _build_python_avx2 --target swigfaiss_avx2 -j $CPU_COUNT
else
cmake -G Ninja \
${CMAKE_ARGS} \
-Dfaiss_ROOT=_libfaiss_avx2_stage/ \
-DFAISS_OPT_LEVEL=avx2 \
-DFAISS_ENABLE_GPU=${FAISS_ENABLE_GPU} \
-DCMAKE_BUILD_TYPE=Release \
-DPython_EXECUTABLE="${PYTHON}" \
-B _build_python_avx2 \
faiss/python
cmake --build _build_python_avx2 --target swigfaiss_avx2 -j $CPU_COUNT
fi
cmake -G Ninja \
${CMAKE_ARGS} \
${OPENMP_CMAKE_ARGS+"${OPENMP_CMAKE_ARGS[@]}"} \
-Dfaiss_ROOT=_libfaiss_avx2_stage/ \
-DFAISS_OPT_LEVEL=avx2 \
-DFAISS_ENABLE_GPU=${FAISS_ENABLE_GPU} \
-DCMAKE_BUILD_TYPE=Release \
-DPython_EXECUTABLE="${PYTHON}" \
-B _build_python_avx2 \
faiss/python
cmake --build _build_python_avx2 --target swigfaiss_avx2 -j $CPU_COUNT

# copy generated swig module with avx2-support to specifically named file, cf.
# https://github.com/facebookresearch/faiss/blob/v1.7.1/faiss/python/setup.py#L37-L40
Expand Down
36 changes: 1 addition & 35 deletions recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,5 @@
# faiss v1.14.1 requires C++20 on MSVC (template lambdas in simd_dispatch.h).
# vs2019 doesn't support C++20 template lambdas; vs2022 required for all variants.
c_compiler: # [win]
- vs2022 # [win]
- vs2022 # [win]
- vs2022 # [win]
cxx_compiler: # [win]
- vs2022 # [win]
- vs2022 # [win]
- vs2022 # [win]

cuda_compiler_version:
- None # CPU variant - always built
- "12.9" # [win or linux]
- "13.1" # [win or linux]

# Python 3.13 builds currently fail on macOS (upstream SWIG bindings not ready).
# Upstream issue: https://github.com/facebookresearch/faiss/issues/3985
python:
- 3.10
- "3.11"
- "3.12"
- "3.13" # [not osx]

numpy:
- 2.1
- 2.1
- 2.1
- 2.1 # [not osx]

blas_impl:
- mkl # [not (aarch64 or arm64)]
- openblas # [aarch64 or arm64]

zip_keys: # [win]
- # [win]
- cuda_compiler_version # [win]
- c_compiler # [win]
- cxx_compiler # [win]
- "13.0" # [win or linux]
Loading