Skip to content

Commit 035cbbe

Browse files
committed
add runner android build ci
1 parent 2449326 commit 035cbbe

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

.ci/scripts/build_llama_android.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
set -ex
9+
10+
install_executorch_and_backend_lib() {
11+
echo "Installing libexecutorch.a, libportable_kernels.a, libetdump.a, libbundled_program.a"
12+
rm -rf cmake-android-out && mkdir cmake-android-out
13+
ANDROID_NDK=/opt/ndk
14+
BUCK2=$(which buck2)
15+
FLATC=$(which flatc) ANDROID_ABI=arm64-v8a
16+
cmake -DBUCK2="$BUCK" -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK"/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-23 -DCMAKE_INSTALL_PREFIX=cmake-android-out -DCMAKE_BUILD_TYPE=Release -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON -DEXECUTORCH_ENABLE_LOGGING=1 -DEXECUTORCH_BUILD_XNNPACK=ON -DPYTHON_EXECUTABLE=python -DEXECUTORCH_BUILD_OPTIMIZED=ON -DXNNPACK_ENABLE_ARM_BF16=OFF -Bcmake-android-out .
17+
18+
cmake --build cmake-android-out -j16 --target install --config Release
19+
}
20+
21+
build_llama_runner() {
22+
echo "Exporting MobilenetV2"
23+
cmake -DBUCK2=/home/chenlai/bin/buck2 -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK"/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-23 -DCMAKE_INSTALL_PREFIX=cmake-android-out -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=python -DEXECUTORCH_BUILD_OPTIMIZED=ON -Bcmake-android-out/examples/models/llama2 examples/models/llama2
24+
cmake --build cmake-android-out/examples/models/llama2 -j16 --config Release
25+
}
26+
27+
install_executorch_and_backend_lib
28+
build_llama_runner

.github/workflows/pull.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,18 @@ jobs:
114114
# Test llama2
115115
PYTHON_EXECUTABLE=python bash .ci/scripts/test_llama.sh stories110M.pt "${BUILD_TOOL}" "${DTYPE}" "${MODE}"
116116
117+
test-llama-runner-linux-android:
118+
name: test-llama-runner-linux-android
119+
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
120+
with:
121+
runner: linux.2xlarge
122+
docker-image: executorch-ubuntu-22.04-clang12-android
123+
submodules: 'true'
124+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
125+
timeout: 90
126+
script: |
127+
bash .ci/scripts/build_llama_android.sh
128+
117129
test-custom-ops-linux:
118130
name: test-custom-ops-linux
119131
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main

0 commit comments

Comments
 (0)