Skip to content

Commit 8177812

Browse files
committed
Add versioneer
1 parent f56f819 commit 8177812

File tree

33 files changed

+1018
-184
lines changed

33 files changed

+1018
-184
lines changed

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ exclude =
88
__pycache__
99
./dist
1010
./setup.py
11+
./dpbench/_version.py
1112
max-complexity = 10

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
dpbench/_version.py export-subst

.github/workflows/build_and_run.yml

Lines changed: 114 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,44 @@ 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,numba_mlir_k,numba_mlir_n,numba_mlir_p
15+
WORKLOADS: python,numpy,dpnp,numba_n,numba_np,numba_npr,numba_dpex_k,numba_dpex_n,numba_dpex_p
1516

1617
jobs:
17-
build_linux:
18+
build:
1819
name: Build and run
1920

2021
strategy:
2122
fail-fast: false
2223
matrix:
23-
os: ["ubuntu-latest", "windows-latest"]
24-
python: ["3.9", "3.10"]
25-
sycl: ["sycl","no-sycl"]
26-
install: ["pip", "setup.py"]
24+
# os: ["ubuntu-latest", "windows-latest"]
25+
# python: ["3.9", "3.10", "3.11"]
26+
# sycl: ["sycl","no-sycl"]
27+
# install: ["pip", "setup.py"]
28+
os: ["windows-latest"]
29+
python: ["3.9"]
30+
sycl: ["sycl"]
31+
install: ["setup.py"]
2732
include:
28-
- sycl: sycl
29-
os: ubuntu-latest
30-
cc: icx
31-
cxx: icpx
32-
environment: conda-linux-sycl.yml
33+
# - sycl: sycl
34+
# os: ubuntu-latest
35+
# cc: icx
36+
# cxx: icpx
37+
# environment: conda-linux-sycl.yml
3338
- sycl: sycl
3439
os: windows-latest
3540
cc: icx
3641
cxx: icx
3742
environment: conda-win-sycl.yml
38-
- sycl: no-sycl
39-
environment: conda.yml
43+
# - sycl: no-sycl
44+
# environment: conda.yml
4045

4146
runs-on: ${{matrix.os}}
4247

48+
defaults:
49+
run:
50+
shell: ${{ matrix.os == 'windows-latest' && 'cmd /C CALL {0}' || 'bash -l {0}' }}
51+
4352
steps:
4453
- name: Cancel Previous Runs
4554
uses: styfle/cancel-workflow-action@0.6.0
@@ -51,6 +60,14 @@ jobs:
5160
with:
5261
fetch-depth: 0
5362

63+
# intel:numpy for python 3.11 is not upstreamed yet
64+
# - name: Patch numpy dependency for Python 3.11
65+
# if: matrix.python == '3.11'
66+
# shell: bash -l {0}
67+
# run: |
68+
# find ./environments -type f | xargs sed -i 's/intel::numpy/numpy/'
69+
# find ./environments -type f | xargs sed -i '/numba-mlir/d'
70+
5471
- name: Setup miniconda
5572
uses: conda-incubator/setup-miniconda@v2
5673
with:
@@ -63,31 +80,17 @@ jobs:
6380
run-post: false
6481

6582
- name: Conda info
66-
shell: bash -el {0}
67-
run: |
68-
conda info
69-
conda list
83+
run: conda info
7084

85+
- name: Conda list
86+
run: conda list
7187

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-
85-
- name: Configure Python
86-
if: runner.os == 'Windows'
87-
shell: pwsh
88-
run: |
89-
# Set python encoding to support utf-8 symblos like ms.
90-
echo "PYTHONIOENCODING=utf-8" >> $env:GITHUB_ENV
88+
# - name: Configure Python
89+
# if: runner.os == 'Windows'
90+
# shell: pwsh
91+
# run: |
92+
# # Set python encoding to support utf-8 symblos like ms.
93+
# echo "PYTHONIOENCODING=utf-8" >> $env:GITHUB_ENV
9194

9295
- name: Patch IntelLLVM cmake
9396
if: runner.os == 'Windows' && matrix.sycl == 'sycl'
@@ -97,6 +100,18 @@ jobs:
97100
$env:PLATFORM_DIR="${env:CONDA_PREFIX}\Library\share\cmake-${env:PATCHED_CMAKE_VERSION}\Modules\Platform"
98101
$env:FN="Windows-IntelLLVM.cmake"
99102
Copy-Item ".github\workflows\Windows-IntelLLVM_${env:PATCHED_CMAKE_VERSION}.cmake" "${env:PLATFORM_DIR}\${env:FN}"
103+
104+
# - uses: ilammy/msvc-dev-cmd@v1
105+
# with:
106+
# toolset: 14.35
107+
108+
# - name: Set VC environment
109+
# if: runner.os == 'Windows' && matrix.sycl == 'sycl'
110+
# run: |
111+
# set PATH="%PATH%;C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\"
112+
# call vcvarsall.bat -vcvars_ver=14.35
113+
# set "LIB=%CONDA_PREFIX%\Library\lib;%CONDA_PREFIX%\compiler\lib;%LIB%"
114+
# set "INCLUDE=%CONDA_PREFIX%\include;%INCLUDE%"
100115

