From 6b1ca997e9b735abbee5ec38ce307563ead4bfa0 Mon Sep 17 00:00:00 2001 From: mengdilin Date: Fri, 19 Jul 2024 23:27:44 +0000 Subject: [PATCH 1/9] Add ARM64 build to build_cmake --- .github/actions/build_cmake/action.yml | 49 +++++++++++++++++--------- .github/workflows/build.yml | 13 +++++++ 2 files changed, 46 insertions(+), 16 deletions(-) diff --git a/.github/actions/build_cmake/action.yml b/.github/actions/build_cmake/action.yml index 2bc476add5..0838e8ff9e 100644 --- a/.github/actions/build_cmake/action.yml +++ b/.github/actions/build_cmake/action.yml @@ -28,9 +28,20 @@ runs: conda update -y -q conda echo "$CONDA/bin" >> $GITHUB_PATH - # install base packages - conda install -y -q -c conda-forge gxx_linux-64=11.2 sysroot_linux-64=2.28 - conda install -y -q python=3.11 cmake make swig mkl=2023 mkl-devel=2023 numpy scipy pytest + conda install -y -q python=3.11 cmake make swig numpy scipy pytest + + # install base packages for ARM64 + if [ "${{ runner.arch }}" = "ARM64" ]; then + conda install -y -q -c conda-forge openblas gxx_linux-aarch64 sysroot_linux-aarch64 + fi + + # install base packages for X86_64 + if [ "${{ runner.arch }}" = "X64" ]; then + # TODO: unpin versions for gxx_linux-64 and sysroot_linux-64 and merge it with ARM64 below + conda install -y -q -c conda-forge gxx_linux-64=11.2 sysroot_linux-64=2.28 + conda install -y -q mkl=2023 mkl-devel=2023 + fi + # install CUDA packages if [ "${{ inputs.gpu }}" = "ON" ] && [ "${{ inputs.raft }}" = "OFF" ]; then @@ -53,19 +64,25 @@ runs: shell: bash run: | eval "$(conda shell.bash hook)" + + args=( + -DBUILD_TESTING=ON + -DBUILD_SHARED_LIBS=ON + -DFAISS_ENABLE_GPU=${{ inputs.gpu }} + -DFAISS_ENABLE_RAFT=${{ inputs.raft }} + -DFAISS_OPT_LEVEL=${{ inputs.opt_level }} + -DFAISS_ENABLE_C_API=ON + -DPYTHON_EXECUTABLE=$CONDA/bin/python + -DCMAKE_BUILD_TYPE=Release + ) + if [ "${{ runner.arch }}" = "X64" ]; then + args+=( + -DBLA_VENDOR=Intel10_64_dyn + -DCMAKE_CUDA_FLAGS=\"-gencode arch=compute_75,code=sm_75\" + ) + fi conda activate - cmake -B build \ - -DBUILD_TESTING=ON \ - -DBUILD_SHARED_LIBS=ON \ - -DFAISS_ENABLE_GPU=${{ inputs.gpu }} \ - -DFAISS_ENABLE_RAFT=${{ inputs.raft }} \ - -DFAISS_OPT_LEVEL=${{ inputs.opt_level }} \ - -DFAISS_ENABLE_C_API=ON \ - -DPYTHON_EXECUTABLE=$CONDA/bin/python \ - -DCMAKE_BUILD_TYPE=Release \ - -DBLA_VENDOR=Intel10_64_dyn \ - -DCMAKE_CUDA_FLAGS="-gencode arch=compute_75,code=sm_75" \ - . + cmake -B build "${args[@]}" . make -k -C build -j$(nproc) - name: C++ tests shell: bash @@ -101,5 +118,5 @@ runs: - name: Upload test results uses: actions/upload-artifact@v4 with: - name: test-results-${{ inputs.opt_level }}-${{ inputs.gpu }}-${{ inputs.raft }} + name: test-results-${{ runner.arch }}-${{ inputs.opt_level }}-${{ inputs.gpu }}-${{ inputs.raft }} path: test-results diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ed3f371bb0..303d784511 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -88,6 +88,19 @@ jobs: with: gpu: ON raft: ON + linux-arm64-SVE-cmake: + name: Linux arm64 SVE (cmake) + runs-on: faiss-aws-r8g.large + continue-on-error: true # non-blocking mode for now + steps: + - name: Checkout + continue-on-error: true # non-blocking mode for now + uses: actions/checkout@v4 + - uses: ./.github/actions/build_cmake + continue-on-error: true # non-blocking mode for now + # TODO: uncomment this once SVE PR is merged + # with: + # opt_level: sve linux-x86_64-conda: name: Linux x86_64 (conda) needs: linux-x86_64-cmake From f557980f00c7c167e7d7a0794d264eea20285a6f Mon Sep 17 00:00:00 2001 From: mengdilin Date: Sat, 20 Jul 2024 01:18:37 +0000 Subject: [PATCH 2/9] bash quote expansion --- .github/actions/build_cmake/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build_cmake/action.yml b/.github/actions/build_cmake/action.yml index 0838e8ff9e..fcc3712bea 100644 --- a/.github/actions/build_cmake/action.yml +++ b/.github/actions/build_cmake/action.yml @@ -82,7 +82,7 @@ runs: ) fi conda activate - cmake -B build "${args[@]}" . + cmake -B build "${args[*]}" . make -k -C build -j$(nproc) - name: C++ tests shell: bash From 4710d8fc7f0f4b7ce7a1f424019dfd472bfbd9e2 Mon Sep 17 00:00:00 2001 From: mengdilin Date: Sat, 20 Jul 2024 01:19:47 +0000 Subject: [PATCH 3/9] faster test --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 303d784511..0f3e422baa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,7 +69,7 @@ jobs: continue-on-error: true # non-blocking mode for now linux-x86_64-GPU-cmake: name: Linux x86_64 GPU (cmake) - needs: linux-x86_64-cmake + # needs: linux-x86_64-cmake runs-on: 4-core-ubuntu-gpu-t4 steps: - name: Checkout @@ -79,7 +79,7 @@ jobs: gpu: ON linux-x86_64-GPU-w-RAFT-cmake: name: Linux x86_64 GPU w/ RAFT (cmake) - needs: linux-x86_64-cmake + # needs: linux-x86_64-cmake runs-on: 4-core-ubuntu-gpu-t4 steps: - name: Checkout From 2a179e72691cd90665defda319a391a8eedcfc5e Mon Sep 17 00:00:00 2001 From: mengdilin Date: Sat, 20 Jul 2024 01:22:44 +0000 Subject: [PATCH 4/9] test 2 --- .github/actions/build_cmake/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build_cmake/action.yml b/.github/actions/build_cmake/action.yml index fcc3712bea..032780bde3 100644 --- a/.github/actions/build_cmake/action.yml +++ b/.github/actions/build_cmake/action.yml @@ -78,7 +78,7 @@ runs: if [ "${{ runner.arch }}" = "X64" ]; then args+=( -DBLA_VENDOR=Intel10_64_dyn - -DCMAKE_CUDA_FLAGS=\"-gencode arch=compute_75,code=sm_75\" + -DCMAKE_CUDA_FLAGS="-gencode arch=compute_75,code=sm_75" ) fi conda activate From fd4776547887e6a33289792f42fa4bc21382a93c Mon Sep 17 00:00:00 2001 From: mengdilin Date: Sat, 20 Jul 2024 01:24:36 +0000 Subject: [PATCH 5/9] revert to use @ --- .github/actions/build_cmake/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/build_cmake/action.yml b/.github/actions/build_cmake/action.yml index 032780bde3..0838e8ff9e 100644 --- a/.github/actions/build_cmake/action.yml +++ b/.github/actions/build_cmake/action.yml @@ -78,11 +78,11 @@ runs: if [ "${{ runner.arch }}" = "X64" ]; then args+=( -DBLA_VENDOR=Intel10_64_dyn - -DCMAKE_CUDA_FLAGS="-gencode arch=compute_75,code=sm_75" + -DCMAKE_CUDA_FLAGS=\"-gencode arch=compute_75,code=sm_75\" ) fi conda activate - cmake -B build "${args[*]}" . + cmake -B build "${args[@]}" . make -k -C build -j$(nproc) - name: C++ tests shell: bash From 409377a9cb48e81bfc9452259feac85d33f90fea Mon Sep 17 00:00:00 2001 From: mengdilin Date: Sat, 20 Jul 2024 01:26:38 +0000 Subject: [PATCH 6/9] no expansion --- .github/actions/build_cmake/action.yml | 39 +++++++++++++++----------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/.github/actions/build_cmake/action.yml b/.github/actions/build_cmake/action.yml index 0838e8ff9e..358f7ee631 100644 --- a/.github/actions/build_cmake/action.yml +++ b/.github/actions/build_cmake/action.yml @@ -64,25 +64,32 @@ runs: shell: bash run: | eval "$(conda shell.bash hook)" + conda activate - args=( - -DBUILD_TESTING=ON - -DBUILD_SHARED_LIBS=ON - -DFAISS_ENABLE_GPU=${{ inputs.gpu }} - -DFAISS_ENABLE_RAFT=${{ inputs.raft }} - -DFAISS_OPT_LEVEL=${{ inputs.opt_level }} - -DFAISS_ENABLE_C_API=ON - -DPYTHON_EXECUTABLE=$CONDA/bin/python - -DCMAKE_BUILD_TYPE=Release - ) if [ "${{ runner.arch }}" = "X64" ]; then - args+=( - -DBLA_VENDOR=Intel10_64_dyn - -DCMAKE_CUDA_FLAGS=\"-gencode arch=compute_75,code=sm_75\" - ) + cmake -B build -DBUILD_TESTING=ON \ + -DBUILD_SHARED_LIBS=ON \ + -DFAISS_ENABLE_GPU=${{ inputs.gpu }} \ + -DFAISS_ENABLE_RAFT=${{ inputs.raft }} \ + -DFAISS_OPT_LEVEL=${{ inputs.opt_level }} \ + -DFAISS_ENABLE_C_API=ON \ + -DPYTHON_EXECUTABLE=$CONDA/bin/python \ + -DCMAKE_BUILD_TYPE=Release \ + -DBLA_VENDOR=Intel10_64_dyn \ + -DCMAKE_CUDA_FLAGS="-gencode arch=compute_75,code=sm_75" \ + . + fi + if [ "${{ runner.arch }}" = "ARM64" ]; then + cmake -B build -DBUILD_TESTING=ON \ + -DBUILD_SHARED_LIBS=ON \ + -DFAISS_ENABLE_GPU=${{ inputs.gpu }} \ + -DFAISS_ENABLE_RAFT=${{ inputs.raft }} \ + -DFAISS_OPT_LEVEL=${{ inputs.opt_level }} \ + -DFAISS_ENABLE_C_API=ON \ + -DPYTHON_EXECUTABLE=$CONDA/bin/python \ + -DCMAKE_BUILD_TYPE=Release \ + . fi - conda activate - cmake -B build "${args[@]}" . make -k -C build -j$(nproc) - name: C++ tests shell: bash From d4dff06dc4bcc463d29a7d1eb1aa1c35e78c322e Mon Sep 17 00:00:00 2001 From: mengdilin Date: Mon, 22 Jul 2024 15:02:59 +0000 Subject: [PATCH 7/9] revert test changes --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0f3e422baa..303d784511 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,7 +69,7 @@ jobs: continue-on-error: true # non-blocking mode for now linux-x86_64-GPU-cmake: name: Linux x86_64 GPU (cmake) - # needs: linux-x86_64-cmake + needs: linux-x86_64-cmake runs-on: 4-core-ubuntu-gpu-t4 steps: - name: Checkout @@ -79,7 +79,7 @@ jobs: gpu: ON linux-x86_64-GPU-w-RAFT-cmake: name: Linux x86_64 GPU w/ RAFT (cmake) - # needs: linux-x86_64-cmake + needs: linux-x86_64-cmake runs-on: 4-core-ubuntu-gpu-t4 steps: - name: Checkout From 64f901e698b3baea2ba4563ef16e1363cb6b6085 Mon Sep 17 00:00:00 2001 From: mengdilin Date: Fri, 26 Jul 2024 19:34:45 +0000 Subject: [PATCH 8/9] fix formatting and use if elif else --- .github/actions/build_cmake/action.yml | 50 ++++++++++++++------------ 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/.github/actions/build_cmake/action.yml b/.github/actions/build_cmake/action.yml index 358f7ee631..873daacc1e 100644 --- a/.github/actions/build_cmake/action.yml +++ b/.github/actions/build_cmake/action.yml @@ -39,7 +39,7 @@ runs: if [ "${{ runner.arch }}" = "X64" ]; then # TODO: unpin versions for gxx_linux-64 and sysroot_linux-64 and merge it with ARM64 below conda install -y -q -c conda-forge gxx_linux-64=11.2 sysroot_linux-64=2.28 - conda install -y -q mkl=2023 mkl-devel=2023 + conda install -y -q mkl=2023 mkl-devel=2023 fi @@ -67,28 +67,32 @@ runs: conda activate if [ "${{ runner.arch }}" = "X64" ]; then - cmake -B build -DBUILD_TESTING=ON \ - -DBUILD_SHARED_LIBS=ON \ - -DFAISS_ENABLE_GPU=${{ inputs.gpu }} \ - -DFAISS_ENABLE_RAFT=${{ inputs.raft }} \ - -DFAISS_OPT_LEVEL=${{ inputs.opt_level }} \ - -DFAISS_ENABLE_C_API=ON \ - -DPYTHON_EXECUTABLE=$CONDA/bin/python \ - -DCMAKE_BUILD_TYPE=Release \ - -DBLA_VENDOR=Intel10_64_dyn \ - -DCMAKE_CUDA_FLAGS="-gencode arch=compute_75,code=sm_75" \ - . - fi - if [ "${{ runner.arch }}" = "ARM64" ]; then - cmake -B build -DBUILD_TESTING=ON \ - -DBUILD_SHARED_LIBS=ON \ - -DFAISS_ENABLE_GPU=${{ inputs.gpu }} \ - -DFAISS_ENABLE_RAFT=${{ inputs.raft }} \ - -DFAISS_OPT_LEVEL=${{ inputs.opt_level }} \ - -DFAISS_ENABLE_C_API=ON \ - -DPYTHON_EXECUTABLE=$CONDA/bin/python \ - -DCMAKE_BUILD_TYPE=Release \ - . + cmake -B build \ + -DBUILD_TESTING=ON \ + -DBUILD_SHARED_LIBS=ON \ + -DFAISS_ENABLE_GPU=${{ inputs.gpu }} \ + -DFAISS_ENABLE_RAFT=${{ inputs.raft }} \ + -DFAISS_OPT_LEVEL=${{ inputs.opt_level }} \ + -DFAISS_ENABLE_C_API=ON \ + -DPYTHON_EXECUTABLE=$CONDA/bin/python \ + -DCMAKE_BUILD_TYPE=Release \ + -DBLA_VENDOR=Intel10_64_dyn \ + -DCMAKE_CUDA_FLAGS="-gencode arch=compute_75,code=sm_75" \ + . + elif [ "${{ runner.arch }}" = "ARM64" ]; then + cmake -B build \ + -DBUILD_TESTING=ON \ + -DBUILD_SHARED_LIBS=ON \ + -DFAISS_ENABLE_GPU=${{ inputs.gpu }} \ + -DFAISS_ENABLE_RAFT=${{ inputs.raft }} \ + -DFAISS_OPT_LEVEL=${{ inputs.opt_level }} \ + -DFAISS_ENABLE_C_API=ON \ + -DPYTHON_EXECUTABLE=$CONDA/bin/python \ + -DCMAKE_BUILD_TYPE=Release \ + . + else + echo "Encountered unexpected platform ${{ runner.arch }}" + exit 1 fi make -k -C build -j$(nproc) - name: C++ tests From 68ae1e84ad9596d95b08d51de0e0ebc88ea09c3f Mon Sep 17 00:00:00 2001 From: mengdilin Date: Fri, 26 Jul 2024 19:36:11 +0000 Subject: [PATCH 9/9] add task --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 303d784511..c0eca51393 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -98,7 +98,7 @@ jobs: uses: actions/checkout@v4 - uses: ./.github/actions/build_cmake continue-on-error: true # non-blocking mode for now - # TODO: uncomment this once SVE PR is merged + # TODO(T197096427): uncomment this once SVE PR is merged # with: # opt_level: sve linux-x86_64-conda: