Skip to content

Commit ccfb262

Browse files
authored
Merge pull request #293 from IntelPython/fix/broken_build
Fix CI build
2 parents f56f819 + 370a168 commit ccfb262

File tree

21 files changed

+207
-146
lines changed

21 files changed

+207
-146
lines changed

.github/workflows/build_and_run.yml

Lines changed: 76 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,26 @@ on:
1111

1212
env:
1313
# sycl is not included. Add it manually if you need
14-
WORKLOADS: python,numpy,dpnp,numba_n,numba_np,numba_npr,numba_dpex_k,numba_dpex_n,numba_dpex_p,numba_mlir_k,numba_mlir_n,numba_mlir_p
14+
WORKLOADS: python,numpy,dpnp,numba_n,numba_np,numba_npr,numba_dpex_k,numba_dpex_n,numba_dpex_p
1515

1616
jobs:
17-
build_linux:
17+
build:
1818
name: Build and run
1919

2020
strategy:
2121
fail-fast: false
2222
matrix:
2323
os: ["ubuntu-latest", "windows-latest"]
24-
python: ["3.9", "3.10"]
24+
python: ["3.9", "3.10", "3.11"]
2525
sycl: ["sycl","no-sycl"]
2626
install: ["pip", "setup.py"]
27+
exclude:
28+
# setuptools<64 + scikit-build produce 'UNKOWN' package name for
29+
# python 3.11. Could not find exact reference for that issue.
30+
# latest setuptools is unable to create editable environment for pip
31+
- python: "3.11"
32+
install: "pip"
33+
sycl: "sycl"
2734
include:
2835
- sycl: sycl
2936
os: ubuntu-latest
@@ -40,6 +47,10 @@ jobs:
4047

4148
runs-on: ${{matrix.os}}
4249

50+
defaults:
51+
run:
52+
shell: ${{ matrix.os == 'windows-latest' && 'cmd /C CALL {0}' || 'bash -el {0}' }}
53+
4354
steps:
4455
- name: Cancel Previous Runs
4556
uses: styfle/[email protected]
@@ -51,6 +62,22 @@ jobs:
5162
with:
5263
fetch-depth: 0
5364

65+
# intel:numpy for python 3.11 is not upstreamed yet
66+
- name: Patch numpy dependency for Python 3.11
67+
if: matrix.python == '3.11'
68+
shell: bash -l {0}
69+
run: |
70+
find ./environments -type f | xargs sed -i 's/intel::numpy/numpy/'
71+
find ./environments -type f | xargs sed -i '/numba-mlir/d'
72+
find ./environments -type f | xargs sed -i 's/setuptools>=42,<64/setuptools/'
73+
74+
# TODO: remove once numba_mlir support python 3.11
75+
- name: Patch numpy dependency for Python 3.11
76+
if: matrix.python != '3.11'
77+
shell: bash -l {0}
78+
run: |
79+
echo "WORKLOADS=$WORKLOADS,numba_mlir_k,numba_mlir_n,numba_mlir_p" >> "$GITHUB_ENV"
80+
5481
- name: Setup miniconda
5582
uses: conda-incubator/setup-miniconda@v2
5683
with:
@@ -63,25 +90,10 @@ jobs:
6390
run-post: false
6491