101116
- name: Configure Sycl
102117
if: matrix.sycl == 'sycl'
@@ -107,32 +122,84 @@ jobs:
107122
echo "CXX=${{matrix.cxx}}" >> "$GITHUB_ENV"
108123
echo "DPBENCH_SYCL=1" >> "$GITHUB_ENV"
109124
echo "WORKLOADS=$WORKLOADS,sycl" >> "$GITHUB_ENV"
125+
echo "CMAKE_GENERATOR=Ninja" >> "$GITHUB_ENV"
126+
127+
# - name: LIST Environment variables
128+
# run: SET
129+
130+
# - name: Configure MSBuild
131+
# if: runner.os == 'Windows'
132+
# uses: microsoft/setup-msbuild@v1.3
133+
# with:
134+
# # https://www.intel.com/content/www/us/en/developer/articles/reference-implementation/intel-compilers-compatibility-with-microsoft-visual-studio-and-xcode.html
135+
# # https://github.com/actions/runner-images/blob/main/images/win/Windows2022-Readme.md
136+
# vs-version: '[17.0,17.6.4]'
110137

111138
- name: Build dpbench
112139
if: matrix.install == 'pip'
113-
shell: bash -el {0}
114-
run: |
115-
pip install \
116-
--no-index --no-deps --no-build-isolation -e . -v
140+
run: pip install --no-index --no-deps --no-build-isolation -e . -v
141+
142+
# - uses: ilammy/msvc-dev-cmd@v1
143+
# with:
144+
# toolset: 14.35
145+
# set "INCLUDE=C:\Miniconda3\envs\build\include;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\ATLMFC\include;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\VS\include;C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.16.27023\include;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.16.27023\ATLMFC\include;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\VS\include;C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um;C:\Miniconda3\envs\build\Library\include"
146+
# set "LIB=C:\Miniconda3\envs\build\Library\lib;C:\Miniconda3\envs\build\compiler\lib;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\ATLMFC\lib\x64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\lib\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.16.27023\ATLMFC\lib\x64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.16.27023\lib\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x64;C:\Miniconda3\envs\build\Library\lib;C:\Miniconda3\envs\build\compiler\lib"
147+
# set "LIBPATH=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\ATLMFC\lib\x64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\lib\x64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\lib\x86\store\references;C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.22621.0;C:\Program Files (x86)\Windows Kits\10\References\10.0.22621.0;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.16.27023\ATLMFC\lib\x64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.16.27023\lib\x64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.16.27023\lib\x86\store\references;C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.22621.0;C:\Program Files (x86)\Windows Kits\10\References\10.0.22621.0;C:\Windows\Microsoft.NET\Framework64\v4.0.30319"
117148

