Skip to content

Commit e0cac79

Browse files
committed
fix logic for OCL loader with conda-forge runtime
also split into Intel channel and conda-forge jobs
1 parent 1f34b63 commit e0cac79

1 file changed

Lines changed: 41 additions & 74 deletions

File tree

‎.github/workflows/run-tests-from-dppy-bits.yaml‎

Lines changed: 41 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ on:
1212
permissions: read-all
1313

1414
env:
15-
PACKAGE_NAME: dpctl
1615
MODULE_NAME: dpctl
1716
TEST_ENV_NAME: test_dpctl
1817
INTEL_CHANNEL: "https://software.repos.intel.com/python/conda/"
@@ -22,55 +21,36 @@ jobs:
2221
# disable scheduled workflow to be run in forks
2322
if: github.event.repository.fork == false
2423

25-
runs-on: ${{ matrix.runner }}
24+
runs-on: ${{ matrix.runner }}
2625
timeout-minutes: 45
2726

2827
strategy:
2928
matrix:
30-
python: ['3.10', '3.11', '3.12', '3.13']
31-
python_spec: ['']
32-
include:
33-
- python: '3.14'
34-
python_spec: '3.14.* *_cp314'
35-
experimental: false
36-
runner: ubuntu-22.04
37-
- python: '3.14'
38-
python_spec: '3.14.* *_cp314t'
39-
experimental: false
40-
runner: ubuntu-22.04
41-
- python: '3.14'
42-
python_spec: '3.14.* *_cp314'
43-
experimental: false
44-
runner: ubuntu-24.04
45-
- python: '3.14'
46-
python_spec: '3.14.* *_cp314t'
47-
experimental: false
48-
runner: ubuntu-24.04
49-
experimental: [false]
29+
dependencies: [conda-forge, intel]
30+
python_spec: ['3.10', '3.11', '3.12', '3.13', '3.14.* *_cp314', '3.14.* *_cp314t']
5031
runner: [ubuntu-22.04, ubuntu-24.04]
51-
continue-on-error: ${{ matrix.experimental }}
5232

5333
steps:
5434
- name: Construct channels line
5535
run: |
56-
echo "CHANNELS=-c ${{ env.INTEL_CHANNEL }} -c conda-forge --override-channels" >> "$GITHUB_ENV"
57-
58-
- name: Display channels line
59-
run: |
60-
echo "${{ env.CHANNELS }}"
36+
if [ "${{ matrix.dependencies }}" = "intel" ]; then
37+
echo "CHANNELS=-c dppy/label/dev -c ${{ env.INTEL_CHANNEL }} -c conda-forge --override-channels" >> "$GITHUB_ENV"
38+
else
39+
echo "CHANNELS=-c dppy/label/dev -c conda-forge --override-channels" >> "$GITHUB_ENV"
40+
fi
6141
6242
- name: Set pkgs_dirs
6343
run: |
6444
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
6545
6646
- name: Install dpctl
6747
run: |
68-
PYTHON_SPEC="${{ matrix.python_spec }}"
69-
if [ -z "${PYTHON_SPEC}" ]; then
70-
PYTHON_SPEC="${{ matrix.python }}"
71-
fi
7248
# shellcheck disable=SC2086
73-
conda create -n "${{ env.TEST_ENV_NAME }}" -c dppy/label/dev ${{ env.CHANNELS }} dpctl pytest cython setuptools c-compiler cxx-compiler python="${PYTHON_SPEC}"
49+
conda create -n "${{ env.TEST_ENV_NAME }}" ${{ env.CHANNELS }} dpctl pytest cython setuptools c-compiler cxx-compiler python="${{ matrix.python_spec }}"
50+
51+
- name: Report content of test environment
52+
run: |
53+
conda list -n "${{ env.TEST_ENV_NAME }}"
7454
7555
- name: Smoke test
7656
run: |
@@ -97,89 +77,76 @@ jobs:
9777
# disable scheduled workflow to be run in forks
9878
if: github.event.repository.fork == false
9979

100-
runs-on: ${{ matrix.runner }}
80+
runs-on: ${{ matrix.runner }}
10181
timeout-minutes: 60
10282
defaults:
10383
run:
10484
shell: cmd /C CALL {0}
10585
strategy:
10686
matrix:
107-
python: ['3.10', '3.11', '3.12', '3.13']
108-
python_spec: ['']
109-
include:
110-
- python: '3.14'
111-
python_spec: '3.14.* *_cp314'
112-
experimental: false
113-
runner: windows-latest
114-
- python: '3.14'
115-
python_spec: '3.14.* *_cp314t'
116-
experimental: false
117-
runner: windows-latest
118-
experimental: [false]
87+
# see the comment on the dependencies of test_linux
88+
dependencies: [conda-forge, intel]
89+
python_spec: ['3.10', '3.11', '3.12', '3.13', '3.14.* *_cp314', '3.14.* *_cp314t']
11990
runner: [windows-latest]
120-
121-
continue-on-error: ${{ matrix.experimental }}
12291
env:
12392
workdir: '${{ github.workspace }}'
12493

