Skip to content

Commit 34bbe5e

Browse files
mengdilinfacebook-github-bot
authored andcommitted
Add ARM64 build to build_cmake actions for SVE (facebookresearch#3653)
Summary: Add instructions to download arm64 specific conda dependencies and cmake command and run it on CI. This should prepare us to turn on CI with SVE optimization Pull Request resolved: facebookresearch#3653 Reviewed By: ramilbakhshyiev Differential Revision: D60043435 Pulled By: mengdilin fbshipit-source-id: d81bb1c1022681c3da8f98bbf080d5e1d65d6b80
1 parent 4cfa638 commit 34bbe5e

File tree

2 files changed

+57
-16
lines changed

2 files changed

+57
-16
lines changed

.github/actions/build_cmake/action.yml

+44-16
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,20 @@ runs:
2828
conda update -y -q conda
2929
echo "$CONDA/bin" >> $GITHUB_PATH
3030
31-
# install base packages
32-
conda install -y -q -c conda-forge gxx_linux-64=11.2 sysroot_linux-64=2.28
33-
conda install -y -q python=3.11 cmake make swig mkl=2023 mkl-devel=2023 numpy scipy pytest
31+
conda install -y -q python=3.11 cmake make swig numpy scipy pytest
32+
33+
# install base packages for ARM64
34+
if [ "${{ runner.arch }}" = "ARM64" ]; then
35+
conda install -y -q -c conda-forge openblas gxx_linux-aarch64 sysroot_linux-aarch64
36+
fi
37+
38+
# install base packages for X86_64
39+
if [ "${{ runner.arch }}" = "X64" ]; then
40+
# TODO: unpin versions for gxx_linux-64 and sysroot_linux-64 and merge it with ARM64 below
41+
conda install -y -q -c conda-forge gxx_linux-64=11.2 sysroot_linux-64=2.28
42+
conda install -y -q mkl=2023 mkl-devel=2023
43+
fi
44+
3445
3546
# install CUDA packages
3647
if [ "${{ inputs.gpu }}" = "ON" ] && [ "${{ inputs.raft }}" = "OFF" ]; then
@@ -54,18 +65,35 @@ runs:
5465
run: |
5566
eval "$(conda shell.bash hook)"
5667
conda activate
57-
cmake -B build \
58-
-DBUILD_TESTING=ON \
59-
-DBUILD_SHARED_LIBS=ON \
60-
-DFAISS_ENABLE_GPU=${{ inputs.gpu }} \
61-
-DFAISS_ENABLE_RAFT=${{ inputs.raft }} \
62-
-DFAISS_OPT_LEVEL=${{ inputs.opt_level }} \
63-
-DFAISS_ENABLE_C_API=ON \
64-
-DPYTHON_EXECUTABLE=$CONDA/bin/python \
65-
-DCMAKE_BUILD_TYPE=Release \
66-
-DBLA_VENDOR=Intel10_64_dyn \
67-
-DCMAKE_CUDA_FLAGS="-gencode arch=compute_75,code=sm_75" \
68-
.
68+
69+
if [ "${{ runner.arch }}" = "X64" ]; then
70+
cmake -B build \
71+
-DBUILD_TESTING=ON \
72+
-DBUILD_SHARED_LIBS=ON \
73+
-DFAISS_ENABLE_GPU=${{ inputs.gpu }} \
74+
-DFAISS_ENABLE_RAFT=${{ inputs.raft }} \
75+
-DFAISS_OPT_LEVEL=${{ inputs.opt_level }} \
76+
-DFAISS_ENABLE_C_API=ON \
77+
-DPYTHON_EXECUTABLE=$CONDA/bin/python \
78+
-DCMAKE_BUILD_TYPE=Release \
79+
-DBLA_VENDOR=Intel10_64_dyn \
80+
-DCMAKE_CUDA_FLAGS="-gencode arch=compute_75,code=sm_75" \
81+
.
82+
elif [ "${{ runner.arch }}" = "ARM64" ]; then
83+
cmake -B build \
84+
-DBUILD_TESTING=ON \
85+
-DBUILD_SHARED_LIBS=ON \
86+
-DFAISS_ENABLE_GPU=${{ inputs.gpu }} \
87+
-DFAISS_ENABLE_RAFT=${{ inputs.raft }} \
88+
-DFAISS_OPT_LEVEL=${{ inputs.opt_level }} \
89+
-DFAISS_ENABLE_C_API=ON \
90+
-DPYTHON_EXECUTABLE=$CONDA/bin/python \
91+
-DCMAKE_BUILD_TYPE=Release \
92+
.
93+
else
94+
echo "Encountered unexpected platform ${{ runner.arch }}"
95+
exit 1
96+
fi
6997
make -k -C build -j$(nproc)
7098
- name: C++ tests
7199
shell: bash
@@ -101,5 +129,5 @@ runs:
101129
- name: Upload test results
102130
uses: actions/upload-artifact@v4
103131
with:
104-
name: test-results-${{ inputs.opt_level }}-${{ inputs.gpu }}-${{ inputs.raft }}
132+
name: test-results-${{ runner.arch }}-${{ inputs.opt_level }}-${{ inputs.gpu }}-${{ inputs.raft }}
105133
path: test-results

.github/workflows/build.yml

+13
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,19 @@ jobs:
8888
with:
8989
gpu: ON
9090
raft: ON
91+
linux-arm64-SVE-cmake:
92+
name: Linux arm64 SVE (cmake)
93+
runs-on: faiss-aws-r8g.large
94+
continue-on-error: true # non-blocking mode for now
95+
steps:
96+
- name: Checkout
97+
continue-on-error: true # non-blocking mode for now
98+
uses: actions/checkout@v4
99+
- uses: ./.github/actions/build_cmake
100+
continue-on-error: true # non-blocking mode for now
101+
# TODO(T197096427): uncomment this once SVE PR is merged
102+
# with:
103+
# opt_level: sve
91104
linux-x86_64-conda:
92105
name: Linux x86_64 (conda)
93106
needs: linux-x86_64-cmake

0 commit comments

Comments
 (0)