Skip to content

Commit

Permalink
Migration off defaults to conda-forge channel (facebookresearch#4126)
Browse files Browse the repository at this point in the history
Summary:

Good resource on overriding channels to make sure we aren't using `defaults`:https://stackoverflow.com/questions/67695893/how-do-i-completely-purge-and-disable-the-default-channel-in-anaconda-and-switch

Explanation of changes:
-
- changed to miniforge from miniconda: this ensures we only pull in from conda-defaults when creating the environment
- architecture: ARM64 and aarch64 are the same thing. But there is no miniforge package for ARM64, so we need to make it check for aarch64 instead. However, mac breaks this rule, and does have macOS-arm64! So there is a conditional for mac to use arm64. https://github.com/conda-forge/miniforge/releases/
- mkl 2022.2.1 change: conda-forge and defaults have completely different dependencies. Defaults required intel-openmp, but now on conda-forge, mkl 2023.1 or higher requires llvm-openmp >=14.0.6, but this is incompatible with the pytorch build <2.5 which requires llvm-openmp<14.0. We would need to upgrade Python to 3.12 first, upgrade Pytorch build, then upgrade this mkl. (The meta.yaml changes are the ones that narrow it to 2022.2.1 during `conda build faiss`.) So, this has just been changed to 2022.2.1.
- mkl now requires _openmp_mutex of type "llvm" instead of "gnu": prior non-cuVS builds all used gnu, because intel-openmp from anaconda defaults channel does not require llvm-openmp. Now we need to remove the gnu one which is automatically pulled in during miniconda setup, and only keep the llvm version of _openmp_mutex.
- liblief: The above changes tried to pull in liblief 0.15. This results in an error like `AttributeError: module 'lief._lief.ELF' has no attribute 'ELF_CLASS'`. When I checked passing PR builds on defaults, they use lief 0.12, so I pinned that one.
- gcc_linux-64 =11.2 for faiss-gpu on cudatoolkit-11.2: this build kept trying to reference 11.2 when 14.2 was installed. Current builds still reference 11.2, so I gave up and pinned 11.2 to keep it the same. Moving to 14.2 will take some more investigation.
- conda_build_config.yaml: I removed Python 3.12 because the build fails with the below error. Python 3.12 also doesn't really work (facebookresearch#3936) I think? So I removed it.
```
INTEL MKL ERROR: $PREFIX/lib/python3.12/site-packages/faiss/../../.././libmkl_def.so.2: undefined symbol: mkl_sparse_optimize_bsr_trsm_i8.
Intel MKL FATAL ERROR: Cannot load libmkl_def.so.2.
```
- Note: test_mem_leak.cpp seems flaky. It sometimes fails, then passes with rerun.

Differential Revision: D68043874
  • Loading branch information
Michael Norris authored and facebook-github-bot committed Jan 21, 2025
1 parent 4c315a9 commit 10892f7
Show file tree
Hide file tree
Showing 8 changed files with 376 additions and 148 deletions.
17 changes: 15 additions & 2 deletions .github/actions/build_cmake/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,19 @@ runs:
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 aarch64 if we're on arm64 because there's no miniforge ARM64 package, just aarch64.
# They are the same thing, just named differently.
architecture: ${{ runner.arch == 'ARM64' && 'aarch64' || runner.arch }}
- name: Configure build environment
shell: bash
run: |
# initialize Conda
conda config --set solver libmamba
# Ensure starting packages are from conda-forge.
conda list --show-channel-urls
conda update -y -q conda
echo "$CONDA/bin" >> $GITHUB_PATH
Expand All @@ -43,7 +50,7 @@ runs:
if [ "${{ runner.arch }}" = "X64" ]; then
# TODO: merge this with ARM64
conda install -y -q -c conda-forge gxx_linux-64=14.2 sysroot_linux-64=2.17
conda install -y -q mkl=2023 mkl-devel=2023
conda install -y -q mkl=2022.2.1 mkl-devel=2022.2.1
fi
# no CUDA needed for ROCm so skip this
Expand All @@ -56,6 +63,7 @@ runs:
elif [ "${{ inputs.cuvs }}" = "ON" ]; then
conda install -y -q libcuvs=24.12 'cuda-version>=12.0,<=12.5' cuda-toolkit=12.4.1 gxx_linux-64=12.4 -c rapidsai -c conda-forge
fi
# install test packages
if [ "${{ inputs.rocm }}" = "ON" ]; then
: # skip torch install via conda, we need to install via pip to get
Expand Down Expand Up @@ -174,3 +182,8 @@ runs:
with:
name: test-results-arch=${{ runner.arch }}-opt=${{ inputs.opt_level }}-gpu=${{ inputs.gpu }}-cuvs=${{ inputs.cuvs }}-rocm=${{ inputs.rocm }}
path: test-results
- name: Check installed packages channel
shell: bash
run: |
# Shows that all installed packages are from conda-forge.
conda list --show-channel-urls
20 changes: 15 additions & 5 deletions .github/actions/build_conda/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,25 @@ 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 aarch64 if we're on arm64 because there's no miniforge ARM64 package, just aarch64.
# They are the same thing, just named differently.
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 }}
Expand Down Expand Up @@ -94,3 +99,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
Loading

0 comments on commit 10892f7

Please sign in to comment.