diff --git a/.github/actions/build_cmake/action.yml b/.github/actions/build_cmake/action.yml index fa20974af5..63426c9d91 100644 --- a/.github/actions/build_cmake/action.yml +++ b/.github/actions/build_cmake/action.yml @@ -122,7 +122,7 @@ runs: -DFAISS_OPT_LEVEL=${{ inputs.opt_level }} \ -DFAISS_ENABLE_C_API=ON \ -DPYTHON_EXECUTABLE=$CONDA/bin/python \ - -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_BUILD_TYPE=Debug \ -DBLA_VENDOR=${{ runner.arch == 'X64' && 'Intel10_64_dyn' || '' }} \ -DCMAKE_CUDA_FLAGS=${{ runner.arch == 'X64' && '"-gencode arch=compute_75,code=sm_75"' || '' }} \ . diff --git a/.github/actions/build_conda/action.yml b/.github/actions/build_conda/action.yml index ff860007b2..def47a28a7 100644 --- a/.github/actions/build_conda/action.yml +++ b/.github/actions/build_conda/action.yml @@ -26,20 +26,27 @@ runs: else echo "shell=pwsh" >> "$GITHUB_OUTPUT" fi + echo "${{ runner.arch }}" - name: Setup miniconda uses: conda-incubator/setup-miniconda@v3 with: python-version: '3.11' - miniconda-version: latest + miniforge-version: latest # ensures conda-forge channel is used. + channels: conda-forge + conda-remove-defaults: 'true' + # Set to runner.arch=aarch64 if we're on arm64 because + # there's no miniforge ARM64 package, just aarch64. + # They are the same thing, just named differently. + # However there is an ARM64 for macOS, so exclude that. + architecture: ${{ (runner.arch == 'ARM64' && runner.os != 'macOS') && 'aarch64' || runner.arch }} - name: Install conda build tools shell: ${{ steps.choose_shell.outputs.shell }} run: | + # Ensure starting packages are from conda-forge. + conda list --show-channel-urls conda install -y -q "conda!=24.11.0" conda install -y -q "conda-build!=24.11.0" - - name: Fix CI failure - shell: ${{ steps.choose_shell.outputs.shell }} - if: runner.os != 'Windows' - run: conda remove conda-anaconda-telemetry + conda list --show-channel-urls - name: Enable anaconda uploads if: inputs.label != '' shell: ${{ steps.choose_shell.outputs.shell }} @@ -94,3 +101,8 @@ runs: run: | conda build faiss-gpu-cuvs --variants '{ "cudatoolkit": "${{ inputs.cuda }}" }' \ --user pytorch --label ${{ inputs.label }} -c pytorch -c rapidsai -c rapidsai-nightly -c conda-forge -c nvidia + - name: Check installed packages channel + shell: ${{ steps.choose_shell.outputs.shell }} + run: | + # Shows that all installed packages are from conda-forge. + conda list --show-channel-urls diff --git a/.github/workflows/build-pull-request.yml b/.github/workflows/build-pull-request.yml index bc0d2d625a..cea5648452 100644 --- a/.github/workflows/build-pull-request.yml +++ b/.github/workflows/build-pull-request.yml @@ -30,140 +30,270 @@ jobs: git --no-pager diff --color exit 1 fi - linux-x86_64-cmake: - name: Linux x86_64 (cmake) - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build and Test (cmake) - uses: ./.github/actions/build_cmake - linux-x86_64-AVX2-cmake: - name: Linux x86_64 AVX2 (cmake) - needs: linux-x86_64-cmake - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build and Test (cmake) - uses: ./.github/actions/build_cmake - with: - opt_level: avx2 - linux-x86_64-AVX512-cmake: - name: Linux x86_64 AVX512 (cmake) - needs: linux-x86_64-cmake - runs-on: faiss-aws-m7i.large - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build and Test (cmake) - uses: ./.github/actions/build_cmake - with: - opt_level: avx512 - linux-x86_64-AVX512_SPR-cmake: - name: Linux x86_64 AVX512_SPR (cmake) - needs: linux-x86_64-cmake - runs-on: faiss-aws-m7i.large - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build and Test (cmake) - uses: ./.github/actions/build_cmake - with: - opt_level: avx512_spr - linux-x86_64-GPU-cmake: - name: Linux x86_64 GPU (cmake) - needs: linux-x86_64-cmake + # linux-x86_64-cmake: + # name: Linux x86_64 (cmake) + # runs-on: ubuntu-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # - name: Build and Test (cmake) + # uses: ./.github/actions/build_cmake + # linux-x86_64-AVX2-cmake: + # name: Linux x86_64 AVX2 (cmake) + # needs: linux-x86_64-cmake + # runs-on: ubuntu-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # - name: Build and Test (cmake) + # uses: ./.github/actions/build_cmake + # with: + # opt_level: avx2 + # linux-x86_64-AVX512-cmake: + # name: Linux x86_64 AVX512 (cmake) + # needs: linux-x86_64-cmake + # runs-on: faiss-aws-m7i.large + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # - name: Build and Test (cmake) + # uses: ./.github/actions/build_cmake + # with: + # opt_level: avx512 + # linux-x86_64-AVX512_SPR-cmake: + # name: Linux x86_64 AVX512_SPR (cmake) + # needs: linux-x86_64-cmake + # runs-on: faiss-aws-m7i.large + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # - name: Build and Test (cmake) + # uses: ./.github/actions/build_cmake + # with: + # opt_level: avx512_spr + # linux-x86_64-GPU-cmake: + # name: Linux x86_64 GPU (cmake) + # needs: linux-x86_64-cmake + # runs-on: 4-core-ubuntu-gpu-t4 + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # - name: Build and Test (cmake) + # uses: ./.github/actions/build_cmake + # with: + # gpu: ON + # linux-x86_64-GPU-w-CUVS-cmake: + # name: Linux x86_64 GPU w/ cuVS (cmake) + # needs: linux-x86_64-cmake + # runs-on: 4-core-ubuntu-gpu-t4 + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # - name: Build and Test (cmake) + # uses: ./.github/actions/build_cmake + # with: + # gpu: ON + # cuvs: ON + # linux-x86_64-GPU-w-ROCm-cmake: + # name: Linux x86_64 GPU w/ ROCm (cmake) + # needs: linux-x86_64-cmake + # runs-on: faiss-amd-MI200 + # container: + # image: ubuntu:22.04 + # options: --device=/dev/kfd --device=/dev/dri --ipc=host --shm-size 16G --group-add video --cap-add=SYS_PTRACE --cap-add=SYS_ADMIN + # steps: + # - name: Container setup + # run: | + # if [ -f /.dockerenv ]; then + # apt-get update && apt-get install -y sudo && apt-get install -y git + # git config --global --add safe.directory '*' + # else + # echo 'Skipping. Current job is not running inside a container.' + # fi + # - name: Checkout + # uses: actions/checkout@v4 + # - name: Build and Test (cmake) + # uses: ./.github/actions/build_cmake + # with: + # gpu: ON + # rocm: ON + # linux-arm64-SVE-cmake: + # name: Linux arm64 SVE (cmake) + # needs: linux-x86_64-cmake + # runs-on: faiss-aws-r8g.large + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # - name: Build and Test (cmake) + # uses: ./.github/actions/build_cmake + # with: + # opt_level: sve + # env: + # # Context: https://github.com/facebookresearch/faiss/wiki/Troubleshooting#surprising-faiss-openmp-and-openblas-interaction + # OPENBLAS_NUM_THREADS: '1' + # linux-x86_64-conda: + # name: Linux x86_64 (conda) + # needs: linux-x86_64-cmake + # runs-on: ubuntu-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # fetch-tags: true + # - name: Build and Package (conda) + # uses: ./.github/actions/build_conda + # windows-x86_64-conda: + # name: Windows x86_64 (conda) + # needs: linux-x86_64-cmake + # runs-on: windows-2019 + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # fetch-tags: true + # - name: Build and Package (conda) + # uses: ./.github/actions/build_conda + # linux-arm64-conda: + # name: Linux arm64 (conda) + # needs: linux-x86_64-cmake + # runs-on: 2-core-ubuntu-arm + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # fetch-tags: true + # - name: Build and Package (conda) + # uses: ./.github/actions/build_conda + # linux-x86_64-nightly: + # name: Linux x86_64 nightlies + # runs-on: 4-core-ubuntu + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # fetch-tags: true + # - uses: ./.github/actions/build_conda + # env: + # ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} + # with: + # label: nightly + linux-x86_64-GPU-CUDA-11-4-4-nightly: + name: Linux x86_64 GPU nightlies (CUDA 11.4.4) runs-on: 4-core-ubuntu-gpu-t4 - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build and Test (cmake) - uses: ./.github/actions/build_cmake - with: - gpu: ON - linux-x86_64-GPU-w-CUVS-cmake: - name: Linux x86_64 GPU w/ cuVS (cmake) - needs: linux-x86_64-cmake - runs-on: 4-core-ubuntu-gpu-t4 - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build and Test (cmake) - uses: ./.github/actions/build_cmake - with: - gpu: ON - cuvs: ON - linux-x86_64-GPU-w-ROCm-cmake: - name: Linux x86_64 GPU w/ ROCm (cmake) - needs: linux-x86_64-cmake - runs-on: faiss-amd-MI200 - container: - image: ubuntu:22.04 - options: --device=/dev/kfd --device=/dev/dri --ipc=host --shm-size 16G --group-add video --cap-add=SYS_PTRACE --cap-add=SYS_ADMIN - steps: - - name: Container setup - run: | - if [ -f /.dockerenv ]; then - apt-get update && apt-get install -y sudo && apt-get install -y git - git config --global --add safe.directory '*' - else - echo 'Skipping. Current job is not running inside a container.' - fi - - name: Checkout - uses: actions/checkout@v4 - - name: Build and Test (cmake) - uses: ./.github/actions/build_cmake - with: - gpu: ON - rocm: ON - linux-arm64-SVE-cmake: - name: Linux arm64 SVE (cmake) - needs: linux-x86_64-cmake - runs-on: faiss-aws-r8g.large - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build and Test (cmake) - uses: ./.github/actions/build_cmake - with: - opt_level: sve - env: - # Context: https://github.com/facebookresearch/faiss/wiki/Troubleshooting#surprising-faiss-openmp-and-openblas-interaction - OPENBLAS_NUM_THREADS: '1' - linux-x86_64-conda: - name: Linux x86_64 (conda) - needs: linux-x86_64-cmake - runs-on: ubuntu-latest + env: + CUDA_ARCHS: "60-real;61-real;62-real;70-real;72-real;75-real;80;86-real" + FAISS_FLATTEN_CONDA_INCLUDES: "1" steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 fetch-tags: true - - name: Build and Package (conda) - uses: ./.github/actions/build_conda - windows-x86_64-conda: - name: Windows x86_64 (conda) - needs: linux-x86_64-cmake - runs-on: windows-2019 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - fetch-tags: true - - name: Build and Package (conda) - uses: ./.github/actions/build_conda - linux-arm64-conda: - name: Linux arm64 (conda) - needs: linux-x86_64-cmake - runs-on: 2-core-ubuntu-arm - steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: ./.github/actions/build_conda + env: + ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} with: - fetch-depth: 0 - fetch-tags: true - - name: Build and Package (conda) - uses: ./.github/actions/build_conda + label: nightly + cuda: "11.4.4" + - name: Setup tmate session + if: failure() + uses: mxschmitt/action-tmate@v3 + # linux-x86_64-GPU-CUVS-CUDA11-8-0-nightly: + # name: Linux x86_64 GPU w/ cuVS nightlies (CUDA 11.8.0) + # runs-on: 4-core-ubuntu-gpu-t4 + # env: + # CUDA_ARCHS: "70-real;72-real;75-real;80;86-real" + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # fetch-tags: true + # - uses: ./.github/actions/build_conda + # env: + # ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} + # with: + # label: nightly + # cuvs: "ON" + # cuda: "11.8.0" + # linux-x86_64-GPU-CUDA-12-1-1-nightly: + # name: Linux x86_64 GPU nightlies (CUDA 12.1.1) + # runs-on: 4-core-ubuntu-gpu-t4 + # env: + # CUDA_ARCHS: "70-real;72-real;75-real;80;86-real" + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # fetch-tags: true + # - uses: ./.github/actions/build_conda + # env: + # ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} + # with: + # label: nightly + # cuda: "12.1.1" + # linux-x86_64-GPU-CUVS-CUDA12-4-0-nightly: + # name: Linux x86_64 GPU w/ cuVS nightlies (CUDA 12.4.0) + # runs-on: 4-core-ubuntu-gpu-t4 + # env: + # CUDA_ARCHS: "70-real;72-real;75-real;80;86-real" + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # fetch-tags: true + # - uses: ./.github/actions/build_conda + # env: + # ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} + # with: + # label: nightly + # cuvs: "ON" + # cuda: "12.4.0" + # windows-x86_64-nightly: + # name: Windows x86_64 nightlies + # runs-on: windows-2019 + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # fetch-tags: true + # - uses: ./.github/actions/build_conda + # env: + # ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} + # with: + # label: nightly + # osx-arm64-nightly: + # name: OSX arm64 nightlies + # runs-on: macos-14 + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # fetch-tags: true + # - uses: ./.github/actions/build_conda + # env: + # ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} + # with: + # label: nightly + # linux-arm64-nightly: + # name: Linux arm64 nightlies + # runs-on: 2-core-ubuntu-arm + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # fetch-tags: true + # - uses: ./.github/actions/build_conda + # env: + # ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} + # with: + # label: nightly diff --git a/conda/conda_build_config.yaml b/conda/conda_build_config.yaml index 4df05146df..94aae1c31b 100644 --- a/conda/conda_build_config.yaml +++ b/conda/conda_build_config.yaml @@ -1,5 +1,5 @@ python: - - 3.9 - - 3.10 + # - 3.9 + # - 3.10 - 3.11 - - 3.12 # [not aarch64] + # - 3.12 # [not aarch64] diff --git a/conda/faiss-gpu/build-lib.sh b/conda/faiss-gpu/build-lib.sh index befad80547..a0c16a9cf4 100755 --- a/conda/faiss-gpu/build-lib.sh +++ b/conda/faiss-gpu/build-lib.sh @@ -24,7 +24,7 @@ cmake -B _build \ -DFAISS_ENABLE_PYTHON=OFF \ -DBLA_VENDOR=Intel10_64lp \ -DCMAKE_INSTALL_LIBDIR=lib \ - -DCMAKE_BUILD_TYPE=Release . + -DCMAKE_BUILD_TYPE=Debug . make -C _build -j$(nproc) faiss faiss_avx2 faiss_avx512 diff --git a/conda/faiss-gpu/build-pkg.sh b/conda/faiss-gpu/build-pkg.sh index 64afe6c13f..aa28b43992 100755 --- a/conda/faiss-gpu/build-pkg.sh +++ b/conda/faiss-gpu/build-pkg.sh @@ -13,7 +13,7 @@ cmake -B _build_python_${PY_VER} \ -DFAISS_OPT_LEVEL=avx512 \ -DFAISS_ENABLE_GPU=ON \ -DFAISS_ENABLE_CUVS=OFF \ - -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_BUILD_TYPE=Debug \ -DPython_EXECUTABLE=$PYTHON \ faiss/python diff --git a/conda/faiss-gpu/meta.yaml b/conda/faiss-gpu/meta.yaml index 651d42fefa..ecb4ad50dd 100644 --- a/conda/faiss-gpu/meta.yaml +++ b/conda/faiss-gpu/meta.yaml @@ -50,14 +50,16 @@ outputs: - sysroot_linux-64 =2.17 # [linux64] - llvm-openmp # [osx] - cmake >=3.24.0 - - make =4.2 # [not win] - - mkl-devel =2023 # [x86_64] + - make =4.2 # [not win and not (osx and arm64)] + - make =4.4 # [osx and arm64] + - mkl-devel =2023.0 # [x86_64] - cuda-toolkit {{ cudatoolkit }} + - gcc_linux-64 =11.2 # [cudatoolkit == '11.4.4'] host: - - mkl =2023 # [x86_64] + - mkl =2023.0 # [x86_64] - openblas =0.3 # [not x86_64] run: - - mkl =2023 # [x86_64] + - mkl =2023.0 # [x86_64] - openblas =0.3 # [not x86_64] - cuda-cudart {{ cuda_constraints }} - libcublas {{ libcublas_constraints }} @@ -83,11 +85,14 @@ outputs: - sysroot_linux-64 =2.17 # [linux64] - swig =4.0 - cmake >=3.24.0 - - make =4.2 # [not win] + - make =4.2 # [not win and not (osx and arm64)] + - make =4.4 # [osx and arm64] + - _openmp_mutex =4.5=2_kmp_llvm # [x86_64 and not win] - cuda-toolkit {{ cudatoolkit }} host: - python {{ python }} - numpy >=1.19,<2 + - _openmp_mutex =4.5=2_kmp_llvm # [x86_64 and not win] - {{ pin_subpackage('libfaiss', exact=True) }} run: - python {{ python }} @@ -101,11 +106,8 @@ outputs: - pytorch <2.5 - pytorch-cuda {{ cuda_constraints }} 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_*" + - python -X faulthandler -m unittest discover -v -s faiss/gpu/test/ -p "test_gpu_basics*" - sh test_cpu_dispatch.sh # [linux64] files: - test_cpu_dispatch.sh # [linux64] diff --git a/conda/faiss/build-lib.sh b/conda/faiss/build-lib.sh index 8c986d5e68..146ffbb155 100755 --- a/conda/faiss/build-lib.sh +++ b/conda/faiss/build-lib.sh @@ -16,7 +16,7 @@ cmake -B _build \ -DFAISS_ENABLE_PYTHON=OFF \ -DBLA_VENDOR=Intel10_64lp \ -DCMAKE_INSTALL_LIBDIR=lib \ - -DCMAKE_BUILD_TYPE=Release . + -DCMAKE_BUILD_TYPE=Debug . make -C _build -j$(nproc) faiss faiss_avx2 faiss_avx512 diff --git a/conda/faiss/build-pkg.sh b/conda/faiss/build-pkg.sh index a0e3b12042..8664f510a5 100755 --- a/conda/faiss/build-pkg.sh +++ b/conda/faiss/build-pkg.sh @@ -12,7 +12,7 @@ cmake -B _build_python_${PY_VER} \ -Dfaiss_ROOT=_libfaiss_stage/ \ -DFAISS_OPT_LEVEL=avx512 \ -DFAISS_ENABLE_GPU=OFF \ - -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_BUILD_TYPE=Debug \ -DPython_EXECUTABLE=$PYTHON \ faiss/python diff --git a/conda/faiss/meta.yaml b/conda/faiss/meta.yaml index fe7612c23b..e9516e96bf 100644 --- a/conda/faiss/meta.yaml +++ b/conda/faiss/meta.yaml @@ -6,10 +6,12 @@ {% set version = environ.get('GIT_DESCRIBE_TAG').lstrip('v') %} {% set suffix = "_nightly" if environ.get('PACKAGE_TYPE') == 'nightly' else "" %} {% set number = GIT_DESCRIBE_NUMBER %} +{% set pyver = PY_VER %} package: name: faiss-pkg version: {{ version }} + mypyver: {{ pyver }} build: number: {{ number }} @@ -31,22 +33,29 @@ outputs: script: build-lib-arm64.sh # [not x86_64] script: build-lib.bat # [win] build: - string: "h{{ PKG_HASH }}_{{ number }}_cpu{{ suffix }}" + string: "py{{ PY_VER }}_h{{ PKG_HASH }}_{{ number }}_cpu{{ suffix }}" run_exports: - {{ pin_compatible('libfaiss', exact=True) }} requirements: build: + - python {{ python }} - {{ compiler('cxx') }} - sysroot_linux-64 =2.17 # [linux64] - - llvm-openmp # [osx] + - llvm-openmp # [osx or linux64] - cmake >=3.24.0 - - make =4.2 # [not win] - - mkl-devel =2023 # [x86_64] + - make =4.2 # [not win and not (osx and arm64)] + - make =4.4 # [osx and arm64] + - mkl-devel =2023.0 # [x86_64] + - liblief =0.12.3 # [not win] host: - - mkl =2023 # [x86_64] + - python {{ python }} + - mkl =2023.0 # [x86_64] + - liblief =0.12.3 # [not win] - openblas =0.3 # [not x86_64] run: - - mkl =2023 # [x86_64] + - python {{ python }} + - mkl =2023.0 # [x86_64] + - liblief =0.12.3 # [not win] - openblas =0.3 # [not x86_64] test: requires: @@ -66,25 +75,33 @@ outputs: string: "py{{ PY_VER }}_h{{ PKG_HASH }}_{{ number }}_cpu{{ suffix }}" requirements: build: + - python {{ python }} - {{ compiler('cxx') }} - sysroot_linux-64 =2.17 # [linux64] - swig =4.0 - cmake >=3.24.0 - - make =4.2 # [not win] + - make =4.2 # [not win and not (osx and arm64)] + - make =4.4 # [osx and arm64] + - _openmp_mutex =4.5=2_kmp_llvm # [x86_64 and not win] + - mkl =2023.0 # [x86_64] host: - python {{ python }} - numpy >=1.19,<2 - {{ pin_subpackage('libfaiss', exact=True) }} + - _openmp_mutex =4.5=2_kmp_llvm # [x86_64 and not win] + - mkl =2023.0 # [x86_64] run: - python {{ python }} - numpy >=1.19,<2 - packaging - {{ pin_subpackage('libfaiss', exact=True) }} + - mkl =2023.0 # [x86_64] test: requires: - numpy >=1.19,<2 - scipy - pytorch <2.5 + - mkl =2023.0 # [x86_64] commands: - python -X faulthandler -m unittest discover -v -s tests/ -p "test_*" - python -X faulthandler -m unittest discover -v -s tests/ -p "torch_*" diff --git a/faiss/gpu/GpuCloner.cpp b/faiss/gpu/GpuCloner.cpp index 575ee2e0a5..21b30df6db 100644 --- a/faiss/gpu/GpuCloner.cpp +++ b/faiss/gpu/GpuCloner.cpp @@ -514,6 +514,7 @@ GpuProgressiveDimIndexFactory::~GpuProgressiveDimIndexFactory() { Index* GpuProgressiveDimIndexFactory::operator()(int dim) { IndexFlatL2 index(dim); ncall++; + printf("Incremented ncall: %d\n", ncall); return index_cpu_to_gpu_multiple(vres, devices, &index, &options); } diff --git a/faiss/gpu/test/test_gpu_basics.py b/faiss/gpu/test/test_gpu_basics.py index 00506bf1f1..c9c2e15565 100755 --- a/faiss/gpu/test/test_gpu_basics.py +++ b/faiss/gpu/test/test_gpu_basics.py @@ -442,12 +442,18 @@ def test_with_gpu(self): rq1 = faiss.ResidualQuantizer(d, 4, 6) fac = faiss.GpuProgressiveDimIndexFactory(1) rq1.assign_index_factory = fac + # fac.this.acquire() # try to repro rq1.train(xt) + print(f"fac.ncall (1) ={fac.ncall}") self.assertGreater(fac.ncall, 0) + print(f"fac.ncall (2) ={fac.ncall}") ncall_train = fac.ncall + print(f"fac.ncall (3) ={fac.ncall} *** ncall_train={ncall_train}") err_rq1 = eval_codec(rq1, xb) + print(f"fac.ncall (4) ={fac.ncall} *** ncall_train={ncall_train}") # codes1 = rq1.compute_codes(xb) self.assertGreater(fac.ncall, ncall_train) + print(f"fac.ncall (5) ={fac.ncall} *** ncall_train={ncall_train}") print(err_rq0, err_rq1)