Skip to content

[Android] Add more prebuilt artifacts #3245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,23 @@ jobs:
# Build Android demo app
bash build/test_android_ci.sh
# Strip libraries for uploda
strip cmake-out-android-arm64-v8a/lib/*.a cmake-out-android-arm64-v8a/extension/android/*.so
strip cmake-out-android-x86_64/lib/*.a cmake-out-android-x86_64/extension/android/*.so
mkdir -p artifacts-to-be-uploaded
mkdir -p artifacts-to-be-uploaded/arm64-v8a/
mkdir -p artifacts-to-be-uploaded/x86_64/
# Copy the jar to S3
cp extension/android/build/libs/executorch.jar artifacts-to-be-uploaded/
# Copy the app and its test suite to S3
cp examples/demo-apps/android/LlamaDemo/app/build/outputs/apk/debug/*.apk artifacts-to-be-uploaded/
cp examples/demo-apps/android/LlamaDemo/app/build/outputs/apk/androidTest/debug/*.apk artifacts-to-be-uploaded/
# Also copy the share libraries
cp cmake-out-android/lib/*.a artifacts-to-be-uploaded/
# Also copy the libraries
cp cmake-out-android-arm64-v8a/lib/*.a artifacts-to-be-uploaded/arm64-v8a/
cp cmake-out-android-arm64-v8a/extension/android/*.so artifacts-to-be-uploaded/arm64-v8a/
cp cmake-out-android-x86_64/lib/*.a artifacts-to-be-uploaded/x86_64/
cp cmake-out-android-x86_64/extension/android/*.so artifacts-to-be-uploaded/x86_64/
# Upload the app and its test suite to S3 so that they can be downloaded by the test job
upload-artifacts:
Expand Down
15 changes: 9 additions & 6 deletions build/test_android_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@
set -ex

# https://github.com/pytorch/executorch/tree/main/examples/demo-apps/android/ExecuTorchDemo
build_executorch() {
export_model() {
MODEL_NAME=dl3
# Delegating DeepLab v3 to XNNPACK backend
python -m examples.xnnpack.aot_compiler --model_name="${MODEL_NAME}" --delegate

ASSETS_DIR=examples/demo-apps/android/ExecuTorchDemo/app/src/main/assets/
mkdir -p "${ASSETS_DIR}"
cp "${MODEL_NAME}_xnnpack_fp32.pte" "${ASSETS_DIR}"
}

rm -rf cmake-out && mkdir cmake-out
ANDROID_NDK=/opt/ndk BUCK2=$(which buck2) FLATC=$(which flatc) ANDROID_ABI=arm64-v8a \
bash examples/demo-apps/android/ExecuTorchDemo/setup.sh
build_android_native_library() {
pushd examples/demo-apps/android/LlamaDemo
CMAKE_OUT="cmake-out-android-$1" ANDROID_NDK=/opt/ndk ANDROID_ABI="$1" ./gradlew setup
popd
}

build_android_demo_app() {
Expand All @@ -30,12 +32,13 @@ build_android_demo_app() {

build_android_llama_demo_app() {
pushd examples/demo-apps/android/LlamaDemo
ANDROID_NDK=/opt/ndk ANDROID_ABI=arm64-v8a ./gradlew setup
ANDROID_HOME=/opt/android/sdk ./gradlew build
ANDROID_HOME=/opt/android/sdk ./gradlew assembleAndroidTest
popd
}

build_executorch
build_android_native_library arm64-v8a
build_android_native_library x86_64
export_model
build_android_demo_app
build_android_llama_demo_app