Skip to content

Commit 8feb558

Browse files
committed
Add versioneer
1 parent f56f819 commit 8feb558

File tree

33 files changed

+880
-127
lines changed

33 files changed

+880
-127
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: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ 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:
@@ -40,6 +41,10 @@ jobs:
4041

4142
runs-on: ${{matrix.os}}
4243

44+
defaults:
45+
run:
46+
shell: ${{ matrix.os == 'windows-latest' && 'cmd /C CALL {0}' || 'bash -l {0}' }}
47+
4348
steps:
4449
- name: Cancel Previous Runs
4550
uses: styfle/cancel-workflow-action@0.6.0
@@ -63,12 +68,10 @@ jobs:
6368
run-post: false
6469

6570
- name: Conda info
66-
shell: bash -el {0}
6771
run: |
6872
conda info
6973
conda list
7074
71-
7275
- name: Setup OpenCL CPU device
7376
if: runner.os == 'Windows'
7477
shell: pwsh
@@ -107,6 +110,7 @@ jobs:
107110
echo "CXX=${{matrix.cxx}}" >> "$GITHUB_ENV"
108111
echo "DPBENCH_SYCL=1" >> "$GITHUB_ENV"
109112
echo "WORKLOADS=$WORKLOADS,sycl" >> "$GITHUB_ENV"
113+
echo "SKBUILD_ARGS=-G Ninja" >> "$GITHUB_ENV"
110114
111115
- name: Build dpbench
112116
if: matrix.install == 'pip'
@@ -118,21 +122,18 @@ jobs:
118122
- name: Build dpbench
119123
if: matrix.install == 'setup.py'
120124
shell: bash -el {0}
121-
run: |
122-
python setup.py develop
125+
run: python setup.py develop $SKBUILD_ARGS
123126

124-
- name: Run benchmarks
127+
- name: Configure dpbench
125128
shell: bash -el {0}
126129
run: |
127130
export NUMBA_MLIR_GPU_RUNTIME=sycl
128131
# Turn off numba-dpex autofall back
129132
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
132133
133-
dpbench -i ${WORKLOADS} run -r2 --no-print-results || exit 1
134+
- name: Run benchmarks
135+
run: dpbench -i ${WORKLOADS} run -r2 --no-print-results || exit 1
134136

135137
- name: Generate report
136138
shell: bash -el {0}
137-
run: |
138-
dpbench -i ${WORKLOADS} report || exit 1
139+
run: dpbench -i ${WORKLOADS} report || exit 1

.github/workflows/conda-package.yml

Lines changed: 4 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,intel,conda-forge,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,6 +63,7 @@ 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

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+
set(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: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ 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

conda-recipe/build.sh

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,38 @@
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+
# declare -a ARGS=(install --single-version-externally-managed --record=record.txt)
2024

21-
# Build wheel package
22-
if [ "$CONDA_PY" == "36" ]; then
23-
WHEELS_BUILD_ARGS="-p manylinux1_x86_64"
24-
else
25-
WHEELS_BUILD_ARGS="-p manylinux2014_x86_64"
26-
fi
27-
if [ -n "${WHEELS_OUTPUT_FOLDER}" ]; then
28-
$PYTHON setup.py install bdist_wheel ${WHEELS_BUILD_ARGS} ${SKBUILD_ARGS}
29-
cp dist/dpnp*.whl ${WHEELS_OUTPUT_FOLDER}
30-
else
31-
$PYTHON setup.py install ${SKBUILD_ARGS}
32-
fi
25+
# if [[ -v WHEELS_OUTPUT_FOLDER ]]; then
26+
# ARGS+=(bdist_wheel -p manylinux2014_x86_64)
27+
# fi
28+
29+
# ARGS+=(-G Ninja -- -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icpx -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON)
30+
31+
# echo "${ARGS[*]}"
32+
33+
# $PYTHON setup.py ${ARGS[@]}
34+
$PYTHON -m pip install --no-index --no-deps --no-build-isolation . -v
35+
36+
# if [[ -v WHEELS_OUTPUT_FOLDER ]]; then
37+
# cp dist/numba_dpex*.whl "${WHEELS_OUTPUT_FOLDER[@]}"
38+
# fi

conda-recipe/meta.yaml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,32 @@
44

55
package:
66
name: dpbench
7-
version: 0.1
7+
version: {{ GIT_DESCRIBE_TAG }}
8+
89
source:
910
path: ..
1011

12+
build:
13+
number: {{ GIT_DESCRIBE_NUMBER }}
14+
script_env:
15+
- WHEELS_OUTPUT_FOLDER
16+
1117
requirements:
1218
build:
1319
- {{ compiler('cxx') }}
1420
- {{ compiler('dpcpp') }} >=2023.1 # [not osx]
1521
- sysroot_linux-64 >=2.28 # [linux]
1622
host:
23+
- versioneer
1724
- python
1825
- setuptools
19-
- cmake
20-
- ninja
21-
- wheel
26+
- cmake==3.26 # [win]
27+
- cmake # [not win]
28+
- ninja # [not win]
2229
- scikit-build
2330
- cython
2431
- pybind11
25-
# runtime requirements, cause conda tries to install after build
26-
# - tomli
27-
# - alembic
28-
# - sqlalchemy
29-
# - py-cpuinfo
30-
# - scipy
31-
# - scikit-learn
32-
# - pandas
32+
- versioneer
3333
- intel::numpy
3434
- numba
3535
- dpctl
@@ -40,6 +40,7 @@ requirements:
4040
- tomli
4141
- alembic
4242
- sqlalchemy
43+
- versioneer
4344
# - py-cpuinfo
4445
- scipy
4546
- scikit-learn
@@ -60,10 +61,10 @@ test:
6061
- numba-dpex
6162
- numba
6263
- numpy
63-
imports:
64-
- dpbench
65-
commands:
66-
- python -c "import dpbench"
64+
# imports:
65+
# - dpbench
66+
# commands:
67+
# - python -c "import dpbench"
6768

6869
about:
6970
home: https://github.com/IntelPython/dpbench

dpbench/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
# SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
22
#
33
# SPDX-License-Identifier: Apache-2.0
4+
5+
from . import _version
6+
7+
__version__ = _version.get_versions()["version"]

0 commit comments

Comments
 (0)