mirror of
https://github.com/facebookresearch/faiss.git
synced 2026-10-12 02:13:36 +00:00
fix osx openmp (#2857)
Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/2857 Reviewed By: alexanderguzhva Differential Revision: D45791625 Pulled By: algoriddle fbshipit-source-id: 52ec30f0ec66812f60a08843947aabe8be876afa
This commit is contained in:
committed by
Facebook GitHub Bot
parent
eea4a48b97
commit
f809cf0d51
+16
-10
@@ -26,7 +26,9 @@ source:
|
||||
|
||||
outputs:
|
||||
- name: libfaiss
|
||||
script: build-lib.sh
|
||||
script: build-lib.sh # [x86_64 and not win]
|
||||
script: build-lib-arm64.sh # [not x86_64]
|
||||
script: build-lib.bat # [win]
|
||||
build:
|
||||
string: "h{{ PKG_HASH }}_{{ number }}_cuda{{ cudatoolkit }}{{ suffix }}"
|
||||
run_exports:
|
||||
@@ -36,28 +38,32 @@ outputs:
|
||||
requirements:
|
||||
build:
|
||||
- {{ compiler('cxx') }}
|
||||
- sysroot_linux-64 =2.17 # [linux64]
|
||||
- sysroot_linux-64 =2.17 # [linux64]
|
||||
- llvm-openmp # [osx]
|
||||
- cmake =3.23.1
|
||||
- make # [not win]
|
||||
- mkl-devel =2023
|
||||
- mkl-devel =2023 # [x86_64]
|
||||
host:
|
||||
- mkl =2023
|
||||
- mkl =2023 # [x86_64]
|
||||
- openblas # [not x86_64]
|
||||
- cudatoolkit {{ cudatoolkit }}
|
||||
run:
|
||||
- mkl =2023
|
||||
- mkl =2023 # [x86_64]
|
||||
- openblas # [not x86_64]
|
||||
- {{ pin_compatible('cudatoolkit', max_pin='x.x') }}
|
||||
test:
|
||||
requires:
|
||||
- conda-build
|
||||
commands:
|
||||
- test -f $PREFIX/lib/libfaiss.so # [linux]
|
||||
- test -f $PREFIX/lib/libfaiss.dylib # [osx]
|
||||
- test -f $PREFIX/lib/libfaiss$SHLIB_EXT # [not win]
|
||||
- test -f $PREFIX/lib/libfaiss_avx2$SHLIB_EXT # [x86_64 and not win]
|
||||
- conda inspect linkages -p $PREFIX $PKG_NAME # [not win]
|
||||
- conda inspect objects -p $PREFIX $PKG_NAME # [osx]
|
||||
|
||||
- name: faiss-gpu
|
||||
script: build-pkg.sh
|
||||
script: build-pkg.sh # [x86_64 and not win]
|
||||
script: build-pkg-arm64.sh # [not x86_64]
|
||||
script: build-pkg.bat # [win]
|
||||
build:
|
||||
string: "py{{ PY_VER }}_h{{ PKG_HASH }}_{{ number }}_cuda{{ cudatoolkit }}{{ suffix }}"
|
||||
requirements:
|
||||
@@ -86,9 +92,9 @@ outputs:
|
||||
- cp tests/common_faiss_tests.py faiss/gpu/test
|
||||
- python -X faulthandler -m unittest discover -v -s faiss/gpu/test/ -p "test_*"
|
||||
- python -X faulthandler -m unittest discover -v -s faiss/gpu/test/ -p "torch_*"
|
||||
- sh test_cpu_dispatch.sh # [linux]
|
||||
- sh test_cpu_dispatch.sh # [linux64]
|
||||
files:
|
||||
- test_cpu_dispatch.sh # [linux]
|
||||
- test_cpu_dispatch.sh # [linux64]
|
||||
source_files:
|
||||
- tests/
|
||||
- faiss/gpu/test/
|
||||
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
set -e
|
||||
|
||||
|
||||
# Build libfaiss.so/libfaiss_avx2.so.
|
||||
cmake -B _build \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DFAISS_OPT_LEVEL=avx2 \
|
||||
-DFAISS_ENABLE_GPU=OFF \
|
||||
-DFAISS_ENABLE_PYTHON=OFF \
|
||||
-DBLA_VENDOR=Intel10_64lp \
|
||||
-DOpenMP_CXX_FLAGS=-fopenmp=libiomp5 \
|
||||
-DOpenMP_CXX_LIB_NAMES=libiomp5 \
|
||||
-DOpenMP_libiomp5_LIBRARY=$PREFIX/lib/libiomp5.dylib \
|
||||
-DCMAKE_INSTALL_LIBDIR=lib \
|
||||
-DCMAKE_BUILD_TYPE=Release .
|
||||
|
||||
make -C _build -j$(nproc) faiss faiss_avx2
|
||||
|
||||
cmake --install _build --prefix $PREFIX
|
||||
cmake --install _build --prefix _libfaiss_stage/
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
set -e
|
||||
|
||||
|
||||
# Build swigfaiss.so/swigfaiss_avx2.so.
|
||||
cmake -B _build_python_${PY_VER} \
|
||||
-Dfaiss_ROOT=_libfaiss_stage/ \
|
||||
-DFAISS_OPT_LEVEL=avx2 \
|
||||
-DFAISS_ENABLE_GPU=OFF \
|
||||
-DOpenMP_CXX_FLAGS=-fopenmp=libiomp5 \
|
||||
-DOpenMP_CXX_LIB_NAMES=libiomp5 \
|
||||
-DOpenMP_libiomp5_LIBRARY=$PREFIX/lib/libiomp5.dylib \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DPython_EXECUTABLE=$PYTHON \
|
||||
faiss/python
|
||||
|
||||
make -C _build_python_${PY_VER} -j$(nproc) swigfaiss swigfaiss_avx2
|
||||
|
||||
# Build actual python module.
|
||||
cd _build_python_${PY_VER}/
|
||||
$PYTHON setup.py install --single-version-externally-managed --record=record.txt --prefix=$PREFIX
|
||||
+11
-8
@@ -26,8 +26,9 @@ source:
|
||||
|
||||
outputs:
|
||||
- name: libfaiss
|
||||
script: build-lib.sh # [x86_64 and not win]
|
||||
script: build-lib-arm64.sh # [not x86_64]
|
||||
script: build-lib.sh # [x86_64 and not win and not osx]
|
||||
script: build-lib-osx.sh # [x86_64 and osx]
|
||||
script: build-lib-arm64.sh # [not x86_64]
|
||||
script: build-lib.bat # [win]
|
||||
build:
|
||||
string: "h{{ PKG_HASH }}_{{ number }}_cpu{{ suffix }}"
|
||||
@@ -36,16 +37,17 @@ outputs:
|
||||
requirements:
|
||||
build:
|
||||
- {{ compiler('cxx') }}
|
||||
- sysroot_linux-64 =2.17 # [linux64]
|
||||
- sysroot_linux-64 =2.17 # [linux64]
|
||||
- llvm-openmp # [osx]
|
||||
- cmake =3.23.1
|
||||
- make # [not win]
|
||||
- mkl-devel =2023 # [x86_64]
|
||||
- mkl-devel =2023 # [x86_64]
|
||||
host:
|
||||
- mkl =2023 # [x86_64]
|
||||
- openblas # [not x86_64]
|
||||
- mkl =2023 # [x86_64]
|
||||
- openblas # [not x86_64]
|
||||
run:
|
||||
- mkl =2023 # [x86_64]
|
||||
- openblas # [not x86_64]
|
||||
- openblas # [not x86_64]
|
||||
test:
|
||||
requires:
|
||||
- conda-build
|
||||
@@ -56,7 +58,8 @@ outputs:
|
||||
- conda inspect objects -p $PREFIX $PKG_NAME # [osx]
|
||||
|
||||
- name: faiss-cpu
|
||||
script: build-pkg.sh # [x86_64 and not win]
|
||||
script: build-pkg.sh # [x86_64 and not win and not osx]
|
||||
script: build-pkg-osx.sh # [x86_64 and osx]
|
||||
script: build-pkg-arm64.sh # [not x86_64]
|
||||
script: build-pkg.bat # [win]
|
||||
build:
|
||||
|
||||
Reference in New Issue
Block a user