Skip to content

Commit 9af6321

Browse files
ramilbakhshyievfacebook-github-bot
authored andcommittedJun 13, 2024
Consolidate build environment configuration steps in cmake builds
Summary: This diff seeks to simplify the steps that install conda packages and environment configuration into a single step at the start of the cmake build action. Differential Revision: D58560454
1 parent 34feae4 commit 9af6321

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed
 

‎.github/actions/build_cmake/action.yml

+23-21
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,35 @@ runs:
2020
with:
2121
python-version: '3.11'
2222
miniconda-version: latest
23-
- name: Initialize Conda environment
23+
- name: Configure build environment
2424
shell: bash
2525
run: |
26+
# initialize Conda
2627
conda config --set solver libmamba
2728
conda update -y -q conda
28-
- name: Configure Conda environment
29-
shell: bash
30-
run: |
29+
echo "$CONDA/bin" >> $GITHUB_PATH
30+
31+
# install base packages
3132
conda install -y -q -c conda-forge gxx_linux-64=11.2 sysroot_linux-64=2.28
3233
conda install -y -q python=3.11 cmake make swig mkl=2023 mkl-devel=2023 numpy scipy pytest
33-
echo "$CONDA/bin" >> $GITHUB_PATH
34-
- name: Install CUDA
35-
if: inputs.gpu == 'ON' && inputs.raft == 'OFF'
36-
shell: bash
37-
run: |
38-
conda install -y -q cuda-toolkit -c "nvidia/label/cuda-11.8.0"
39-
- name: Install RAFT
40-
if: inputs.raft == 'ON'
41-
shell: bash
42-
run: |
43-
conda install -y -q libraft cuda-version=11.8 cuda-toolkit -c rapidsai-nightly -c "nvidia/label/cuda-11.8.0" -c conda-forge
34+
35+
# install CUDA packages
36+
if [ "${{ inputs.gpu }}" = "ON" ] && [ "${{ inputs.raft }}" = "OFF" ]; then
37+
conda install -y -q cuda-toolkit -c "nvidia/label/cuda-11.8.0"
38+
fi
39+
40+
# install RAFT packages
41+
if [ "$${{ inputs.raft }}" = "ON" ]; then
42+
conda install -y -q libraft cuda-version=11.8 cuda-toolkit -c rapidsai-nightly -c "nvidia/label/cuda-11.8.0" -c conda-forge
43+
fi
44+
45+
# install test packages
46+
conda install -y pytest
47+
if [ "${{ inputs.gpu }}" = "ON" ]; then
48+
conda install -y -q pytorch pytorch-cuda=11.8 -c pytorch -c nvidia/label/cuda-11.8.0
49+
else
50+
conda install -y -q pytorch -c pytorch
51+
fi
4452
- name: Build all targets
4553
shell: bash
4654
run: |
@@ -69,22 +77,16 @@ runs:
6977
working-directory: build/faiss/python
7078
run: |
7179
$CONDA/bin/python setup.py install
72-
- name: Install pytest
73-
shell: bash
74-
run: |
75-
conda install -y pytest
7680
- name: Python tests (CPU only)
7781
if: inputs.gpu == 'OFF'
7882
shell: bash
7983
run: |
80-
conda install -y -q pytorch -c pytorch
8184
pytest --junitxml=test-results/pytest/results.xml tests/test_*.py
8285
pytest --junitxml=test-results/pytest/results-torch.xml tests/torch_*.py
8386
- name: Python tests (CPU + GPU)
8487
if: inputs.gpu == 'ON'
8588
shell: bash
8689
run: |
87-
conda install -y -q pytorch pytorch-cuda=11.8 -c pytorch -c nvidia/label/cuda-11.8.0
8890
pytest --junitxml=test-results/pytest/results.xml tests/test_*.py
8991
pytest --junitxml=test-results/pytest/results-torch.xml tests/torch_*.py
9092
cp tests/common_faiss_tests.py faiss/gpu/test

0 commit comments

Comments
 (0)