Skip to content

Commit d42a931

Browse files
authored
Improve CI (#39)
1 parent 4204c35 commit d42a931

File tree

6 files changed

+48
-15
lines changed

6 files changed

+48
-15
lines changed

.github/workflows/_ascend_npu_benchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ jobs:
210210
Please check out the following resources for more information:
211211
212212
- [Workflow run][1]
213-
- [Torchbenchmark report (click to download)][2]
213+
- [Torchbenchmark report][2] (click to download)
214214
215215
[1]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
216216
[2]: ${{ steps.upload-report.outputs.artifact-url }}

.github/workflows/_ascend_npu_build_torch.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,18 @@ jobs:
9696
echo "dist-name=${dist_name}" >> $GITHUB_OUTPUT
9797
echo "dist-path=${dist_path}" >> $GITHUB_OUTPUT
9898
99+
- name: Install torch
100+
working-directory: pytorch/dist
101+
run: |
102+
pip install ${{ steps.list-dist.outputs.dist-name }}
103+
104+
- name: List torch version
105+
id: list-version
106+
run: |
107+
torch_version=$(python -c "import torch; print(torch.__version__)")
108+
echo "torch version: ${torch_version}"
109+
echo "torch-version=${torch_version}" >> $GITHUB_OUTPUT
110+
99111
- name: Upload distribution artifact
100112
id: upload-dist
101113
uses: actions/upload-artifact@v4
@@ -109,5 +121,5 @@ jobs:
109121
- name: Write to workflow job summary
110122
if: ${{ steps.upload-dist.outputs.artifact-url }}
111123
run: |
112-
echo "## torch built successfully! :rocket:" >> $GITHUB_STEP_SUMMARY
124+
echo "## torch-${{ steps.list-version.outputs.torch-version }} built successfully! :rocket:" >> $GITHUB_STEP_SUMMARY
113125
echo "You can download the distribution package [here](${{ steps.upload-dist.outputs.artifact-url }})." >> $GITHUB_STEP_SUMMARY

.github/workflows/_ascend_npu_build_torch_npu.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
required: true
1212
type: string
1313
description: 'The docker image which will be used to build'
14+
device:
15+
required: true
16+
type: string
17+
description: 'The device selected to run on'
1418
torch-artifact:
1519
required: false
1620
type: string
@@ -33,8 +37,18 @@ jobs:
3337
runs-on: ${{ inputs.runner }}
3438
container:
3539
image: ${{ inputs.image }}
40+
volumes:
41+
- /usr/local/dcmi:/usr/local/dcmi
42+
- /usr/local/bin/npu-smi:/usr/local/bin/npu-smi
43+
- /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/
44+
- /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info
45+
- /etc/ascend_install.info:/etc/ascend_install.info
3646
options: >-
3747
--network host
48+
--device ${{ inputs.device }}
49+
--device /dev/davinci_manager
50+
--device /dev/devmm_svm
51+
--device /dev/hisi_hdc
3852
env:
3953
HTTP_PROXY: http://127.0.0.1:10809
4054
HTTPS_PROXY: http://127.0.0.1:10809
@@ -117,6 +131,20 @@ jobs:
117131
echo "dist-name=${dist_name}" >> $GITHUB_OUTPUT
118132
echo "dist-path=${dist_path}" >> $GITHUB_OUTPUT
119133
134+
- name: Install torch_npu
135+
working-directory: torch_npu/dist
136+
run: |
137+
pip install ${{ steps.list-dist.outputs.dist-name }}
138+
139+
- name: List torch_npu version
140+
id: list-version
141+
run: |
142+
torch_version=$(python -c "import torch; print(torch.__version__)")
143+
torch_npu_version=$(python -c "import torch_npu; print(torch_npu.__version__)")
144+
echo "torch version: ${torch_version}"
145+
echo "torch_npu version: ${torch_npu_version}"
146+
echo "torch-npu-version=${torch_npu_version}" >> $GITHUB_OUTPUT
147+
120148
- name: Upload distribution artifact
121149
id: upload-dist
122150
uses: actions/upload-artifact@v4
@@ -130,5 +158,5 @@ jobs:
130158
- name: Write to workflow job summary
131159
if: ${{ steps.upload-dist.outputs.artifact-url }}
132160
run: |
133-
echo "## torch_npu built successfully! :rocket:" >> $GITHUB_STEP_SUMMARY
161+
echo "## torch_npu-${{ steps.list-version.outputs.torch-npu-version }} built successfully! :rocket:" >> $GITHUB_STEP_SUMMARY
134162
echo "You can download the distribution package [here](${{ steps.upload-dist.outputs.artifact-url }})." >> $GITHUB_STEP_SUMMARY

.github/workflows/ascend_npu_test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ on:
7878
# Doc: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#concurrency
7979
# Discussion: https://github.com/orgs/community/discussions/5435
8080
concurrency:
81-
group: ${{ github.workflow }}
81+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.client_payload.pull_request.number || github.ref }}
8282
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
8383

8484
jobs:
@@ -129,6 +129,7 @@ jobs:
129129
with:
130130
runner: ${{ needs.prepare.outputs.runner }}
131131
image: ${{ needs.prepare.outputs.image }}
132+
device: ${{ needs.prepare.outputs.device }}
132133
torch-artifact: ${{ needs.build-torch.outputs.torch-artifact }}
133134

134135
test:

.github/workflows/dispatch-event.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
name: 'Dispatch PyTorch events'
22

33
on:
4-
pull_request:
5-
branches:
6-
- 'main'
7-
paths:
8-
- '.github/workflows/dispatch-event.yml'
9-
- '.github/actions/list-pr/**'
10-
- '!**/*.md'
11-
124
schedule:
135
- cron: '0 12 * * *'
146

@@ -61,7 +53,7 @@ jobs:
6153
matrix:
6254
data: ${{ fromJSON(needs.list-pr.outputs.prs) }}
6355
steps:
64-
- name: Dispatch PR events to be out-of-tree test infra
56+
- name: Dispatch PR event to the out-of-tree test infra
6557
uses: peter-evans/repository-dispatch@v3
6658
with:
6759
token: ${{ secrets.COSDT_BOT_TOKEN }}

.github/workflows/redispatch-event.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
redispatch-pr-event:
9-
name: 'Redispatch PyTorch events for #${{ github.event.client_payload.pull_request.number }}'
9+
name: 'Redispatch PR event - #${{ github.event.client_payload.pull_request.number }}'
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
@@ -17,7 +17,7 @@ jobs:
1717
run: |
1818
printf "payload: ${{ toJSON(github.event.client_payload) }}"
1919
20-
- name: Redispatch PyTorch event
20+
- name: Redispatch PR event
2121
uses: peter-evans/repository-dispatch@v3
2222
with:
2323
token: ${{ secrets.COSDT_BOT_TOKEN }}

0 commit comments

Comments
 (0)