6592
- name: Conda info
66-
shell: bash -el {0}
6793
run: |
6894
conda info
6995
conda list
7096
71-
72-
- name: Setup OpenCL CPU device
73-
if: runner.os == 'Windows'
74-
shell: pwsh
75-
run: |
76-
$script_path="$env:CONDA_PREFIX\Scripts\set-intel-ocl-icd-registry.ps1"
77-
&$script_path
78-
echo "OCL_ICD_FILENAMES=$env:CONDA_PREFIX\Library\lib\intelocl64.dll" >> $env:GITHUB_ENV
79-
echo "LIB=$env:CONDA_PREFIX\Library\lib;$env:CONDA_PREFIX\compiler\lib;$env:LIB" >> $env:GITHUB_ENV
80-
echo "INCLUDE=$env:CONDA_PREFIX\include;$env:INCLUDE" >> $env:GITHUB_ENV
81-
# Check the variable assisting OpenCL CPU driver to find TBB DLLs which are not located where it expects them by default
82-
$cl_cfg="$env:CONDA_PREFIX\Library\lib\cl.cfg"
83-
Get-Content -Tail 5 -Path $cl_cfg
84-
8597
- name: Configure Python
8698
if: runner.os == 'Windows'
8799
shell: pwsh
@@ -98,6 +110,20 @@ jobs:
98110
$env:FN="Windows-IntelLLVM.cmake"
99111
Copy-Item ".github\workflows\Windows-IntelLLVM_${env:PATCHED_CMAKE_VERSION}.cmake" "${env:PLATFORM_DIR}\${env:FN}"
100112
113+
# TODO: remove it once it is removed from hard dependency. Not presented
114+
# in conda-forge version, but there are some blockers before we could use
115+
# it.
116+
- name: Remove vs env
117+
if: runner.os == 'Windows' && matrix.sycl == 'sycl'
118+
run: |
119+
conda remove --force vs2017_win-64
120+
121+
- name: Configure MSBuild
122+
if: runner.os == 'Windows' && matrix.sycl == 'sycl'
123+
uses: ilammy/msvc-dev-cmd@v1
124+
with:
125+
toolset: 14.35
126+
101127
- name: Configure Sycl
102128
if: matrix.sycl == 'sycl'
103129
shell: bash -el {0}
@@ -108,31 +134,47 @@ jobs:
108134
echo "DPBENCH_SYCL=1" >> "$GITHUB_ENV"
109135
echo "WORKLOADS=$WORKLOADS,sycl" >> "$GITHUB_ENV"
110136
137+
- name: Configure compiler
138+
run: |
139+
echo "CMAKE_GENERATOR=Ninja" >> "$GITHUB_ENV"
140+
141+
- name: Configure OneAPI
142+
run: |
143+
echo "ONEAPI_DEVICE_SELECTOR=opencl:cpu" >> "$GITHUB_ENV"
144+
145+
- name: Populate conda environment paths
146+
shell: pwsh
147+
if: runner.os == 'Windows'
148+
run: |
149+
echo "LIB=$env:CONDA_PREFIX\Library\lib;$env:CONDA_PREFIX\compiler\lib;$env:LIB" >> $env:GITHUB_ENV
150+
echo "INCLUDE=$env:CONDA_PREFIX\include;$env:INCLUDE" >> $env:GITHUB_ENV
151+
111152
- name: Build dpbench
112153
if: matrix.install == 'pip'
113-
shell: bash -el {0}
114-
run: |
115-
pip install \
116-
--no-index --no-deps --no-build-isolation -e . -v
154+
run: pip install --no-index --no-deps --no-build-isolation -e . -v
117155

118156
- name: Build dpbench
119157
if: matrix.install == 'setup.py'
120-
shell: bash -el {0}
121-
run: |
122-
python setup.py develop
158+
run: python setup.py develop
123159

124-
- name: Run benchmarks
160+
- name: Configure dpbench
125161
shell: bash -el {0}
126162
run: |
127-
export NUMBA_MLIR_GPU_RUNTIME=sycl
163+
# TODO: do we need GPU in github acions?
164+
echo "NUMBA_MLIR_GPU_RUNTIME=sycl" >> "GITHUB_ENV"
128165
# Turn off numba-dpex autofall back
129-
export NUMBA_DPEX_FALLBACK_ON_CPU=0
130-
# Make sure numba-dpex is using native atomics in github CI
131-
export NUMBA_DPEX_ACTIVATE_ATOMICS_FP_NATIVE=1
166+
echo "NUMBA_DPEX_FALLBACK_ON_CPU=0" >> "GITHUB_ENV"
167+
168+
- name: Setup OpenCL CPU device
169+
if: runner.os == 'Windows'
170+
shell: pwsh
171+
run: |
172+
$script_path="$env:CONDA_PREFIX\Scripts\set-intel-ocl-icd-registry.ps1"
173+
&$script_path
174+
echo "OCL_ICD_FILENAMES=$env:CONDA_PREFIX\Library\lib\intelocl64.dll" >> $env:GITHUB_ENV
132175
133-
dpbench -i ${WORKLOADS} run -r2 --no-print-results || exit 1
176+
- name: Run benchmarks
177+
run: dpbench -i ${{env.WORKLOADS}} run -r2 --no-print-results || exit 1
134178

135179
- name: Generate report
136-
shell: bash -el {0}
137-
run: |
138-
dpbench -i ${WORKLOADS} report || exit 1
180+
run: dpbench -i ${{env.WORKLOADS}} report || exit 1

