forked from facebookresearch/faiss
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
faiss-gpu-raft package (facebookresearch#2992)
Summary: Pull Request resolved: facebookresearch#2992 Reviewed By: mdouze Differential Revision: D48391366 Pulled By: algoriddle fbshipit-source-id: 94b7f62afc8a09a9feaea47bf60e5358d89fcde5
- Loading branch information
1 parent
c09992b
commit 2768fb3
Showing
18 changed files
with
283 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
python: | ||
- 3.8 # [not x86_64 or not osx] | ||
- 3.9 | ||
- 3.10 | ||
- 3.11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 libfaiss.so/libfaiss_avx2.so. | ||
cmake -B _build \ | ||
-DBUILD_SHARED_LIBS=ON \ | ||
-DBUILD_TESTING=OFF \ | ||
-DFAISS_OPT_LEVEL=avx2 \ | ||
-DFAISS_ENABLE_GPU=ON \ | ||
-DFAISS_ENABLE_RAFT=ON \ | ||
-DCMAKE_CUDA_ARCHITECTURES="${CUDA_ARCHS}" \ | ||
-DFAISS_ENABLE_PYTHON=OFF \ | ||
-DBLA_VENDOR=Intel10_64lp \ | ||
-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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/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=ON \ | ||
-DFAISS_ENABLE_RAFT=ON \ | ||
-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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# 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 version = environ.get('GIT_DESCRIBE_TAG').lstrip('v') %} | ||
{% set suffix = "_nightly" if environ.get('PACKAGE_TYPE') == 'nightly' else "" %} | ||
{% set number = GIT_DESCRIBE_NUMBER %} | ||
|
||
package: | ||
name: faiss-pkg | ||
version: {{ version }} | ||
|
||
build: | ||
number: {{ number }} | ||
|
||
about: | ||
home: https://github.com/facebookresearch/faiss | ||
license: MIT | ||
license_family: MIT | ||
license_file: LICENSE | ||
summary: A library for efficient similarity search and clustering of dense vectors. | ||
|
||
source: | ||
git_url: ../../ | ||
|
||
outputs: | ||
- name: libfaiss | ||
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 }}_cuda{{ cudatoolkit }}_raft{{ suffix }}" | ||
run_exports: | ||
- {{ pin_compatible('libfaiss', exact=True) }} | ||
script_env: | ||
- CUDA_ARCHS | ||
requirements: | ||
build: | ||
- {{ compiler('cxx') }} | ||
- sysroot_linux-64 # [linux64] | ||
- llvm-openmp # [osx] | ||
- cmake >=3.23.1 | ||
- make # [not win] | ||
- mkl-devel =2023 # [x86_64] | ||
host: | ||
- mkl =2023 # [x86_64] | ||
- openblas # [not x86_64] | ||
- cudatoolkit {{ cudatoolkit }} | ||
- libraft =23.08 | ||
run: | ||
- mkl =2023 # [x86_64] | ||
- openblas # [not x86_64] | ||
- {{ pin_compatible('cudatoolkit', max_pin='x.x') }} | ||
- libraft =23.08 | ||
test: | ||
requires: | ||
- conda-build | ||
commands: | ||
- 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-raft | ||
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: | ||
string: "py{{ PY_VER }}_h{{ PKG_HASH }}_{{ number }}_cuda{{ cudatoolkit }}{{ suffix }}" | ||
requirements: | ||
build: | ||
- {{ compiler('cxx') }} | ||
- sysroot_linux-64 =2.17 # [linux64] | ||
- swig | ||
- cmake >=3.23.1 | ||
- make # [not win] | ||
host: | ||
- python {{ python }} | ||
- numpy >=1.19,<2 | ||
- {{ pin_subpackage('libfaiss', exact=True) }} | ||
run: | ||
- python {{ python }} | ||
- numpy >=1.19,<2 | ||
- {{ pin_subpackage('libfaiss', exact=True) }} | ||
test: | ||
requires: | ||
- numpy | ||
- scipy | ||
- pytorch | ||
commands: | ||
- python -X faulthandler -m unittest discover -v -s tests/ -p "test_*" | ||
- python -X faulthandler -m unittest discover -v -s tests/ -p "torch_*" | ||
- 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 # [linux64] | ||
files: | ||
- test_cpu_dispatch.sh # [linux64] | ||
source_files: | ||
- tests/ | ||
- faiss/gpu/test/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.