16
16
type : string
17
17
description : The docker image which will be loaded
18
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
+ defaults :
22
+ run :
23
+ shell : bash -el {0}
24
+
19
25
jobs :
20
- build-and-test :
21
- name : build and test in ${{ inputs.image }} with ${{ inputs.device }}
26
+ build :
27
+ name : build torch_npu
22
28
runs-on : ${{ inputs.runner }}
23
- defaults :
24
- run :
25
- shell : bash -el {0}
26
29
container :
27
30
image : ${{ inputs.image }}
28
- env :
29
- HOME : /root
31
+ volumes :
32
+ - /home/runner/actions-runner/codes:/root/codes
33
+ outputs :
34
+ dist_name : ${{ steps.list-dist.outputs.dist_name }}
35
+ steps :
36
+ - name : Prepare the codes
37
+ run : |
38
+ cp -rf /root/codes /root/build
39
+
40
+ - name : Checkout
41
+ uses : actions/checkout@v4
42
+
43
+ - name : Install dependencies
44
+ uses : ./.github/actions/dependencies-action
45
+ with :
46
+ pip_packages : |
47
+ - wheel
48
+ pip_requirements : |
49
+ - /root/build/npu/pytorch/requirements.txt
50
+
51
+ - name : Build torch_npu
52
+ working-directory : /root/build/npu/pytorch
53
+ run : |
54
+ py_version=$(python --version | awk '{print $2}' | cut -d '.' -f 1,2)
55
+ bash ci/build.sh --python=${py_version}
56
+
57
+ - name : List distribution package
58
+ id : list-dist
59
+ working-directory : /root/build/npu/pytorch/dist
60
+ run : |
61
+ dist_name=$(ls torch_npu*.whl)
62
+ dist_path=$(pwd)/${dist_name}
63
+ echo "dist_name=${dist_name}" >> $GITHUB_OUTPUT
64
+ echo "dist_path=${dist_path}" >> $GITHUB_OUTPUT
65
+
66
+ - name : Upload distribution artifact
67
+ id : upload-dist
68
+ continue-on-error : true
69
+ uses : actions/upload-artifact@v4
70
+ with :
71
+ name : ${{ steps.list-dist.outputs.dist_name }}
72
+ path : ${{ steps.list-dist.outputs.dist_path }}
73
+ retention-days : 1
74
+
75
+ - name : Write to workflow job summary
76
+ if : ${{ steps.upload-dist.outputs.artifact-url }}
77
+ run : |
78
+ echo "## torch_npu built successfully! :rocket:" >> $GITHUB_STEP_SUMMARY
79
+ echo "You can download the distribution package [here](${{ steps.upload-dist.outputs.artifact-url }})." >> $GITHUB_STEP_SUMMARY
80
+
81
+ test :
82
+ name : test torch_npu in ${{ inputs.image }} with ${{ inputs.device }}
83
+ runs-on : ${{ inputs.runner }}
84
+ needs :
85
+ - build
86
+ container :
87
+ image : ${{ inputs.image }}
30
88
volumes :
31
89
- /usr/local/dcmi:/usr/local/dcmi
32
90
- /usr/local/bin/npu-smi:/usr/local/bin/npu-smi
33
91
- /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/
34
92
- /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info
93
+ - /etc/ascend_install.info:/etc/ascend_install.info
35
94
- /home/runner/actions-runner/codes:/root/codes
36
95
options : >-
37
96
--network host
@@ -40,73 +99,43 @@ jobs:
40
99
--device /dev/devmm_svm
41
100
--device /dev/hisi_hdc
42
101
steps :
43
- # - name: Set environment
44
- # run: |
45
- # source /root/.bashrc && conda activate torch_npu
102
+ - name : Show NPU info
103
+ run : |
104
+ npu-smi info
46
105
47
106
- name : Prepare the codes
48
107
run : |
49
108
cp -rf /root/codes /root/build
50
109
51
- # - name: Compile torch
52
- # working-directory: /root/build/pytorch/pytorch
53
- # run: |
54
- # pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
55
- # export _GLIBCXX_USE_CXX11_ABI=0
56
- # export USE_CUDA=0
57
- # export USE_XNNPACK=0
58
- # python setup.py develop
59
-
60
- - name : Install system dependencies
61
- env :
62
- DEBIAN_FRONTEND : noninteractive
63
- run : |
64
- sed -i 's|ports.ubuntu.com|mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list
65
- apt update
66
- apt install --no-install-recommends -y \
67
- git \
68
- gcc-10 \
69
- g++-10 \
70
- make \
71
- cmake \
72
- ninja-build
73
-
74
- - name : Create symlinks for gcc and g++
75
- run : |
76
- ln -s /usr/bin/gcc-10 /usr/bin/gcc
77
- ln -s /usr/bin/g++-10 /usr/bin/g++
78
-
79
- - name : Install pip dependencies
80
- run : |
81
- pip install -i https://pypi.tuna.tsinghua.edu.cn/simple \
82
- wheel \
83
- setuptools \
84
- unittest-xml-reporting
110
+ - name : Download distribution artifact
111
+ uses : actions/download-artifact@v4
112
+ with :
113
+ name : ${{ needs.build.outputs.dist_name }}
114
+ path : /root/build
85
115
86
- - name : Show versions
87
- run : |
88
- set -x
89
- python --version
90
- pip --version
91
- gcc --version
92
- g++ --version
93
- make --version
94
- cmake --version
95
- ninja --version
116
+ - name : Checkout
117
+ uses : actions/checkout@v4
96
118
97
- - name : Show NPU info
98
- run : |
99
- npu-smi info
119
+ - name : Install dependencies
120
+ uses : ./.github/actions/dependencies-action
121
+ with :
122
+ pip_packages : |
123
+ - wheel
124
+ - unittest-xml-reporting
125
+ pip_requirements : |
126
+ - /root/build/npu/pytorch/requirements.txt
127
+ - /root/build/npu/pytorch/requirements.txt
128
+ - /root/build/npu/pytorch/test/requirements.txt --no-deps
100
129
101
- - name : Compile and install torch_npu
102
- working-directory : /root/build/npu/pytorch
130
+ - name : Install torch_npu
131
+ working-directory : /root/build
103
132
run : |
104
- pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
105
- bash ci/build.sh --python=`python --version | awk '{print $2}' | cut -d '.' -f 1,2`
106
- pip install dist/torch_npu*.whl
133
+ pip install ${{ needs.build.outputs.dist_name }}
107
134
108
135
- name : Do the test
136
+ continue-on-error : true # Skip if failed
109
137
working-directory : /root/build
110
138
run : |
111
- pip install -r npu/pytorch/test/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple --no-deps
112
139
python npu/pytorch/ci/access_control_test.py
140
+ env :
141
+ DISABLED_TESTS_FILE : /root/build/npu/pytorch/test/unsupported_test_cases/.pytorch-disabled-tests.json
0 commit comments