# faiss-wheels
This repository is based on [kyamagu/faiss-wheels](https://github.com/kyamagu/faiss-wheels).
[![PyPI](https://img.shields.io/pypi/v/faiss-gpu-cu11?label=faiss-gpu-cu11)](https://pypi.org/project/faiss-gpu-cu11/)
[![PyPI](https://img.shields.io/pypi/v/faiss-gpu-cu12?label=faiss-gpu-cu12)](https://pypi.org/project/faiss-gpu-cu12/)
## Overview
This repository provides scripts to build gpu wheels for the [faiss](https://github.com/facebookresearch/faiss) library.
Distribute the `faiss-gpu-cuXX` package to PyPI using the contents of this repository.
* Builds CUDA 11.8+/CUDA 12.1+ compatible wheels.
* Support Pascal\~Hopper architecture GPU (Compute Capability 6.0\~9.0).
* **Dynamically linked to CUDA Runtime and cuBLAS libraries published in PyPI.**
* Bundles OpenBLAS in Linux.
## Installation
The `faiss-gpu-cu11` and `faiss-gpu-cu12` wheels built for CUDA11 and CUDA12 are available on PyPI.
Install one or the other depending on your environment.
These wheels dynamically link to the CUDA Runtime and cuBLAS shared libraries. This approach helps to reduce the file size of the wheels.
`faiss-gpu-cuXX(XX=11 or 12)` has dependencies on CUDA Runtime (`nvidia-cuda-runtime-cuXX`) and cuBLAS (`nvidia-cublas-cuXX`) released by PyPI, and links shared libraries in these packages.
**Therefore, there is no need to install CUDA on your host(system).**
### <span style="color: red; ">Caution</span>
The published `faiss-gpu-cuXX` package requires proper setup of system, hardware, and other dependencies that cannot be managed by the package manager (e.g. pip).
It is the responsibility of the user of this package to prepare an environment suitable for its operation.
Here are the main requirements that such an environment should meet (Other conditions may be hidden.)
1. the host environment must have a CUDA-compatible Nvidia Driver installed, as required by `faiss-gpu-cuXX` (see below for details)
2. the GPU architecture of the execution environment must be compatible with `faiss-gpu-cuXX` (see below for details)
3. if you install `faiss-gpu-cuXX` and another library (e.g. Pytorch) that uses dynamically linked CUDA in the same environment, they must be linked to the same CUDA shared library.
### Wheel for CUDA12
`faiss-gpu-cu12` is a package built using CUDA Toolkit 12.1.
The following command will install faiss and the CUDA Runtime and cuBLAS for CUDA 12.1 used at build time.
```bash
# install CUDA 12.1 at the same time
pip install faiss-gpu-cu12[fix-cuda]
```
**Requirements**
* OS: Linux
* arch: x86_64
* glibc >=2.28
* Nvidia driver: >=R530 (specify `fix-cuda` extra during installation)
* GPU architectures: Pascal\~Hopper (Compute Capability: 6.0\~9.0)
**Advanced**
The `faiss-gpu-cu12` package (the binaries contained in it) is minor version compatible with CUDA and will work dynamically linked with CUDA 12.X (X>=1).
Installation of the CUDA runtime and cuBLAS is allowed to the extent that minor version compatibility is maintained by excluding the `fix-cuda` extra.
This is useful when coexisting this package with a package that has a dependency on the CUDA Toolkit used at build time, such as Pytorch or Tensorflow.
The installation commands are as follows.
```bash
# install CUDA 12.X(X>=1) at the same time
pip install faiss-gpu-cu12
```
If you install the `faiss-gpu-cuXX` package in this way, CUDA may be updated due to lock file updates, etc.
Please note that this may cause an error depending on the compatibility with the driver. (Basically, to use a new CUDA, the driver must also be updated).
### Wheel for CUDA11
`faiss-gpu-cu11` is a package built using CUDA Toolkit 11.8.
The following command will install faiss and the CUDA Runtime and cuBLAS for CUDA 11.8 used at build time.
```bash
# install CUDA 11.8 at the same time
pip install faiss-gpu-cu11[fix-cuda]
```
**Requirements**
* OS: Linux
* arch: x86_64
* glibc >=2.28
* Nvidia driver: >=R520 (specify `fix-cuda` extra during installation)
* GPU architectures: Pascal\~Hopper (Compute Capability: 6.0\~9.0)
**Advanced**
Since CUDA 11.8 is the final version of the CUDA 11 series, the results are the same with or without the `fix-cuda` extras.
```bash
# install CUDA 11.X(X>=8) at the same time
pip install faiss-gpu-cu11
```
### Versioning rule
Packages to be published from this repository are "{A}.{B}.{C}.{D}" format.
A, B, and C are the versions of faiss used for builds.
D is the version used to manage changes specific to this repository.
## Usage
### Build wheels
You can build `faiss-gpu-cu11` and `faiss-gpu-cu12` wheels using [dagger](https://dagger.io).
```bash
# build wheel for CUDA 11.8
dagger call build-gpu-wheels --cuda-major-version 11 --host-directory=.:build-view --output ./wheelhouse/gpu/cuda11
# build wheel for CUDA 12.1
dagger call build-gpu-wheels --cuda-major-version 12 --host-directory=.:build-view --output ./wheelhouse/gpu/cuda12
```
When executed, a wheel is created under "{repository root}/wheelhouse/gpu/cuXX".
**Requirements**
* OS: Linux
* arch: x86_64
* Dagger: v0.13.5
### Test wheels
You can test `faiss-gpu-cu11` and `faiss-gpu-cu12` wheels using [dagger](https://dagger.io).
```bash
# test for faiss-gpu-cu11 wheels
_EXPERIMENTAL_DAGGER_GPU_SUPPORT=1 dagger call test-gpu-wheels --cuda-major-version 11 --host-directory=.:test-view --wheel-directory=./wheelhouse/gpu/cuda11/
# test for faiss-gpu-cu12 wheels
_EXPERIMENTAL_DAGGER_GPU_SUPPORT=1 dagger call test-gpu-wheels --cuda-major-version 12 --host-directory=.:test-view --wheel-directory=./wheelhouse/gpu/cuda12/
```
**Requirements**
* OS: Linux
* arch: x86_64
* Dagger: v0.13.5
* Nvidia container toolkit
* Nvidia driver: >=R530
### Build & Test wheels
You can build andtest `faiss-gpu-cu11` and `faiss-gpu-cu12` wheels using [dagger](https://dagger.io).
```bash
# test for faiss-gpu-cu11 & cu12 wheels
_EXPERIMENTAL_DAGGER_GPU_SUPPORT=1 dagger call faiss-gpu-ci --cuda-major-versions 11 --cuda-major-versions 12 --host-directory=.:ci-view --output=./wheelhouse
```
**Requirements**
* OS: Linux
* arch: x86_64
* Dagger: v0.13.5
* Nvidia container toolkit
* Nvidia driver: >=R530
Raw data
{
"_id": null,
"home_page": "https://github.com/Di-Is/faiss-gpu-wheels",
"name": "faiss-gpu-cu12",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "search nearest neighbors",
"author": "Di-Is",
"author_email": "rhoxbox@gmail.com@gmail.com",
"download_url": null,
"platform": null,
"description": "# faiss-wheels\n\nThis repository is based on [kyamagu/faiss-wheels](https://github.com/kyamagu/faiss-wheels).\n\n[![PyPI](https://img.shields.io/pypi/v/faiss-gpu-cu11?label=faiss-gpu-cu11)](https://pypi.org/project/faiss-gpu-cu11/)\n[![PyPI](https://img.shields.io/pypi/v/faiss-gpu-cu12?label=faiss-gpu-cu12)](https://pypi.org/project/faiss-gpu-cu12/)\n\n## Overview\n\nThis repository provides scripts to build gpu wheels for the [faiss](https://github.com/facebookresearch/faiss) library.\nDistribute the `faiss-gpu-cuXX` package to PyPI using the contents of this repository. \n\n* Builds CUDA 11.8+/CUDA 12.1+ compatible wheels.\n * Support Pascal\\~Hopper architecture GPU (Compute Capability 6.0\\~9.0).\n * **Dynamically linked to CUDA Runtime and cuBLAS libraries published in PyPI.**\n* Bundles OpenBLAS in Linux.\n\n\n## Installation\n\nThe `faiss-gpu-cu11` and `faiss-gpu-cu12` wheels built for CUDA11 and CUDA12 are available on PyPI.\nInstall one or the other depending on your environment.\nThese wheels dynamically link to the CUDA Runtime and cuBLAS shared libraries. This approach helps to reduce the file size of the wheels.\n\n`faiss-gpu-cuXX(XX=11 or 12)` has dependencies on CUDA Runtime (`nvidia-cuda-runtime-cuXX`) and cuBLAS (`nvidia-cublas-cuXX`) released by PyPI, and links shared libraries in these packages. \n**Therefore, there is no need to install CUDA on your host(system).**\n\n### <span style=\"color: red; \">Caution</span>\n\nThe published `faiss-gpu-cuXX` package requires proper setup of system, hardware, and other dependencies that cannot be managed by the package manager (e.g. pip).\nIt is the responsibility of the user of this package to prepare an environment suitable for its operation.\n\nHere are the main requirements that such an environment should meet (Other conditions may be hidden.)\n\n1. the host environment must have a CUDA-compatible Nvidia Driver installed, as required by `faiss-gpu-cuXX` (see below for details)\n2. the GPU architecture of the execution environment must be compatible with `faiss-gpu-cuXX` (see below for details)\n3. if you install `faiss-gpu-cuXX` and another library (e.g. Pytorch) that uses dynamically linked CUDA in the same environment, they must be linked to the same CUDA shared library.\n\n### Wheel for CUDA12\n\n`faiss-gpu-cu12` is a package built using CUDA Toolkit 12.1.\nThe following command will install faiss and the CUDA Runtime and cuBLAS for CUDA 12.1 used at build time.\n\n```bash\n# install CUDA 12.1 at the same time\npip install faiss-gpu-cu12[fix-cuda]\n```\n\n**Requirements**\n* OS: Linux\n * arch: x86_64\n * glibc >=2.28\n* Nvidia driver: >=R530 (specify `fix-cuda` extra during installation)\n* GPU architectures: Pascal\\~Hopper (Compute Capability: 6.0\\~9.0)\n\n**Advanced**\n\nThe `faiss-gpu-cu12` package (the binaries contained in it) is minor version compatible with CUDA and will work dynamically linked with CUDA 12.X (X>=1).\n\nInstallation of the CUDA runtime and cuBLAS is allowed to the extent that minor version compatibility is maintained by excluding the `fix-cuda` extra.\n\nThis is useful when coexisting this package with a package that has a dependency on the CUDA Toolkit used at build time, such as Pytorch or Tensorflow.\n\nThe installation commands are as follows.\n\n```bash\n# install CUDA 12.X(X>=1) at the same time\npip install faiss-gpu-cu12\n```\n\nIf you install the `faiss-gpu-cuXX` package in this way, CUDA may be updated due to lock file updates, etc.\n\nPlease note that this may cause an error depending on the compatibility with the driver. (Basically, to use a new CUDA, the driver must also be updated).\n\n\n### Wheel for CUDA11\n\n`faiss-gpu-cu11` is a package built using CUDA Toolkit 11.8.\nThe following command will install faiss and the CUDA Runtime and cuBLAS for CUDA 11.8 used at build time.\n\n```bash\n# install CUDA 11.8 at the same time\npip install faiss-gpu-cu11[fix-cuda]\n```\n\n**Requirements**\n* OS: Linux\n * arch: x86_64\n * glibc >=2.28\n* Nvidia driver: >=R520 (specify `fix-cuda` extra during installation)\n* GPU architectures: Pascal\\~Hopper (Compute Capability: 6.0\\~9.0)\n\n**Advanced**\n\nSince CUDA 11.8 is the final version of the CUDA 11 series, the results are the same with or without the `fix-cuda` extras.\n\n```bash\n# install CUDA 11.X(X>=8) at the same time\npip install faiss-gpu-cu11\n```\n\n### Versioning rule\n\nPackages to be published from this repository are \"{A}.{B}.{C}.{D}\" format.\nA, B, and C are the versions of faiss used for builds.\nD is the version used to manage changes specific to this repository.\n\n## Usage\n\n### Build wheels\n\nYou can build `faiss-gpu-cu11` and `faiss-gpu-cu12` wheels using [dagger](https://dagger.io).\n\n```bash\n# build wheel for CUDA 11.8\ndagger call build-gpu-wheels --cuda-major-version 11 --host-directory=.:build-view --output ./wheelhouse/gpu/cuda11\n\n# build wheel for CUDA 12.1\ndagger call build-gpu-wheels --cuda-major-version 12 --host-directory=.:build-view --output ./wheelhouse/gpu/cuda12\n```\n\nWhen executed, a wheel is created under \"{repository root}/wheelhouse/gpu/cuXX\".\n\n\n**Requirements**\n* OS: Linux\n * arch: x86_64\n* Dagger: v0.13.5\n\n### Test wheels\n\nYou can test `faiss-gpu-cu11` and `faiss-gpu-cu12` wheels using [dagger](https://dagger.io).\n\n\n```bash\n# test for faiss-gpu-cu11 wheels\n_EXPERIMENTAL_DAGGER_GPU_SUPPORT=1 dagger call test-gpu-wheels --cuda-major-version 11 --host-directory=.:test-view --wheel-directory=./wheelhouse/gpu/cuda11/\n\n# test for faiss-gpu-cu12 wheels\n_EXPERIMENTAL_DAGGER_GPU_SUPPORT=1 dagger call test-gpu-wheels --cuda-major-version 12 --host-directory=.:test-view --wheel-directory=./wheelhouse/gpu/cuda12/\n```\n\n**Requirements**\n* OS: Linux\n * arch: x86_64\n* Dagger: v0.13.5\n* Nvidia container toolkit\n* Nvidia driver: >=R530\n\n\n### Build & Test wheels\n\nYou can build andtest `faiss-gpu-cu11` and `faiss-gpu-cu12` wheels using [dagger](https://dagger.io).\n\n```bash\n# test for faiss-gpu-cu11 & cu12 wheels\n_EXPERIMENTAL_DAGGER_GPU_SUPPORT=1 dagger call faiss-gpu-ci --cuda-major-versions 11 --cuda-major-versions 12 --host-directory=.:ci-view --output=./wheelhouse\n```\n\n**Requirements**\n* OS: Linux\n * arch: x86_64\n* Dagger: v0.13.5\n* Nvidia container toolkit\n* Nvidia driver: >=R530\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "A library for efficient similarity search and clustering of dense vectors.",
"version": "1.9.0.0",
"project_urls": {
"Homepage": "https://github.com/Di-Is/faiss-gpu-wheels"
},
"split_keywords": [
"search",
"nearest",
"neighbors"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "793b720652c22248f35ff3c26b9817b90d9ae5f792e26ae87c8d90b9e9a0527f",
"md5": "029530bab0e50eed283acfef4e05f30b",
"sha256": "3eaa508ecc8facf42a0bfa087ad30f0a7fe8044c63e051ec6b3f97b0b88476a7"
},
"downloads": -1,
"filename": "faiss_gpu_cu12-1.9.0.0-cp310-cp310-manylinux_2_28_x86_64.whl",
"has_sig": false,
"md5_digest": "029530bab0e50eed283acfef4e05f30b",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": null,
"size": 66278495,
"upload_time": "2024-10-20T00:33:14",
"upload_time_iso_8601": "2024-10-20T00:33:14.744018Z",
"url": "https://files.pythonhosted.org/packages/79/3b/720652c22248f35ff3c26b9817b90d9ae5f792e26ae87c8d90b9e9a0527f/faiss_gpu_cu12-1.9.0.0-cp310-cp310-manylinux_2_28_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "b4dfa827a848648718dfd53dd7a848584d02a4bf8da4c92e6b83dc29fd2544c6",
"md5": "0ca3380ca7f3d8f366d119221b4ad45b",
"sha256": "b587397afb18f48dad3083858ef5f21c854c084ddcd27b8fd09bccf62a0c80d0"
},
"downloads": -1,
"filename": "faiss_gpu_cu12-1.9.0.0-cp311-cp311-manylinux_2_28_x86_64.whl",
"has_sig": false,
"md5_digest": "0ca3380ca7f3d8f366d119221b4ad45b",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": null,
"size": 66278616,
"upload_time": "2024-10-20T00:33:32",
"upload_time_iso_8601": "2024-10-20T00:33:32.567790Z",
"url": "https://files.pythonhosted.org/packages/b4/df/a827a848648718dfd53dd7a848584d02a4bf8da4c92e6b83dc29fd2544c6/faiss_gpu_cu12-1.9.0.0-cp311-cp311-manylinux_2_28_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "cbed99b3cb6489dd0f174fa5bf7ed79f0bf5ef619663939186c2fb35975882af",
"md5": "23cb7d07c6fca0979c75233327f7331d",
"sha256": "38e7b4a69bb1ba26e315efe5fc9d265fd409e71d62d34689cc0de35ca3c61b89"
},
"downloads": -1,
"filename": "faiss_gpu_cu12-1.9.0.0-cp312-cp312-manylinux_2_28_x86_64.whl",
"has_sig": false,
"md5_digest": "23cb7d07c6fca0979c75233327f7331d",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": null,
"size": 66284271,
"upload_time": "2024-10-20T00:33:50",
"upload_time_iso_8601": "2024-10-20T00:33:50.467492Z",
"url": "https://files.pythonhosted.org/packages/cb/ed/99b3cb6489dd0f174fa5bf7ed79f0bf5ef619663939186c2fb35975882af/faiss_gpu_cu12-1.9.0.0-cp312-cp312-manylinux_2_28_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "fea744f443032cf7fdb182cfffc119ae9c050cb2c8a88d47f5dfcd2171bb3663",
"md5": "8e7a61825a4cd3727882927f4e08b3da",
"sha256": "5c00d3b24fd81204964c5cc5585bff7f92c9c5b4392c15dbcf190e9e80eee2ff"
},
"downloads": -1,
"filename": "faiss_gpu_cu12-1.9.0.0-cp39-cp39-manylinux_2_28_x86_64.whl",
"has_sig": false,
"md5_digest": "8e7a61825a4cd3727882927f4e08b3da",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": null,
"size": 66278525,
"upload_time": "2024-10-20T00:34:17",
"upload_time_iso_8601": "2024-10-20T00:34:17.930593Z",
"url": "https://files.pythonhosted.org/packages/fe/a7/44f443032cf7fdb182cfffc119ae9c050cb2c8a88d47f5dfcd2171bb3663/faiss_gpu_cu12-1.9.0.0-cp39-cp39-manylinux_2_28_x86_64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-20 00:33:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Di-Is",
"github_project": "faiss-gpu-wheels",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "faiss-gpu-cu12"
}