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 change: 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.
- mkl 2023.1 change: pulling in 2023.2 causes problems and all current builds pull in 2023.1. So it is specified as 2023.1. The meta.yaml changes are the ones that narrow it to 2023.1 during `conda build faiss`.

Differential Revision: D68043874
  • Loading branch information
Michael Norris authored and facebook-github-bot committed Jan 16, 2025
1 parent 4c315a9 commit b4fedbb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 13 deletions.
21 changes: 17 additions & 4 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=2023.1.0 mkl-devel=2023.1.0
fi
# no CUDA needed for ROCm so skip this
Expand All @@ -56,14 +63,15 @@ 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
# ROCm-enabled version until it's supported in conda by PyTorch
elif [ "${{ inputs.gpu }}" = "ON" ]; then
conda install -y -q "pytorch<2.5" pytorch-cuda=12.4 -c pytorch -c "nvidia/label/cuda-12.4.0"
conda install -y -q "pytorch=2.5.1=py3.11_cuda12.4_cudnn9.1.0_0" pytorch-cuda=12.4 -c pytorch -c "nvidia/label/cuda-12.4.1"
else
conda install -y -q "pytorch<2.5" -c pytorch
conda install -y -q "pytorch=2.5.1=py3.11_cuda12.4_cudnn9.1.0_0" -c pytorch
fi
- name: ROCm - Install dependencies
if: inputs.rocm == 'ON'
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' && '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
- 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: bash
run: |
# Shows that all installed packages are from conda-forge.
conda list --show-channel-urls
5 changes: 1 addition & 4 deletions conda/faiss/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,12 @@ outputs:
build:
- {{ 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]
host:
- mkl =2023 # [x86_64]
- openblas =0.3 # [not x86_64]
run:
- mkl =2023 # [x86_64]
- openblas =0.3 # [not x86_64]
test:
requires:
Expand Down

0 comments on commit b4fedbb

Please sign in to comment.