|
| 1 | +name: Native S3 XGBoost |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + xgb_version: |
| 6 | + description: 'xgboost version' |
| 7 | + required: false |
| 8 | + |
| 9 | +jobs: |
| 10 | + create-aarch64-runner: |
| 11 | + if: github.repository == 'deepjavalibrary/djl' |
| 12 | + runs-on: [ self-hosted, scheduler ] |
| 13 | + steps: |
| 14 | + - name: Create new Graviton instance |
| 15 | + id: create_aarch64 |
| 16 | + run: | |
| 17 | + cd /home/ubuntu/djl_benchmark_script/scripts |
| 18 | + token=$( curl -X POST -H "Authorization: token ${{ secrets.ACTION_RUNNER_PERSONAL_TOKEN }}" \ |
| 19 | + https://api.github.com/repos/deepjavalibrary/djl/actions/runners/registration-token \ |
| 20 | + --fail \ |
| 21 | + | jq '.token' | tr -d '"' ) |
| 22 | + ./start_instance.sh action_graviton $token djl |
| 23 | + outputs: |
| 24 | + aarch64_instance_id: ${{ steps.create_aarch64.outputs.action_graviton_instance_id }} |
| 25 | + |
| 26 | + build-xgboost-jni-aarch64: |
| 27 | + runs-on: [ self-hosted, aarch64 ] |
| 28 | + container: centos:7 |
| 29 | + timeout-minutes: 30 |
| 30 | + needs: create-aarch64-runner |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v3 |
| 33 | + - name: Install Environment |
| 34 | + run: | |
| 35 | + yum -y update |
| 36 | + yum -y install centos-release-scl-rh epel-release |
| 37 | + yum -y install devtoolset-7 git patch libstdc++-static curl python3-devel |
| 38 | + curl -L -o cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v3.27.0-rc2/cmake-3.27.0-rc2-linux-aarch64.tar.gz |
| 39 | + tar xvfz cmake.tar.gz |
| 40 | + ln -sf $PWD/cmake-3.*/bin/cmake /usr/bin/cmake |
| 41 | + cmake --version |
| 42 | + pip3 install awscli --upgrade |
| 43 | + - name: Set up JDK 11 |
| 44 | + uses: actions/setup-java@v3 |
| 45 | + with: |
| 46 | + distribution: 'corretto' |
| 47 | + java-version: 11 |
| 48 | + - name: Release JNI prep |
| 49 | + run: | |
| 50 | + XGBOOST_VERSION=${{ github.event.inputs.xgb_version }} |
| 51 | + XGBOOST_VERSION=${XGBOOST_VERSION:-$(cat gradle.properties | awk -F '=' '/xgboost_version/ {print $2}')} |
| 52 | + git clone https://github.com/dmlc/xgboost --recursive -b v"$XGBOOST_VERSION" |
| 53 | + export PATH=$PATH:/opt/rh/devtoolset-7/root/usr/bin |
| 54 | + cd xgboost/jvm-packages |
| 55 | + python3 create_jni.py |
| 56 | + cd ../.. |
| 57 | + - name: Configure AWS Credentials |
| 58 | + uses: aws-actions/configure-aws-credentials@v1-node16 |
| 59 | + with: |
| 60 | + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 61 | + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 62 | + aws-region: us-east-2 |
| 63 | + - name: Copy files to S3 with the AWS CLI |
| 64 | + run: | |
| 65 | + XGBOOST_VERSION=${{ github.event.inputs.xgb_version }} |
| 66 | + XGBOOST_VERSION=${XGBOOST_VERSION:-$(cat gradle.properties | awk -F '=' '/xgboost_version/ {print $2}')} |
| 67 | + aws s3 cp xgboost/lib/libxgboost4j.so s3://djl-ai/publish/xgboost/${XGBOOST_VERSION}/jnilib/linux/aarch64/ |
| 68 | + aws cloudfront create-invalidation --distribution-id E371VB8JQ6NRVY --paths "/xgboost/${XGBOOST_VERSION}/jnilib*" |
| 69 | +
|
| 70 | + stop-runners: |
| 71 | + if: ${{ github.repository == 'deepjavalibrary/djl' && always() }} |
| 72 | + runs-on: [ self-hosted, scheduler ] |
| 73 | + needs: [ create-aarch64-runner, build-xgboost-jni-aarch64 ] |
| 74 | + steps: |
| 75 | + - name: Stop all instances |
| 76 | + run: | |
| 77 | + cd /home/ubuntu/djl_benchmark_script/scripts |
| 78 | + instance_id=${{ needs.create-aarch64-runner.outputs.aarch64_instance_id }} |
| 79 | + ./stop_instance.sh $instance_id |
0 commit comments