Skip to content

Commit afbe556

Browse files
committed
update
1 parent e66d303 commit afbe556

File tree

4 files changed

+218
-157
lines changed

4 files changed

+218
-157
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: '_ascend_npu_build'
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
runner:
7+
required: true
8+
type: string
9+
description: 'The runner selected to run on'
10+
image:
11+
required: true
12+
type: string
13+
description: 'The docker image which will be used to build'
14+
outputs:
15+
artifact_name:
16+
description: 'The result of the called workflow'
17+
value: ${{ steps.list-dist.outputs.dist_name }}
18+
19+
# Bash shells do not use ~/.profile or ~/.bashrc so these shells need to be explicitly
20+
# declared as "shell: bash -el {0}" on steps that need to be properly activated.
21+
# It's used to activate ascend-toolkit environment variables.
22+
defaults:
23+
run:
24+
shell: bash -el {0}
25+
26+
jobs:
27+
build:
28+
name: build torch_npu
29+
runs-on: ${{ inputs.runner }}
30+
container:
31+
image: ${{ inputs.image }}
32+
volumes:
33+
- /home/runner/actions-runner/codes:/root/codes
34+
steps:
35+
- name: Prepare the codes
36+
run: |
37+
cp -rf /root/codes /root/build
38+
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
42+
- name: Install dependencies
43+
uses: ./.github/actions/dependencies-action
44+
with:
45+
pip_packages: |
46+
- wheel
47+
pip_requirements: |
48+
- /root/build/npu/pytorch/requirements.txt
49+
50+
- name: List Python version
51+
id: list-py-version
52+
run: |
53+
py_version=$(python --version | awk '{print $2}' | cut -d '.' -f 1,2)
54+
echo "py_version=${py_version}" >> $GITHUB_OUTPUT
55+
56+
- name: Build torch_npu
57+
working-directory: /root/build/npu/pytorch
58+
run: |
59+
bash ci/build.sh --python=${{ steps.list-py-version.outputs.py_version }}
60+
61+
- name: List distribution package
62+
id: list-dist
63+
working-directory: /root/build/npu/pytorch/dist
64+
run: |
65+
dist_name=$(ls torch_npu*.whl)
66+
dist_path=$(pwd)/${dist_name}
67+
echo "dist_name=${dist_name}" >> $GITHUB_OUTPUT
68+
echo "dist_path=${dist_path}" >> $GITHUB_OUTPUT
69+
70+
- name: Upload distribution artifact
71+
id: upload-dist
72+
continue-on-error: true
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: ${{ steps.list-dist.outputs.dist_name }}
76+
path: ${{ steps.list-dist.outputs.dist_path }}
77+
retention-days: 1
78+
79+
- name: Write to workflow job summary
80+
if: ${{ steps.upload-dist.outputs.artifact-url }}
81+
run: |
82+
echo "## torch_npu built successfully! :rocket:" >> $GITHUB_STEP_SUMMARY
83+
echo "You can download the distribution package [here](${{ steps.upload-dist.outputs.artifact-url }})." >> $GITHUB_STEP_SUMMARY
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: '_ascend_npu_test'
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
runner:
7+
required: true
8+
type: string
9+
description: 'The runner selected to run on'
10+
device:
11+
required: true
12+
type: string
13+
description: 'The device selected to run on'
14+
image:
15+
required: true
16+
type: string
17+
description: 'The docker image which will be loaded'
18+
artifact_name:
19+
required: true
20+
type: string
21+
description: 'The torch_npu distribution artifact name'
22+
23+
# Bash shells do not use ~/.profile or ~/.bashrc so these shells need to be explicitly
24+
# declared as "shell: bash -el {0}" on steps that need to be properly activated.
25+
# It's used to activate ascend-toolkit environment variables.
26+
defaults:
27+
run:
28+
shell: bash -el {0}
29+
30+
jobs:
31+
test:
32+
name: test torch_npu in ${{ inputs.image }} with ${{ inputs.device }}
33+
runs-on: ${{ inputs.runner }}
34+
needs:
35+
- build
36+
container:
37+
image: ${{ inputs.image }}
38+
volumes:
39+
- /usr/local/dcmi:/usr/local/dcmi
40+
- /usr/local/bin/npu-smi:/usr/local/bin/npu-smi
41+
- /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/
42+
- /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info
43+
- /etc/ascend_install.info:/etc/ascend_install.info
44+
- /home/runner/actions-runner/codes:/root/codes
45+
options: >-
46+
--network host
47+
--device ${{ inputs.device }}
48+
--device /dev/davinci_manager
49+
--device /dev/devmm_svm
50+
--device /dev/hisi_hdc
51+
steps:
52+
- name: Show NPU info
53+
run: |
54+
npu-smi info
55+
56+
- name: Prepare the codes
57+
run: |
58+
cp -rf /root/codes /root/build
59+
60+
- name: Download distribution artifact
61+
uses: actions/download-artifact@v4
62+
with:
63+
name: ${{ inputs.artifact_name }}
64+
path: /root/build
65+
66+
- name: Checkout
67+
uses: actions/checkout@v4
68+
69+
- name: Install dependencies
70+
uses: ./.github/actions/dependencies-action
71+
with:
72+
pip_packages: |
73+
- wheel
74+
- unittest-xml-reporting
75+
pip_requirements: |
76+
- /root/build/npu/pytorch/requirements.txt
77+
- /root/build/npu/pytorch/test/requirements.txt --no-deps
78+
79+
- name: Install torch_npu
80+
working-directory: /root/build
81+
run: |
82+
pip install ${{ inputs.artifact_name }}
83+
84+
# TODO(shink): Skip
85+
- name: Do the test
86+
continue-on-error: true
87+
working-directory: /root/build
88+
run: |
89+
python npu/pytorch/ci/access_control_test.py
90+
env:
91+
DISABLED_TESTS_FILE: /root/build/npu/pytorch/test/unsupported_test_cases/.pytorch-disabled-tests.json

.github/workflows/_build-and-test.yml

Lines changed: 0 additions & 153 deletions
This file was deleted.

0 commit comments

Comments
 (0)