-
Notifications
You must be signed in to change notification settings - Fork 19
288 lines (230 loc) · 9.31 KB
/
conda-package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
name: Conda package
on:
push:
branches:
- main
tags:
- '[0-9]+.[0-9]+*'
pull_request:
env:
PACKAGE_NAME: dpbench
MODULE_NAME: dpbench
# There is a separate action that removes defaults.
CHANNELS: 'dppy/label/dev,conda-forge,intel,nodefaults'
VER_JSON_NAME: 'version.json'
VER_SCRIPT1: "import json; f = open('version.json', 'r'); j = json.load(f); f.close(); "
VER_SCRIPT2: "d = j['dpbench'][0]; print('='.join((d[s] for s in ('version', 'build'))))"
PYTHONIOENCODING: 'utf-8'
jobs:
build:
name: Build ['${{ matrix.os }}', python='${{ matrix.python }}']
strategy:
fail-fast: false
matrix:
python: ['3.9', '3.10', '3.11']
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.os == 'windows-latest' && 'cmd /U /C CALL {0}' || 'bash -el {0}' }}
continue-on-error: false
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout ${{ env.PACKAGE_NAME }} repo
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python }}
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: "build"
channels: ${{ env.CHANNELS }}
channel-priority: "disabled"
run-post: false
- name: Disable defautls
run: conda config --remove channels defaults
- name: Store conda paths as envs
shell: bash -l {0}
run: |
echo "CONDA_BLD=$CONDA_PREFIX/conda-bld/${{ runner.os == 'Linux' && 'linux' || 'win' }}-64/" | tr "\\" '/' >> $GITHUB_ENV
echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE${{ runner.os == 'Linux' && '/' || '\\' }}" >> $GITHUB_ENV
# boa is an extention to conda so we can use mamba resolver in conda build
- name: Install conda-build
run: mamba install boa
- name: Configure MSBuild
if: runner.os == 'Windows'
uses: microsoft/[email protected]
with:
vs-version: '14.35'
- name: Build conda package
run: conda mambabuild --no-test --python ${{ matrix.python }} conda-recipe
- name: Upload artifact
uses: actions/[email protected]
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.tar.bz2
- name: Upload wheels artifact
uses: actions/[email protected]
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
path: ${{ env.WHEELS_OUTPUT_FOLDER }}${{ env.PACKAGE_NAME }}-*.whl
test:
name: Test ['${{ matrix.os }}', python='${{ matrix.python }}']
needs: build
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.os == 'windows-latest' && 'cmd /U /C CALL {0}' || 'bash -el {0}' }}
strategy:
fail-fast: false
matrix:
python: ['3.9', '3.10', '3.11']
os: [ubuntu-20.04, ubuntu-latest, windows-latest]
precision: ["single", "double"]
experimental: [false]
continue-on-error: ${{ matrix.experimental }}
steps:
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python }}
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: "build"
channels: ${{ env.CHANNELS }}
channel-priority: "disabled"
run-post: false
- name: Disable defautls
run: conda config --remove channels defaults
- name: Store conda paths as envs
shell: bash -l {0}
run: |
echo "CHANNEL_PATH=${{ github.workspace }}/channel/" | tr "\\" "/" >> $GITHUB_ENV
echo "EXTRACTED_PKG_PATH=${{ github.workspace }}/pkg/" | tr "\\" "/" >> $GITHUB_ENV
echo "VER_JSON_PATH=${{ github.workspace }}/version.json" | tr "\\" "/" >> $GITHUB_ENV
echo "PKG_PATH_IN_CHANNEL=${{ github.workspace }}/channel/${{ runner.os == 'Linux' && 'linux' || 'win' }}-64/" | tr "\\" "/" >> $GITHUB_ENV
- name: Download artifact
uses: actions/[email protected]
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.PKG_PATH_IN_CHANNEL }}
# We need --force-local because on windows path looks like C:/foo/bar
# and tar interprits semicolons as remote device.
- name: Extract package archive
shell: bash -l {0}
run: |
mkdir -p ${EXTRACTED_PKG_PATH}
tar -xvf ${PKG_PATH_IN_CHANNEL}${PACKAGE_NAME}-*.tar.bz2 -C ${EXTRACTED_PKG_PATH} --force-local
# Needed to be able to run conda index
- name: Install conda-build
run: mamba install conda-build conda-index
- name: Create conda channel
run: python -m conda_index ${{ env.CHANNEL_PATH }}
- name: Test conda channel
run: |
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.CHANNEL_PATH }} --override-channels --info --json > ${{ env.VER_JSON_PATH }}
cat ${{ env.VER_JSON_PATH }}
- name: Install dpbench
run: mamba install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} pytest intel::intel-opencl-rt python=${{ matrix.python }} -c ${{ env.CHANNEL_PATH }}
- name: Setup OpenCL CPU device
if: runner.os == 'Windows'
shell: pwsh
run: |
$script_path="$env:CONDA_PREFIX\Scripts\set-intel-ocl-icd-registry.ps1"
&$script_path
echo "OCL_ICD_FILENAMES=$env:CONDA_PREFIX\Library\lib\intelocl64.dll" >> $env:GITHUB_ENV
- name: List installed packages
run: conda list
- name: Smoke test
run: python -c "import dpnp, dpctl, dpbench; dpctl.lsplatform()"
- name: Run benchmarks
run: |
dpbench -i numpy,numba_dpex_p,dpnp,numba_n,sycl run
- name: Generate report
run: |
dpbench report
# we want to make sure that configuration files are geting populated
- name: Run npbench benchmark
run: |
dpbench -i numpy -b azimint_hist run --npbench --precision=${{matrix.precision}}
- name: Run rodinia benchmark
run: |
dpbench run --rodinia --no-dpbench --no-validate -r 1 --precision=${{matrix.precision}}
upload_anaconda:
name: Upload dppy/label/dev ['${{ matrix.os }}', python='${{ matrix.python }}']
needs: [test]
strategy:
matrix:
python: ['3.9', '3.10', '3.11']
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -el {0}
continue-on-error: false
if: |
(github.repository == 'IntelPython/dpbench') &&
(github.ref == 'refs/heads/main' || (startsWith(github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains(github.ref, 'refs/tags/'))
steps:
- name: Download artifact
uses: actions/[email protected]
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
- name: Download wheels artifact
uses: actions/[email protected]
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
- name: Setup miniconda
uses: conda-incubator/[email protected]
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
miniconda-version: 'latest'
activate-environment: 'upload'
- name: Install anaconda-client
run: conda install anaconda-client
- name: Package version
run: echo "PACKAGE_VERSION=$(basename ${{ env.PACKAGE_NAME }}-*.tar.bz2 | sed 's/^${{ env.PACKAGE_NAME }}-\([^-]*\).*/\1/')" >> $GITHUB_ENV
- name: Upload
run: anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.tar.bz2
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
- name: Upload Wheels
run: anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.whl --version ${{ env.PACKAGE_VERSION }}
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
cleanup_packages:
name: Clean up anaconda packages
needs: [upload_anaconda]
runs-on: 'ubuntu-latest'
defaults:
run:
shell: bash -el {0}
steps:
- uses: conda-incubator/setup-miniconda@v2
with:
run-post: false
channel-priority: "disabled"
channels: conda-forge
python-version: '3.11'
- name: Install anaconda-client
run: conda install anaconda-client
- name: Checkout repo
uses: actions/checkout@v2
with:
repository: IntelPython/devops-tools
fetch-depth: 0
- name: Cleanup old packages
run: |
python scripts/cleanup-old-packages.py \
--verbose --force --token ${{ secrets.ANACONDA_TOKEN }} \
--package dppy/${{ env.PACKAGE_NAME }} --label dev