Skip to content

Commit 8df0715

Browse files
Merge remote-tracking branch 'origin/master' into add_sycl_queue_fill
2 parents 9c1dfc3 + 01129f1 commit 8df0715

9 files changed

Lines changed: 566 additions & 3 deletions

File tree

Lines changed: 370 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,370 @@
1+
name: Conda package (conda-forge)
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
permissions: read-all
10+
11+
env:
12+
PACKAGE_NAME: dpctl
13+
MODULE_NAME: dpctl
14+
TEST_ENV_NAME: test_dpctl
15+
RECIPE_DIR: conda-recipe-cf
16+
CHANNELS: "-c conda-forge --override-channels"
17+
VER_SCRIPT1: "import json; f = open('ver.json', 'r'); j = json.load(f); f.close(); d = j['dpctl'][0];"
18+
VER_SCRIPT2: "print('='.join((d[s] for s in ('version', 'build'))))"
19+
CONDA_BUILD_VERSION: 26.3.0
20+
CONDA_INDEX_VERSION: 0.11.0
21+
22+
jobs:
23+
build_linux:
24+
runs-on: ubuntu-latest
25+
timeout-minutes: 90
26+
27+
strategy:
28+
matrix:
29+
python: ['3.10', '3.11', '3.12', '3.13']
30+
python_spec: ['']
31+
include:
32+
- python: '3.14'
33+
python_spec: '3.14.* *_cp314'
34+
- python: '3.14'
35+
python_spec: '3.14.* *_cp314t'
36+
steps:
37+
- name: Cancel Previous Runs
38+
uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 # 0.13.1
39+
with:
40+
access_token: ${{ github.token }}
41+
42+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
43+
with:
44+
fetch-depth: 0
45+
46+
- name: Set pkgs_dirs
47+
run: |
48+
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
49+
- name: Cache conda packages
50+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
51+
env:
52+
CACHE_NUMBER: 3 # Increase to reset cache
53+
with:
54+
path: ~/.conda/pkgs
55+
key:
56+
${{ runner.os }}-conda-cf-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-spec-${{ matrix.python == '3.14' && contains(matrix.python_spec, 'cp314t') && 't' || '' }}-${{hashFiles('conda-recipe-cf/meta.yaml') }}
57+
restore-keys: |
58+
${{ runner.os }}-conda-cf-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-spec-${{ matrix.python == '3.14' && contains(matrix.python_spec, 'cp314t') && 't' || '' }}-
59+
${{ runner.os }}-conda-cf-${{ env.CACHE_NUMBER }}-
60+
- name: Add conda to system path
61+
run: echo "$CONDA/bin" >> "$GITHUB_PATH"
62+
- name: Update conda
63+
run: |
64+
conda update -n base --all
65+
- name: Install conda-build
66+
run: |
67+
conda install -n base conda-build=${{ env.CONDA_BUILD_VERSION }} ${{ env.CHANNELS }}
68+
- name: Show Conda info
69+
run: |
70+
conda info --all
71+
- name: List base environment packages
72+
run: |
73+
conda list -n base
74+
- name: Build conda package
75+
run: |
76+
if [ -n "${{ matrix.python_spec }}" ]; then
77+
conda build --no-test --python "${{ matrix.python_spec }}" ${{ env.CHANNELS }} ${{ env.RECIPE_DIR }}
78+
else
79+
conda build --no-test --python ${{ matrix.python }} ${{ env.CHANNELS }} ${{ env.RECIPE_DIR }}
80+
fi
81+
- name: Upload artifact
82+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
83+
with:
84+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python == '3.14' && (contains(matrix.python_spec, 'cp314t') && '3.14t' || '3.14') || matrix.python }}
85+
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.conda
86+
87+
build_windows:
88+
runs-on: windows-latest
89+
timeout-minutes: 150
90+
defaults:
91+
run:
92+
shell: cmd /C CALL {0}
93+
94+
strategy:
95+
matrix:
96+
python: ['3.10', '3.11', '3.12', '3.13']
97+
python_spec: ['']
98+
include:
99+
- python: '3.14'
100+
python_spec: '3.14.* *_cp314'
101+
- python: '3.14'
102+
python_spec: '3.14.* *_cp314t'
103+
steps:
104+
- name: Cancel Previous Runs
105+
uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 # 0.13.1
106+
with:
107+
access_token: ${{ github.token }}
108+
109+
# the recipe takes the version from git describe
110+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
111+
with:
112+
fetch-depth: 0
113+
114+
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
115+
with:
116+
auto-update-conda: true
117+
miniforge-version: latest
118+
activate-environment: build
119+
channels: conda-forge
120+
conda-remove-defaults: true
121+
python-version: ${{ matrix.python }}
122+
conda-build-version: ${{ env.CONDA_BUILD_VERSION }}
123+
- name: Store conda paths as envs
124+
shell: bash -l {0}
125+
run: |
126+
echo "CONDA_BLD=$CONDA/conda-bld/win-64/" | tr "\\\\" '/' >> "$GITHUB_ENV"
127+
- name: Show Conda info
128+
run: |
129+
conda info --all
130+
- name: List base environment packages
131+
run: |
132+
conda list -n base
133+
- name: Build conda package
134+
run: |
135+
set "PYTHON_VER=${{ matrix.python_spec }}"
136+
if "%PYTHON_VER%" NEQ "" (
137+
conda build --no-test --python "%PYTHON_VER%" ${{ env.CHANNELS }} ${{ env.RECIPE_DIR }}
138+
) else (
139+
conda build --no-test --python ${{ matrix.python }} ${{ env.CHANNELS }} ${{ env.RECIPE_DIR }}
140+
)
141+
142+
- name: Upload artifact
143+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
144+
with:
145+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python == '3.14' && (contains(matrix.python_spec, 'cp314t') && '3.14t' || '3.14') || matrix.python }}
146+
path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.conda
147+
148+
test_linux:
149+
needs: build_linux
150+
runs-on: ${{ matrix.runner }}
151+
timeout-minutes: 30
152+
153+
strategy:
154+
matrix:
155+
python: ['3.10', '3.11', '3.12', '3.13']
156+
python_spec: ['']
157+
include:
158+
- python: '3.14'
159+
python_spec: '3.14.* *_cp314'
160+
runner: ubuntu-22.04
161+
- python: '3.14'
162+
python_spec: '3.14.* *_cp314t'
163+
runner: ubuntu-22.04
164+
runner: [ubuntu-latest]
165+
166+
steps:
167+
- name: Download artifact
168+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
169+
with:
170+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python == '3.14' && (contains(matrix.python_spec, 'cp314t') && '3.14t' || '3.14') || matrix.python }}
171+
- name: Add conda to system path
172+
run: echo "$CONDA/bin" >> "$GITHUB_PATH"
173+
- name: Update conda
174+
run: |
175+
conda update -n base --all
176+
- name: Install conda-index
177+
run: |
178+
conda install -n base conda-index=${{ env.CONDA_INDEX_VERSION }} ${{ env.CHANNELS }}
179+
- name: Show Conda info
180+
run: |
181+
conda info --all
182+
- name: List base environment packages
183+
run: |
184+
conda list -n base
185+
- name: Create conda channel
186+
run: |
187+
mkdir -p "$GITHUB_WORKSPACE/channel/linux-64"
188+
conda index "$GITHUB_WORKSPACE/channel" || exit 1
189+
mv "${PACKAGE_NAME}"-*.conda "$GITHUB_WORKSPACE/channel/linux-64" || exit 1
190+
conda index "$GITHUB_WORKSPACE/channel" || exit 1
191+
# Test channel
192+
conda search "$PACKAGE_NAME" -c "$GITHUB_WORKSPACE/channel" --override-channels --info --json > "$GITHUB_WORKSPACE/ver.json"
193+
cat ver.json
194+
- name: Collect dependencies
195+
run: |
196+
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
197+
export CHANNELS
198+
PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
199+
export PACKAGE_VERSION
200+
PYTHON_VER="${{ matrix.python_spec }}"
201+
if [ -z "${PYTHON_VER}" ]; then
202+
PYTHON_VER="${{ matrix.python }}"
203+
fi
204+
# shellcheck disable=SC2086
205+
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=${PACKAGE_VERSION} python="${PYTHON_VER}" $CHANNELS --only-deps --dry-run > lockfile
206+
cat lockfile
207+
- name: Set pkgs_dirs
208+
run: |
209+
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
210+
- name: Cache conda packages
211+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
212+
env:
213+
CACHE_NUMBER: 3 # Increase to reset cache
214+
with:
215+
path: ~/.conda/pkgs
216+
key:
217+
${{ runner.os }}-conda-cf-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-spec-${{ matrix.python == '3.14' && contains(matrix.python_spec, 'cp314t') && 't' || '' }}-${{hashFiles('lockfile') }}
218+
restore-keys: |
219+
${{ runner.os }}-conda-cf-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-spec-${{ matrix.python == '3.14' && contains(matrix.python_spec, 'cp314t') && 't' || '' }}-
220+
${{ runner.os }}-conda-cf-${{ env.CACHE_NUMBER }}-
221+
- name: Install dpctl
222+
run: |
223+
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
224+
export CHANNELS
225+
# intel-opencl-rt provides the OpenCL CPU device to run the tests on
226+
TEST_DEPENDENCIES="pytest cython setuptools intel-opencl-rt"
227+
export TEST_DEPENDENCIES
228+
PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
229+
PYTHON_VER="${{ matrix.python_spec }}"
230+
if [ -z "${PYTHON_VER}" ]; then
231+
PYTHON_VER="${{ matrix.python }}"
232+
fi
233+
export PACKAGE_VERSION
234+
# shellcheck disable=SC2086
235+
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=${PACKAGE_VERSION} $TEST_DEPENDENCIES python="${PYTHON_VER}" $CHANNELS
236+
# Test installed packages
237+
conda list -n "${{ env.TEST_ENV_NAME }}"
238+
- name: Smoke test
239+
run: |
240+
. "$CONDA/etc/profile.d/conda.sh"
241+
conda activate "${{ env.TEST_ENV_NAME }}"
242+
python -c "import dpctl; dpctl.lsplatform(verbosity=2)"
243+
- name: Create test temp dir
244+
# create temporary empty folder to runs tests from
245+
# https://github.com/pytest-dev/pytest/issues/11904
246+
run: mkdir -p "${GITHUB_WORKSPACE}/test_tmp"
247+
- name: Run tests
248+
working-directory: ${{ github.workspace }}/test_tmp
249+
env:
250+
SYCL_CACHE_PERSISTENT: 1
251+
run: |
252+
. "$CONDA/etc/profile.d/conda.sh"
253+
conda activate "${{ env.TEST_ENV_NAME }}"
254+
python -m pytest -v --pyargs "${{ env.MODULE_NAME }}"
255+
256+
test_windows:
257+
needs: build_windows
258+
runs-on: ${{ matrix.runner }}
259+
timeout-minutes: 60
260+
defaults:
261+
run:
262+
shell: cmd /C CALL {0}
263+
strategy:
264+
matrix:
265+
python: ['3.10', '3.11', '3.12', '3.13']
266+
python_spec: ['']
267+
include:
268+
- python: '3.14'
269+
python_spec: '3.14.* *_cp314'
270+
runner: windows-latest
271+
- python: '3.14'
272+
python_spec: '3.14.* *_cp314t'
273+
runner: windows-latest
274+
runner: [windows-latest]
275+
env:
276+
workdir: '${{ github.workspace }}'
277+
278+
steps:
279+
- name: Download artifact
280+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
281+
with:
282+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python == '3.14' && (contains(matrix.python_spec, 'cp314t') && '3.14t' || '3.14') || matrix.python }}
283+
284+
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
285+
with:
286+
auto-update-conda: true
287+
miniforge-version: latest
288+
channels: conda-forge
289+
conda-remove-defaults: true
290+
activate-environment: ${{ env.TEST_ENV_NAME }}
291+
python-version: ${{ matrix.python }}
292+
293+
- name: Install conda-index
294+
run: |
295+
conda install -n base conda-index=${{ env.CONDA_INDEX_VERSION }}
296+
297+
- name: Show Conda info
298+
run: |
299+
conda info --all
300+
301+
- name: List base environment packages
302+
run: |
303+
conda list -n base
304+
305+
- name: Create conda channel with the artifact bit
306+
run: |
307+
@echo on
308+
mkdir ${{ env.workdir }}\channel\win-64
309+
move ${{ env.PACKAGE_NAME }}-*.conda ${{ env.workdir }}\channel\win-64
310+
dir ${{ env.workdir }}\channel\win-64\
311+
312+
- name: Index the channel
313+
run: |
314+
@echo on
315+
conda index ${{ env.workdir }}\channel
316+
317+
- name: Dump dpctl version info from created channel into ver.json
318+
run: |
319+
@echo on
320+
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.workdir }}/channel --override-channels --info --json > ${{ env.workdir }}\ver.json
321+
dir ${{ env.workdir }}
322+
323+
- name: Install dpctl
324+
run: |
325+
@ECHO ON
326+
IF NOT EXIST ver.json (
327+
copy /Y ${{ env.workdir }}\ver.json .
328+
)
329+
set "SCRIPT=%VER_SCRIPT1% %VER_SCRIPT2%"
330+
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
331+
SET PACKAGE_VERSION=%%F
332+
)
333+
SET "PYTHON_VER=${{ matrix.python_spec }}"
334+
IF "%PYTHON_VER%"=="" SET "PYTHON_VER=${{ matrix.python }}"
335+
REM intel-opencl-rt provides the OpenCL CPU device to run the tests on
336+
SET "TEST_DEPENDENCIES=pytest cython setuptools intel-opencl-rt"
337+
conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %TEST_DEPENDENCIES% python="%PYTHON_VER%" -c ${{ env.workdir }}/channel ${{ env.CHANNELS }}
338+
339+
- name: Report content of test environment
340+
run: |
341+
conda info && conda list -n ${{ env.TEST_ENV_NAME }}
342+
343+
- name: Register the OpenCL CPU driver with the ICD loader
344+
shell: pwsh
345+
run: |
346+
$vendors = "HKLM:\SOFTWARE\Khronos\OpenCL\Vendors"
347+
$drivers = @(Get-ChildItem -Recurse -ErrorAction SilentlyContinue -Filter intelocl64.dll -Path "$env:CONDA_PREFIX\Library\bin")
348+
if ($drivers.Count -eq 0) { throw "intel-opencl-rt installed no OpenCL CPU driver under $env:CONDA_PREFIX" }
349+
if (-not (Test-Path $vendors)) { New-Item -Path $vendors -Force | Out-Null }
350+
foreach ($driver in $drivers) {
351+
New-ItemProperty -Path $vendors -Name $driver.FullName -Value 0 -PropertyType DWord -Force | Out-Null
352+
}
353+
Get-ItemProperty -Path $vendors
354+
355+
- name: Smoke test
356+
run: >-
357+
conda activate ${{ env.TEST_ENV_NAME }} && python -m dpctl -f
358+
359+
- name: Create empty temporary directory to run tests from
360+
# create temporary empty folder to runs tests from
361+
# https://github.com/pytest-dev/pytest/issues/11904
362+
run: >-
363+
mkdir "${{ env.workdir }}\test_tmp"
364+
365+
- name: Run tests
366+
env:
367+
SYCL_CACHE_PERSISTENT: 1
368+
working-directory: ${{ env.workdir }}\test_tmp
369+
run: >-
370+
conda activate ${{ env.TEST_ENV_NAME }} && python -m pytest -v -s --pyargs ${{ env.MODULE_NAME }}

.github/workflows/openssf-scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ jobs:
6969

7070
# Upload the results to GitHub's code scanning dashboard.
7171
- name: "Upload to code-scanning"
72-
uses: github/codeql-action/upload-sarif@5595ccaf912efad79be6eef63a5619ff05969be3 # v4.37.6
72+
uses: github/codeql-action/upload-sarif@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9
7373
with:
7474
sarif_file: results.sarif

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ repos:
5959
- id: black
6060
exclude: "versioneer.py|dpctl/_version.py"
6161
- repo: https://github.com/pycqa/isort
62-
rev: 9.0.0b2
62+
rev: 9.0.0b5
6363
hooks:
6464
- id: isort
6565
name: isort (python)
@@ -84,7 +84,7 @@ repos:
8484
- id: pretty-format-toml
8585
args: [--autofix]
8686
- repo: https://github.com/MarcoGorelli/cython-lint
87-
rev: v0.21.0
87+
rev: v0.21.1
8888
hooks:
8989
- id: cython-lint
9090
- id: double-quote-cython-strings

0 commit comments

Comments
 (0)