From ed91e9cb7a28efa4c1ee412f2ac4be6b361bf092 Mon Sep 17 00:00:00 2001 From: FFFrog Date: Fri, 27 Oct 2023 19:19:19 +0800 Subject: [PATCH] add CI/CD for pytorch ascend adapter --- .github/workflows/pytorch.yaml | 76 +++++++++++++++++++ .../ONNXRuntime_Ascend_support_CN.md | 0 2 files changed, 76 insertions(+) create mode 100644 .github/workflows/pytorch.yaml rename ONNXRuntime_Ascend_support_CN.md => docs/ONNXRuntime_Ascend_support_CN.md (100%) diff --git a/.github/workflows/pytorch.yaml b/.github/workflows/pytorch.yaml new file mode 100644 index 0000000000..b3ee0d449c --- /dev/null +++ b/.github/workflows/pytorch.yaml @@ -0,0 +1,76 @@ +name: Ascend Pytorch Adapter CI/CD + +on: + schedule: + - cron: '0 12 * * *' + issue_comment: + types: [created] + +jobs: + fetch-and-rebase: + runs-on: self-hosted + steps: + - name: Pull latest codes + run: | + echo "All Success" + # - name: Pull latest codes for torch + # run: | + # pushd /root/codes/pytorch/pytorch && + # git fetch --all && + # git rebase upstream/main && + # git submodule update --init --recursive && + # git reset --hard HEAD && + # git clean -dfx && + # git submodule foreach git reset --hard HEAD && + # git submodule foreach git clean -dfx && + # popd + # - name: Pull latest codes for torch_npu + # run: | + # pushd /root/codes/npu/pytorch && + # git fetch --all && + # git rebase upstream/main && + # git submodule update --init --recursive && + # git reset --hard HEAD && + # git clean -dfx && + # git submodule foreach git reset --hard HEAD && + # git submodule foreach git clean -dfx && + # popd + compile-and-test: + runs-on: self-hosted + needs: fetch-and-rebase + defaults: + run: + shell: bash + container: + image: ascendai/cann:7.0.RC1.alpha005-openeuler2203sp2 + env: + HOME: /root + volumes: + - /usr/local/dcmi:/usr/local/dcmi + - /usr/local/bin/npu-smi:/usr/local/bin/npu-smi + - /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ + - /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info + - /root/codes/:/root/codes + options: --network host --device /dev/davinci1 --device /dev/davinci_manager --device /dev/devmm_svm --device /dev/hisi_hdc + steps: + - name: Set environment + run: + source /root/.bashrc && conda activate torch_npu + - name: Compile torch + working-directory: /root/codes/pytorch/pytorch + run: | + pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple + export _GLIBCXX_USE_CXX11_ABI=0 + export USE_CUDA=0 + export USE_XNNPACK=0 + python setup.py develop + - name: Compile and install torch_npu + working-directory: /root/codes/npu/pytorch + run: | + pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple + bash ci/build.sh --python=3.8 + pip3 install dist/torch_npu*.whl + - name: Do the test + working-directory: /root/codes + run: | + python npu/pytorch/test/run_test.py -v -i test_npu/test_aoe test_npu/test_c10d test_npu/test_device test_npu/test_jit_compile test_npu/test_option test_npu/test_tensor test_npu/test_torch_backends diff --git a/ONNXRuntime_Ascend_support_CN.md b/docs/ONNXRuntime_Ascend_support_CN.md similarity index 100% rename from ONNXRuntime_Ascend_support_CN.md rename to docs/ONNXRuntime_Ascend_support_CN.md