mirror of
https://github.com/browsermt/bergamot-translator.git
synced 2024-10-04 00:48:03 +03:00
6f2659fe59
* ARM Support using ruy and simd_utils
* Adding ARM build on GitHub CI
* Add workflow and successful build
ssplit-cpp modified to get cross compiled android on GitHub CI working.
* Client side fixes for int8 no shift on ARM [python]
* Revert "Client side fixes for int8 no shift on ARM [python]"
This reverts commit 020af05a8b
.
* moving int8shift no-op inside the library
* Bump 3rd-party/marian-dev
* update the marian branch test
* arm backend works
* Latest and greatest clang-format
Co-authored-by: Jerin Philip <jerinphilip@live.in>
140 lines
4.6 KiB
YAML
140 lines
4.6 KiB
YAML
name: ARM
|
|
'on':
|
|
push:
|
|
branches:
|
|
- main
|
|
- ci-sandbox
|
|
pull_request:
|
|
branches:
|
|
- '**'
|
|
env:
|
|
ccache_basedir: ${{ github.workspace }}
|
|
ccache_dir: "${{ github.workspace }}/.ccache"
|
|
ccache_compilercheck: content
|
|
ccache_compress: 'true'
|
|
ccache_compresslevel: 9
|
|
ccache_maxsize: 200M
|
|
ccache_cmake: -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache
|
|
ndk: "${{ github.workspace }}/android-ndk-r23b"
|
|
abi: "arm64-v8a"
|
|
minsdk_version : 28
|
|
android_platform: 28
|
|
|
|
jobs:
|
|
ubuntu:
|
|
name: "arm-v8a cross-compile via Android NDK"
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Install prerequisites
|
|
run: |
|
|
wget -c --quiet https://dl.google.com/android/repository/android-ndk-r23b-linux.zip
|
|
unzip -qq android-ndk-r23b-linux.zip
|
|
sudo apt-get -y install ccache cmake
|
|
|
|
- name: Generate ccache_vars for ccache based on machine
|
|
shell: bash
|
|
id: ccache_vars
|
|
run: |-
|
|
echo "::set-output name=hash::$(echo ${{ env.ccache_compilercheck }})"
|
|
echo "::set-output name=timestamp::$(date '+%Y-%m-%dT%H.%M.%S')"
|
|
|
|
- name: Cache-op for build-cache through ccache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ env.ccache_dir }}
|
|
key: ccache-${{ matrix.identifier }}-${{ steps.ccache_vars.outputs.hash }}-${{ github.ref }}-${{ steps.ccache_vars.outputs.timestamp }}
|
|
restore-keys: |-
|
|
ccache-${{ matrix.identifier }}-${{ steps.ccache_vars.outputs.hash }}-${{ github.ref }}
|
|
ccache-${{ matrix.identifier }}-${{ steps.ccache_vars.outputs.hash }}
|
|
ccache-${{ matrix.identifier }}
|
|
|
|
- name: ccache environment setup
|
|
run: |-
|
|
echo "CCACHE_COMPILER_CHECK=${{ env.ccache_compilercheck }}" >> $GITHUB_ENV
|
|
echo "CCACHE_BASEDIR=${{ env.ccache_basedir }}" >> $GITHUB_ENV
|
|
echo "CCACHE_COMPRESS=${{ env.ccache_compress }}" >> $GITHUB_ENV
|
|
echo "CCACHE_COMPRESSLEVEL=${{ env.ccache_compresslevel }}" >> $GITHUB_ENV
|
|
echo "CCACHE_DIR=${{ env.ccache_dir }}" >> $GITHUB_ENV
|
|
echo "CCACHE_MAXSIZE=${{ env.ccache_maxsize }}" >> $GITHUB_ENV
|
|
|
|
- name: ccache prolog
|
|
run: |-
|
|
ccache -s # Print current cache stats
|
|
ccache -z # Zero cache entry
|
|
|
|
- name: Generate buildfiles for bergamot-translator on android via cmake
|
|
run: |-
|
|
mkdir -p build
|
|
cd build
|
|
NDK=${{ env.ndk }}
|
|
ABI=${{ env.abi }}
|
|
MINSDK_VERSION=${{ env.minsdk_version }}
|
|
ANDROID_PLATFORM=android-${{ env.android_platform }}
|
|
OTHER_ANDROID_ARGS=(
|
|
-DANDROID_ARM_NEON=TRUE
|
|
)
|
|
OTHER_MARIAN_ARGS=(
|
|
-DCOMPILE_CUDA=off
|
|
-DCOMPILE_CPU=on
|
|
-DCMAKE_HAVE_THREADS_LIBRARY=1
|
|
-DCMAKE_USE_WIN32_THREADS_INIT=0
|
|
-DCMAKE_USE_PTHREADS_INIT=1
|
|
-DTHREADS_PREFER_PTHREAD_FLAG=ON
|
|
-DBUILD_ARCH=armv8-a
|
|
# -DCOMPILE_WITHOUT_EXCEPTIONS=on # Apparently this can reduce the binary size, let's see.
|
|
-DSSPLIT_USE_INTERNAL_PCRE2=ON
|
|
)
|
|
# Additionally list variables finally configured.
|
|
cmake -L \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake \
|
|
-DANDROID_TOOLCHAIN=clang \
|
|
-DANDROID_ABI=$ABI \
|
|
-DANDROID_PLATFORM=$ANDROID_PLATFORM \
|
|
-DANDROID_NATIVE_API_LEVEL=$MINSDKVERSION \
|
|
-DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.8 \
|
|
-DANDROID_STL=c++_static \
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
|
"${OTHER_ANDROID_ARGS[@]}" "${OTHER_MARIAN_ARGS[@]}" \
|
|
..
|
|
|
|
|
|
- name : Build bergamot-translator for android
|
|
working-directory: build
|
|
run: |-
|
|
make -j2
|
|
|
|
- name: ccache epilog
|
|
run: 'ccache -s # Print current cache stats'
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
path: ${{github.workspace}}/build/app/bergamot
|
|
|
|
|
|
# Disable release for now.
|
|
# release:
|
|
# name: Release Latest Build
|
|
# runs-on: ubuntu-latest
|
|
# needs: [ubuntu]
|
|
# if: github.ref == 'refs/heads/master'
|
|
# steps:
|
|
# - name: Download artifacts
|
|
# uses: actions/download-artifact@v2
|
|
#
|
|
# - name: Update GitHub prerelease
|
|
# uses: marvinpinto/action-automatic-releases@latest
|
|
# with:
|
|
# repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
# automatic_release_tag: latest
|
|
# prerelease: true
|
|
# title: "Latest Build"
|
|
# files: |
|
|
# artifact/marian-decoder
|