Skip to content

Commit 6e800d2

Browse files
committed
Add workflow files
1 parent fae571a commit 6e800d2

File tree

4 files changed

+154
-0
lines changed

4 files changed

+154
-0
lines changed

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

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build and 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+
devices:
11+
required: true
12+
type: string
13+
description: The devices selected to run on
14+
image:
15+
required: true
16+
type: string
17+
description: The docker iamge which will be loaded
18+
19+
jobs:
20+
build-and-test:
21+
runs-on: ${{ inputs.runner }}
22+
defaults:
23+
run:
24+
shell: bash
25+
container:
26+
image: ${{ inputs.image }}
27+
env:
28+
HOME: /root
29+
volumes:
30+
- /usr/local/dcmi:/usr/local/dcmi
31+
- /usr/local/bin/npu-smi:/usr/local/bin/npu-smi
32+
- /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/
33+
- /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info
34+
- /root/codes/:/root/codes
35+
options: --network host ${{ inputs.devices }} --device /dev/davinci_manager --device /dev/devmm_svm --device /dev/hisi_hdc
36+
steps:
37+
- name: Set environment
38+
run: |
39+
source /root/.bashrc && conda activate torch_npu
40+
- name: Prepare the codes
41+
run: |
42+
\cp -rf /root/codes/ /root/build
43+
- name: Compile torch
44+
working-directory: /root/build/pytorch/pytorch
45+
run: |
46+
pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
47+
export _GLIBCXX_USE_CXX11_ABI=0
48+
export USE_CUDA=0
49+
export USE_XNNPACK=0
50+
python setup.py develop
51+
- name: Compile and install torch_npu
52+
working-directory: /root/build/npu/pytorch
53+
run: |
54+
pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
55+
bash ci/build.sh --python=3.8
56+
pip3 install dist/torch_npu*.whl
57+
- name: Do the test
58+
working-directory: /root/build
59+
run: |
60+
pip3 install -r npu/pytorch/test/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple --no-deps
61+
python npu/pytorch/ci/access_control_test.py
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Fetch and Rebase
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+
loop:
11+
required: true
12+
type: string
13+
description: Loop time when fails
14+
15+
jobs:
16+
fetch-and-rebase:
17+
runs-on: ${{ inputs.runner }}
18+
steps:
19+
- name: Pull latest codes for torch
20+
uses: ascend/pytorch/.github/actions/fetch-and-rebase@master
21+
with:
22+
repo_path: /root/codes/pytorch/pytorch
23+
remote_branch: upstream/main
24+
loop: ${{ inputs.loop }}
25+
- name: Pull latest codes for torch_npu
26+
uses: ascend/pytorch/.github/actions/fetch-and-rebase@master
27+
with:
28+
repo_path: /root/codes/npu/pytorch
29+
remote_branch: upstream/master
30+
loop: ${{ inputs.loop }}

.github/workflows/manual.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Ascend NPU(Manual)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
runner:
7+
required: true
8+
type: string
9+
default: 'self-hosted'
10+
description: The runner selected to run on
11+
devices:
12+
required: true
13+
type: string
14+
default: '--device /dev/davinci6'
15+
description: The devices selected to run on
16+
image:
17+
required: true
18+
type: string
19+
default: 'ascendai/cann:7.1-openeuler2203sp2'
20+
description: The docker iamge which will be loaded
21+
22+
jobs:
23+
linux-py3_8-fetch-and-rebase:
24+
name: linux-py3_8-7.0.RC1.alpha005
25+
uses: ./.github/workflows/_fetch_and_rebase.yml
26+
with:
27+
runner: ${{ inputs.runner }}
28+
loop: 10
29+
30+
linux-py3_8-build-and-test:
31+
name: linux-py3_8-7.0.RC1.alpha005
32+
uses: ./.github/workflows/_build-and-test.yml
33+
needs: linux-py3_8-fetch-and-rebase
34+
with:
35+
runner: ${{ inputs.runner }}
36+
devices: ${{ inputs.devices }}
37+
image: ${{ inputs.image }}

.github/workflows/periodic.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Note:
2+
# Same runner only needs one job named like .*fetch-and-rebase
3+
4+
name: Ascend NPU
5+
6+
on:
7+
schedule:
8+
- cron: '0 12 * * *'
9+
workflow_dispatch:
10+
11+
jobs:
12+
linux-py3_8-fetch-and-rebase:
13+
name: linux-py3_8-7.0.RC1.alpha005
14+
uses: ./.github/workflows/_fetch_and_rebase.yml
15+
with:
16+
runner: self-hosted
17+
loop: 10
18+
19+
linux-py3_8-build-and-test:
20+
name: linux-py3_8-7.0.RC1.alpha005
21+
uses: ./.github/workflows/_build-and-test.yml
22+
needs: linux-py3_8-fetch-and-rebase
23+
with:
24+
runner: self-hosted
25+
devices: --device /dev/davinci6
26+
image: ascendai/cann:7.1-openeuler2203sp2

0 commit comments

Comments
 (0)