118149
- name: Build dpbench
119150
if: matrix.install == 'setup.py'
120-
shell: bash -el {0}
121151
run: |
152+
CALL "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" -vcvars_ver=14.35
153+
set "LIB=%CONDA_PREFIX%\Library\lib;%CONDA_PREFIX%\compiler\lib;%LIB%"
154+
set "INCLUDE=%CONDA_PREFIX%\include;%INCLUDE%"
155+
set "CC=${{matrix.cc}}"
156+
set "CXX=${{matrix.cxx}}"
157+
set "DPBENCH_SYCL=1"
158+
set "CMAKE_GENERATOR=Ninja"
159+
set "CMAKE_ARGS=-DCMAKE_BUILD_TYPE=Release"
160+
set "CMAKE_GEN=Visual Studio 17 2022"
161+
set "CMAKE_GENERATOR_PLATFORM=x64"
162+
set "CMAKE_GENERATOR_TOOLSET=v141"
163+
set "CMAKE_PLAT=x64"
164+
set "CONDA_BUILD_CROSS_COMPILATION=0"
165+
set "DISTUTILS_USE_SDK=1"
166+
set "PY_VCRUNTIME_REDIST=\bin\vcruntime140.dll"
167+
set "RUNNER_NAME=GitHub Actions 3"
168+
set "STATS_PT=20"
169+
set "USE_NEW_CMAKE_GEN_SYNTAX=1"
170+
set "VCVARSBAT=64"
171+
set "VS_MAJOR=15"
172+
set "VS_VERSION=15.0"
173+
set "VS_YEAR=2017"
174+
set "WindowsSDKVer=10.0.22621.0"
175+
set "__VSCMD_PREINIT_VS170COMNTOOLS=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\"
176+
SET
122177
python setup.py develop
123178
124-
- name: Run benchmarks
179+
- name: Configure dpbench
125180
shell: bash -el {0}
126181
run: |
127182
export NUMBA_MLIR_GPU_RUNTIME=sycl
128183
# Turn off numba-dpex autofall back
129184
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
132185
133-
dpbench -i ${WORKLOADS} run -r2 --no-print-results || exit 1
186+
- name: Setup OpenCL CPU device
187+
if: runner.os == 'Windows'
188+
shell: pwsh
189+
run: |
190+
$script_path="$env:CONDA_PREFIX\Scripts\set-intel-ocl-icd-registry.ps1"
191+
&$script_path
192+
echo "OCL_ICD_FILENAMES=$env:CONDA_PREFIX\Library\lib\intelocl64.dll" >> $env:GITHUB_ENV
193+
echo "LIB=$env:CONDA_PREFIX\Library\lib;$env:CONDA_PREFIX\compiler\lib;$env:LIB" >> $env:GITHUB_ENV
194+
echo "INCLUDE=$env:CONDA_PREFIX\include;$env:INCLUDE" >> $env:GITHUB_ENV
195+
# Check the variable assisting OpenCL CPU driver to find TBB DLLs which are not located where it expects them by default
196+
$cl_cfg="$env:CONDA_PREFIX\Library\lib\cl.cfg"
197+
Get-Content -Tail 5 -Path $cl_cfg
198+
199+
- name: Run benchmarks
200+
shell: bash -el {0}
201+
run: dpbench -i ${WORKLOADS} run -r2 --no-print-results || exit 1
134202

135203
- name: Generate report
136204
shell: bash -el {0}
137-
run: |
138-
dpbench -i ${WORKLOADS} report || exit 1
205+
run: dpbench -i ${WORKLOADS} report || exit 1

.github/workflows/conda-package.yml

Lines changed: 8 additions & 3 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,17 @@ 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+
- uses: ilammy/msvc-dev-cmd@v1
74+
with:
75+
toolset: 14.35
76+
7277
- name: Build conda package
7378
run: conda mambabuild --no-test --python ${{ matrix.python }} conda-recipe
7479

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: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ REM of distutils (from late copies of CPython) that is enabled by default.
1111
REM It breaks build for Windows, so use distutils from "stdlib" as before.
1212
REM @TODO: remove the setting, once transition to build backend on Windows
1313
REM to cmake is complete.
14-
SET "SETUPTOOLS_USE_DISTUTILS=stdlib"
14+
@REM SET "SETUPTOOLS_USE_DISTUTILS=stdlib"
1515

1616
SET "DPBENCH_SYCL=1"
1717

18-
"%PYTHON%" setup.py clean --all
18+
@REM "%PYTHON%" setup.py clean --all
1919

2020
set "SKBUILD_ARGS=-G Ninja -- -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icx"
21+
@REM set "SKBUILD_ARGS=%SKBUILD_ARGS% -DMSVC_TOOLSET_VERSION=141"
2122
set "SKBUILD_ARGS=%SKBUILD_ARGS% -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
2223

2324
FOR %%V IN (14.0.0 14 15.0.0 15 16.0.0 16 17.0.0 17) DO @(
@@ -43,13 +44,13 @@ if EXIST "%PLATFORM_DIR%" (
4344

4445
if NOT "%WHEELS_OUTPUT_FOLDER%"=="" (
4546
rem Install and assemble wheel package from the build bits
46-
"%PYTHON%" setup.py install bdist_wheel %SKBUILD_ARGS%
47+
"%PYTHON%" setup.py install bdist_wheel --single-version-externally-managed --record=record.txt %SKBUILD_ARGS%
4748
if errorlevel 1 exit 1
4849
copy dist\dpbench*.whl %WHEELS_OUTPUT_FOLDER%
4950
if errorlevel 1 exit 1
5051
) ELSE (
5152
rem Only install
52-
"%PYTHON%" setup.py install %SKBUILD_ARGS%
53+
"%PYTHON%" setup.py install --single-version-externally-managed --record=record.txt %SKBUILD_ARGS%
5354
if errorlevel 1 exit 1
5455
)
5556

0 commit comments

Comments
 (0)