diff --git a/recipe/build-lib.bat b/recipe/build-lib.bat index d1d29bf6..27a9dd8c 100644 --- a/recipe/build-lib.bat +++ b/recipe/build-lib.bat @@ -44,6 +44,7 @@ cmake %CMAKE_ARGS% ^ -DFAISS_ENABLE_PYTHON=OFF ^ -DFAISS_ENABLE_GPU=!FAISS_ENABLE_GPU! ^ -DCMAKE_BUILD_TYPE=Release ^ + -DCMAKE_BUILD_PARALLEL_LEVEL="%CPU_COUNT%" ^ -DCMAKE_INSTALL_BINDIR="%LIBRARY_BIN%" ^ -DCMAKE_INSTALL_LIBDIR="%LIBRARY_LIB%" ^ -DCMAKE_INSTALL_INCLUDEDIR="%LIBRARY_INC%" ^ @@ -58,7 +59,7 @@ if "%CF_FAISS_BUILD%"=="avx2" ( set "TARGET=faiss" ) -cmake --build _build_%CF_FAISS_BUILD% --target %TARGET% --config Release -j %CPU_COUNT% +cmake --build _build_%CF_FAISS_BUILD% --target %TARGET% --config Release if %ERRORLEVEL% neq 0 exit 1 cmake --install _build_%CF_FAISS_BUILD% --config Release --prefix %PREFIX% diff --git a/recipe/build-lib.sh b/recipe/build-lib.sh index 526fd5bd..938402ad 100644 --- a/recipe/build-lib.sh +++ b/recipe/build-lib.sh @@ -56,6 +56,7 @@ cmake ${CMAKE_ARGS} \ -DFAISS_ENABLE_PYTHON=OFF \ -DFAISS_ENABLE_GPU=${FAISS_ENABLE_GPU} \ -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_BUILD_PARALLEL_LEVEL="${CPU_COUNT}" \ -DCMAKE_INSTALL_LIBDIR=lib \ ${CUDA_CONFIG_ARGS+"${CUDA_CONFIG_ARGS[@]}"} \ -B _build_${CF_FAISS_BUILD} \ @@ -67,6 +68,6 @@ else TARGET="faiss" fi -cmake --build _build_${CF_FAISS_BUILD} --target ${TARGET} -j $CPU_COUNT +cmake --build _build_${CF_FAISS_BUILD} --target ${TARGET} cmake --install _build_${CF_FAISS_BUILD} --prefix $PREFIX cmake --install _build_${CF_FAISS_BUILD} --prefix _libfaiss_${CF_FAISS_BUILD}_stage/ diff --git a/recipe/build-pkg.bat b/recipe/build-pkg.bat index 47416186..df17664d 100644 --- a/recipe/build-pkg.bat +++ b/recipe/build-pkg.bat @@ -13,11 +13,12 @@ cmake -B _build_python_generic ^ -Dfaiss_ROOT=_libfaiss_generic_stage ^ -DFAISS_ENABLE_GPU=!FAISS_ENABLE_GPU! ^ -DCMAKE_BUILD_TYPE=Release ^ + -DCMAKE_BUILD_PARALLEL_LEVEL="%CPU_COUNT%" ^ -DPython_EXECUTABLE="%PYTHON%" ^ faiss/python if %ERRORLEVEL% neq 0 exit 1 -cmake --build _build_python_generic --target swigfaiss --config Release -j %CPU_COUNT% +cmake --build _build_python_generic --target swigfaiss --config Release if %ERRORLEVEL% neq 0 exit 1 :: Build version with avx2 support, see build-lib.bat @@ -26,11 +27,12 @@ cmake -B _build_python_avx2 ^ -DFAISS_OPT_LEVEL=avx2 ^ -DFAISS_ENABLE_GPU=!FAISS_ENABLE_GPU! ^ -DCMAKE_BUILD_TYPE=Release ^ + -DCMAKE_BUILD_PARALLEL_LEVEL="%CPU_COUNT%" ^ -DPython_EXECUTABLE="%PYTHON%" ^ faiss/python if %ERRORLEVEL% neq 0 exit 1 -cmake --build _build_python_avx2 --target swigfaiss_avx2 --config Release -j %CPU_COUNT% +cmake --build _build_python_avx2 --target swigfaiss_avx2 --config Release if %ERRORLEVEL% neq 0 exit 1 :: copy generated swig module with avx2-support to specifically named file, cf. diff --git a/recipe/build-pkg.sh b/recipe/build-pkg.sh index 6a10689d..8a609672 100644 --- a/recipe/build-pkg.sh +++ b/recipe/build-pkg.sh @@ -13,10 +13,11 @@ cmake ${CMAKE_ARGS} \ -Dfaiss_ROOT=_libfaiss_generic_stage/ \ -DFAISS_ENABLE_GPU=${FAISS_ENABLE_GPU} \ -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_BUILD_PARALLEL_LEVEL="${CPU_COUNT}" \ -DPython_EXECUTABLE="${PYTHON}" \ -B _build_python_generic \ faiss/python -cmake --build _build_python_generic --target swigfaiss -j $CPU_COUNT +cmake --build _build_python_generic --target swigfaiss # Build version with avx2 support, see build-lib.sh if [[ "${target_platform}" == *-64 ]]; then @@ -25,10 +26,11 @@ if [[ "${target_platform}" == *-64 ]]; then -DFAISS_OPT_LEVEL=avx2 \ -DFAISS_ENABLE_GPU=${FAISS_ENABLE_GPU} \ -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_BUILD_PARALLEL_LEVEL="${CPU_COUNT}" \ -DPython_EXECUTABLE="${PYTHON}" \ -B _build_python_avx2 \ faiss/python - cmake --build _build_python_avx2 --target swigfaiss_avx2 -j $CPU_COUNT + cmake --build _build_python_avx2 --target swigfaiss_avx2 # 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