12594
steps:
12695
- name: Construct channels line
12796
shell: pwsh
12897
run: |
129-
echo "CHANNELS=-c ${{ env.INTEL_CHANNEL }} -c conda-forge --override-channels" >> $env:GITHUB_ENV
130-
131-
- name: Display channels line
132-
run: |
133-
echo "${{ env.CHANNELS }}"
98+
if ("${{ matrix.dependencies }}" -eq "intel") {
99+
echo "CHANNELS=-c dppy/label/dev -c ${{ env.INTEL_CHANNEL }} -c conda-forge --override-channels" >> $env:GITHUB_ENV
100+
} else {
101+
echo "CHANNELS=-c dppy/label/dev -c conda-forge --override-channels" >> $env:GITHUB_ENV
102+
}
134103
135104
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
136105
with:
137106
miniforge-version: latest
138107
channels: conda-forge
139108
conda-remove-defaults: true
140109
activate-environment: ${{ env.TEST_ENV_NAME }}
141-
python-version: ${{ matrix.python }}
142110

143111
- name: Install dpctl
144112
run: |
145-
SET "PYTHON_SPEC=${{ matrix.python_spec }}"
146-
IF "%PYTHON_SPEC%"=="" SET "PYTHON_SPEC=${{ matrix.python }}"
147-
conda install -n ${{ env.TEST_ENV_NAME }} -c dppy/label/dev ${{ env.CHANNELS }} dpctl pytest cython setuptools c-compiler cxx-compiler python="%PYTHON_SPEC%"
113+
conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.CHANNELS }} dpctl pytest cython setuptools c-compiler cxx-compiler python="${{ matrix.python_spec }}"
148114
149-
# intel-opencl-rt is not being installed when running conda install dpctl, so do it manually
150-
- name: Install intel-opencl-rt
115+
- name: Report content of test environment
151116
run: |
152-
conda install -n ${{ env.TEST_ENV_NAME }} -c dppy/label/dev ${{ env.CHANNELS }} intel-opencl-rt
117+
conda list -n ${{ env.TEST_ENV_NAME }}
153118
154-
- name: Configure Intel OpenCL CPU RT
119+
- name: Register the OpenCL CPU driver with the ICD loader
155120
shell: pwsh
156121
run: |
157-
$script_path="$env:CONDA_PREFIX\Scripts\set-intel-ocl-icd-registry.ps1"
158-
if (Test-Path $script_path) {
159-
&$script_path
122+
$vendors = "HKLM:\SOFTWARE\Khronos\OpenCL\Vendors"
123+
$script = "$env:CONDA_PREFIX\Scripts\set-intel-ocl-icd-registry.ps1"
124+
if (Test-Path $script) {
125+
& $script
160126
} else {
161-
Write-Warning "File $script_path was NOT found!"
127+
$drivers = @(Get-ChildItem -Recurse -ErrorAction SilentlyContinue -Filter intelocl64.dll -Path "$env:CONDA_PREFIX\Library\bin")
128+
if ($drivers.Count -eq 0) { throw "intel-opencl-rt installed no OpenCL CPU driver under $env:CONDA_PREFIX" }
129+
if (-not (Test-Path $vendors)) { New-Item -Path $vendors -Force | Out-Null }
130+
foreach ($driver in $drivers) {
131+
New-ItemProperty -Path $vendors -Name $driver.FullName -Value 0 -PropertyType DWord -Force | Out-Null
132+
}
162133
}
163-
# Check the variable assisting OpenCL CPU driver to find TBB DLLs which are not located where it expects them by default
164-
$cl_cfg="$env:CONDA_PREFIX\Library\bin\cl.cfg"
165-
Get-Content -Tail 5 -Path $cl_cfg
134+
Get-ItemProperty -Path $vendors
166135
167136
- name: Smoke test
168137
shell: cmd /C CALL {0}
169138
run: >-
170139
conda activate ${{ env.TEST_ENV_NAME }} && python -m dpctl -f
171140
172-
- name: Create empty temporary directory to run tests from
173-
shell: cmd /C CALL {0}
141+
- name: Create test temp dir
174142
# create temporary empty folder to runs tests from
175143
# https://github.com/pytest-dev/pytest/issues/11904
176-
run: >-
177-
mkdir "${{ env.workdir }}\test_tmp"
144+
run: mkdir "${{ github.workspace }}\test_tmp"
178145

179146
- name: Run tests
180147
shell: cmd /C CALL {0}
181148
env:
182149
SYCL_CACHE_PERSISTENT: 1
183-
working-directory: ${{ env.workdir }}\test_tmp
184-
run: >-
150+
working-directory: ${{ github.workspace }}\test_tmp
151+
run: |
185152
conda activate ${{ env.TEST_ENV_NAME }} && python -m pytest -v -s --pyargs ${{ env.MODULE_NAME }}

0 commit comments

Comments
 (0)