.github/workflows/conda-package.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env:
1414
PACKAGE_NAME: dpbench
1515
MODULE_NAME: dpbench
1616
# There is a separate action that removes defaults.
17-
CHANNELS: 'dppy/label/dev,conda-forge,intel'
17+
CHANNELS: 'dppy/label/dev,conda-forge,intel,nodefaults'
1818
VER_JSON_NAME: 'version.json'
1919
VER_SCRIPT1: "import json; f = open('version.json', 'r'); j = json.load(f); f.close(); "
2020
VER_SCRIPT2: "d = j['dpbench'][0]; print('='.join((d[s] for s in ('version', 'build'))))"
@@ -26,14 +26,14 @@ jobs:
2626
strategy:
2727
fail-fast: false
2828
matrix:
29-
python: ['3.9', '3.10']
29+
python: ['3.9', '3.10', '3.11']
3030
os: [ubuntu-latest, windows-latest]
3131

3232
runs-on: ${{ matrix.os }}
3333

3434
defaults:
3535
run:
36-
shell: bash -l {0}
36+
shell: ${{ matrix.os == 'windows-latest' && 'cmd /C CALL {0}' || 'bash -l {0}' }}
3737

3838
continue-on-error: false
3939

@@ -63,12 +63,19 @@ jobs:
6363
run: conda config --remove channels defaults
6464

6565
- name: Store conda paths as envs
66+
shell: bash -l {0}
6667
run: echo "CONDA_BLD=$CONDA_PREFIX/conda-bld/${{ runner.os == 'Linux' && 'linux' || 'win' }}-64/" | tr "\\" '/' >> $GITHUB_ENV
6768

6869
# boa is an extention to conda so we can use mamba resolver in conda build
6970
- name: Install conda-build
7071
run: mamba install boa
7172

73+
- name: Configure MSBuild
74+
if: runner.os == 'Windows'
75+
uses: microsoft/[email protected]
76+
with:
77+
vs-version: '14.35'
78+
7279
- name: Build conda package
7380
run: conda mambabuild --no-test --python ${{ matrix.python }} conda-recipe
7481

@@ -92,7 +99,7 @@ jobs:
9299
strategy:
93100
fail-fast: false
94101
matrix:
95-
python: ['3.9', '3.10']
102+
python: ['3.9', '3.10', '3.11']
96103
os: [ubuntu-20.04, ubuntu-latest, windows-latest]
97104
experimental: [false]
98105

@@ -168,7 +175,7 @@ jobs:
168175

169176
strategy:
170177
matrix:
171-
python: ['3.9', '3.10']
178+
python: ['3.9', '3.10', '3.11']
172179
os: [ubuntu-latest, windows-latest]
173180

174181
runs-on: ${{ matrix.os }}

CMakeLists.txt

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5-
cmake_minimum_required(VERSION 3.22 FATAL_ERROR)
5+
cmake_minimum_required(VERSION 3.22..3.27 FATAL_ERROR)
66

