|
| 1 | +# Copyright (c) Meta Platforms, Inc. and affiliates. |
| 2 | +# |
| 3 | +# This source code is licensed under the MIT license found in the |
| 4 | +# LICENSE file in the root directory of this source tree. |
| 5 | + |
| 6 | +[build-system] |
| 7 | +requires = ["scikit-build-core>=0.10", "swig>=4.2,<5", "numpy>=2.0", "cmake>=3.24", "ninja"] |
| 8 | +build-backend = "scikit_build_core.build" |
| 9 | + |
| 10 | +[project] |
| 11 | +name = "faiss-gpu" |
| 12 | +dynamic = ["version"] |
| 13 | +description = "A library for efficient similarity search and clustering of dense vectors (GPU support)." |
| 14 | +readme = "README.md" |
| 15 | +license = "MIT" |
| 16 | +license-files = ["LICENSE", "THIRD_PARTY_NOTICES"] |
| 17 | +requires-python = ">=3.10" |
| 18 | +authors = [ |
| 19 | + { name = "Matthijs Douze" }, |
| 20 | + { name = "Jeff Johnson" }, |
| 21 | + { name = "Hervé Jégou" }, |
| 22 | + { name = "Lucas Hosseini" }, |
| 23 | +] |
| 24 | +keywords = ["similarity-search", "vector-search", "nearest-neighbors", "clustering", "gpu", "cuda"] |
| 25 | +classifiers = [ |
| 26 | + "Development Status :: 5 - Production/Stable", |
| 27 | + "Intended Audience :: Developers", |
| 28 | + "Intended Audience :: Science/Research", |
| 29 | + "Operating System :: POSIX :: Linux", |
| 30 | + "Programming Language :: C++", |
| 31 | + "Programming Language :: Python :: 3", |
| 32 | + "Programming Language :: Python :: 3.10", |
| 33 | + "Programming Language :: Python :: 3.11", |
| 34 | + "Programming Language :: Python :: 3.12", |
| 35 | + "Programming Language :: Python :: 3.13", |
| 36 | + "Programming Language :: Python :: 3 :: Only", |
| 37 | + "Programming Language :: Python :: Implementation :: CPython", |
| 38 | + "Topic :: Scientific/Engineering :: Artificial Intelligence", |
| 39 | + "Topic :: Software Development :: Libraries :: Python Modules", |
| 40 | + "Environment :: GPU :: NVIDIA CUDA :: 12", |
| 41 | +] |
| 42 | +dependencies = [ |
| 43 | + "numpy>=1.25", |
| 44 | + "packaging", |
| 45 | + "nvidia-cuda-runtime-cu12==12.6.*", |
| 46 | + "nvidia-cublas-cu12==12.6.*", |
| 47 | +] |
| 48 | + |
| 49 | +[project.urls] |
| 50 | +Homepage = "https://github.com/facebookresearch/faiss" |
| 51 | +Repository = "https://github.com/facebookresearch/faiss" |
| 52 | +Issues = "https://github.com/facebookresearch/faiss/issues" |
| 53 | +Documentation = "https://github.com/facebookresearch/faiss/wiki" |
| 54 | + |
| 55 | +[tool.scikit-build] |
| 56 | +cmake.build-type = "Release" |
| 57 | +metadata.version.provider = "scikit_build_core.metadata.regex" |
| 58 | +metadata.version.input = "CMakeLists.txt" |
| 59 | +metadata.version.regex = '^\s+VERSION\s+(?P<value>[0-9]+\.[0-9]+\.[0-9]+)' |
| 60 | +wheel.exclude = ["include/**", "share/**", "lib/cmake/**", "lib/pkgconfig/**"] |
| 61 | + |
| 62 | +[tool.scikit-build.cmake.define] |
| 63 | +FAISS_OPT_LEVEL = "dd" |
| 64 | +FAISS_ENABLE_GPU = "ON" |
| 65 | +FAISS_ENABLE_CUVS = "OFF" |
| 66 | +FAISS_ENABLE_PYTHON = "ON" |
| 67 | +FAISS_ENABLE_MKL = "OFF" |
| 68 | +FAISS_ENABLE_C_API = "OFF" |
| 69 | +FAISS_ENABLE_EXTRAS = "OFF" |
| 70 | +FAISS_ENABLE_SVS = "OFF" |
| 71 | +FAISS_USE_LTO = "ON" |
| 72 | +CMAKE_CUDA_ARCHITECTURES = "70-real;75-real;80-real;86-real;89-real;90" |
| 73 | +CMAKE_CUDA_FLAGS_RELEASE = "-O3 -Xfatbin=-compress-all --threads 4" |
| 74 | +CMAKE_C_FLAGS = "-fdata-sections -ffunction-sections" |
| 75 | +CMAKE_CXX_FLAGS = "-fdata-sections -ffunction-sections" |
| 76 | +CMAKE_SHARED_LINKER_FLAGS = "-Wl,--gc-sections -Wl,--strip-all" |
| 77 | +BUILD_TESTING = "OFF" |
| 78 | +BUILD_SHARED_LIBS = "ON" |
| 79 | + |
| 80 | +# abi3 opt-in (mirrors CPU pyproject.toml). |
| 81 | +[[tool.scikit-build.overrides]] |
| 82 | +if.platform-system = "linux" |
| 83 | +if.abi-flags = "^$" |
| 84 | +wheel.py-api = "cp310" |
| 85 | + |
| 86 | +[tool.cibuildwheel] |
| 87 | +build = "cp310-manylinux_x86_64" |
| 88 | +skip = "*-win* *-macosx* *-manylinux_i686 *-manylinux_aarch64 *-musllinux_*" |
| 89 | +test-requires = [ |
| 90 | + "numpy>=2.0,<3.0", |
| 91 | + "pytest", |
| 92 | + "nvidia-cuda-runtime-cu12==12.6.*", |
| 93 | + "nvidia-cublas-cu12==12.6.*", |
| 94 | +] |
| 95 | +test-command = "python -m pytest {project}/tests/test_wheel_smoke_gpu.py -v" |
| 96 | + |
| 97 | +[tool.cibuildwheel.linux] |
| 98 | +manylinux-x86_64-image = "manylinux_2_28" |
| 99 | +# manylinux_2_28 ships gcc-toolset-14; CUDA 12.6 only supports GCC <=13, so install |
| 100 | +# gcc-toolset-13 explicitly and force the build to use it via CC/CXX/CUDAHOSTCXX below. |
| 101 | +before-all = "dnf install -y gcc-toolset-13 epel-release && dnf install -y openblas-devel openblas-openmp swig && dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo && dnf install -y cuda-toolkit-12-6" |
| 102 | +# auditwheel: exclude libcuda.so.1 (host driver, not pip-installable) |
| 103 | +# and the libcudart/libcublas* shipped via nvidia-*-cu12 wheels (preloaded at import time). |
| 104 | +repair-wheel-command = "auditwheel repair -w {dest_dir} {wheel} --exclude libcudart.so.12 --exclude libcublas.so.12 --exclude libcublasLt.so.12 --exclude libcuda.so.1" |
| 105 | + |
| 106 | +[[tool.cibuildwheel.overrides]] |
| 107 | +select = "*-manylinux*" |
| 108 | +inherit.repair-wheel-command = "append" |
| 109 | +repair-wheel-command = "pipx run abi3audit --strict --report {wheel}" |
| 110 | + |
| 111 | +[tool.cibuildwheel.linux.environment] |
| 112 | +CUDA_HOME = "/usr/local/cuda-12.6" |
| 113 | +CUDACXX = "/usr/local/cuda-12.6/bin/nvcc" |
| 114 | +CC = "/opt/rh/gcc-toolset-13/root/usr/bin/gcc" |
| 115 | +CXX = "/opt/rh/gcc-toolset-13/root/usr/bin/g++" |
| 116 | +CUDAHOSTCXX = "/opt/rh/gcc-toolset-13/root/usr/bin/g++" |
0 commit comments