77
project(dpbench
88
LANGUAGES CXX
@@ -14,10 +14,28 @@ project(dpbench
1414
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
1515
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
1616

17+
find_package(Python 3.9 REQUIRED
18+
COMPONENTS Interpreter Development.Module)
19+
20+
if(NOT DEFINED DPCTL_LIBRARY_PATH)
21+
execute_process(
22+
COMMAND ${Python3_EXECUTABLE} -c "import dpctl,os; print(os.path.dirname(dpctl.__file__));"
23+
OUTPUT_VARIABLE DPCTL_LIBRARY_PATH
24+
RESULT_VARIABLE RET
25+
OUTPUT_STRIP_TRAILING_WHITESPACE
26+
)
27+
28+
if(RET EQUAL "1")
29+
message(FATAL_ERROR "Module \'dpctl\' not found.")
30+
endif()
31+
endif()
32+
33+
cmake_path(APPEND DPCTL_MODULE_PATH ${DPCTL_LIBRARY_PATH} resources cmake)
34+
list(APPEND CMAKE_MODULE_PATH ${DPCTL_MODULE_PATH})
35+
1736
find_package(pybind11 CONFIG REQUIRED)
18-
find_package(IntelDPCPP REQUIRED)
19-
find_package(PythonExtensions REQUIRED)
20-
find_package(Python3 COMPONENTS NumPy Development)
37+
find_package(IntelSYCL REQUIRED)
38+
find_package(Dpctl REQUIRED)
2139

2240
set(CMAKE_CXX_STANDARD 17)
2341
set(CMAKE_CXX_STANDARD_REQUIRED True)

conda-recipe/bld.bat

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ REM @TODO: remove the setting, once transition to build backend on Windows
1313
REM to cmake is complete.
1414
SET "SETUPTOOLS_USE_DISTUTILS=stdlib"
1515

16-
SET "DPBENCH_SYCL=1"
16+
set "DPBENCH_SYCL=1"
17+
set "CMAKE_GENERATOR=Ninja"
18+
set "CC=icx"
19+
set "CXX=icx"
1720

1821
"%PYTHON%" setup.py clean --all
1922

20-
set "SKBUILD_ARGS=-G Ninja -- -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icx"
21-
set "SKBUILD_ARGS=%SKBUILD_ARGS% -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
22-
2323
FOR %%V IN (14.0.0 14 15.0.0 15 16.0.0 16 17.0.0 17) DO @(
2424
REM set DIR_HINT if directory exists
2525
IF EXIST "%BUILD_PREFIX%\Library\lib\clang\%%V\" (
@@ -41,15 +41,17 @@ if EXIST "%PLATFORM_DIR%" (
4141
if errorlevel 1 exit 1
4242
)
4343

44+
@REM TODO: switch to pip build. Currently results in broken binary
45+
@REM %PYTHON% -m pip install --no-index --no-deps --no-build-isolation . -v
4446
if NOT "%WHEELS_OUTPUT_FOLDER%"=="" (
4547
rem Install and assemble wheel package from the build bits
46-
"%PYTHON%" setup.py install bdist_wheel %SKBUILD_ARGS%
48+
"%PYTHON%" setup.py install bdist_wheel --single-version-externally-managed --record=record.txt
4749
if errorlevel 1 exit 1
4850
copy dist\dpbench*.whl %WHEELS_OUTPUT_FOLDER%
4951
if errorlevel 1 exit 1
5052
) ELSE (
5153
rem Only install
52-
"%PYTHON%" setup.py install %SKBUILD_ARGS%
54+
"%PYTHON%" setup.py install --single-version-externally-managed --record=record.txt
5355
if errorlevel 1 exit 1
5456
)
5557

conda-recipe/build.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
1-
#!/bin/bash
1+
#!/bin/bash -x
22

33
# SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
44
#
55
# SPDX-License-Identifier: Apache-2.0
66

77
# Intel LLVM must cooperate with compiler and sysroot from conda
8+
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${BUILD_PREFIX}/lib"
9+
810
echo "--gcc-toolchain=${BUILD_PREFIX} --sysroot=${BUILD_PREFIX}/${HOST}/sysroot -target ${HOST}" > icpx_for_conda.cfg
911
export ICPXCFG="$(pwd)/icpx_for_conda.cfg"
1012
export ICXCFG="$(pwd)/icpx_for_conda.cfg"
1113

12-
export CMAKE_GENERATOR="Ninja"
1314
export DPBENCH_SYCL=1
15+
export CMAKE_GENERATOR="Ninja"
16+
export CC=icx
17+
export CXX=icpx
1418

1519
if [ -e "_skbuild" ]; then
1620
${PYTHON} setup.py clean --all
1721
fi
1822

19-
SKBUILD_ARGS="-- -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icpx -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
23+
# TODO: switch to pip build. Currently results in broken binary on Windows
24+
# $PYTHON -m pip install --no-index --no-deps --no-build-isolation . -v
2025

2126
# Build wheel package
2227
if [ "$CONDA_PY" == "36" ]; then
@@ -25,8 +30,8 @@ else
2530
WHEELS_BUILD_ARGS="-p manylinux2014_x86_64"
2631
fi
2732
if [ -n "${WHEELS_OUTPUT_FOLDER}" ]; then
28-
$PYTHON setup.py install bdist_wheel ${WHEELS_BUILD_ARGS} ${SKBUILD_ARGS}
33+
$PYTHON setup.py install bdist_wheel ${WHEELS_BUILD_ARGS} --single-version-externally-managed --record=record.txt
2934
cp dist/dpnp*.whl ${WHEELS_OUTPUT_FOLDER}
3035
else
31-
$PYTHON setup.py install ${SKBUILD_ARGS}
36+
$PYTHON setup.py install --single-version-externally-managed --record=record.txt
3237
fi

0 commit comments

Comments
 (0)