Skip to content

Commit

Permalink
Merge branch 'IntelPython:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
adarshyoga authored Dec 5, 2023
2 parents 3c31dd6 + 51b7e33 commit 9b8db03
Show file tree
Hide file tree
Showing 71 changed files with 1,915 additions and 299 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ exclude =
__pycache__
./dist
./setup.py
./dpbench/_version.py
max-complexity = 10
2 changes: 2 additions & 0 deletions dpbench/configs/__init__.py → .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0

dpbench/_version.py export-subst
121 changes: 79 additions & 42 deletions .github/workflows/build_and_run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,31 @@ name: build and run

on:
pull_request:
push:
branches: [main]

env:
# sycl is not included. Add it manually if you need
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
PYTHONIOENCODING: 'utf-8'

jobs:
build_linux:
build:
name: Build and run

strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-latest"]
python: ["3.9", "3.10"]
python: ["3.9", "3.10", "3.11"]
sycl: ["sycl","no-sycl"]
install: ["pip", "setup.py"]
precision: ["single", "double"]
exclude:
# setuptools<64 + scikit-build produce 'UNKOWN' package name for
# python 3.11. Could not find exact reference for that issue.
# latest setuptools is unable to create editable environment for pip
- python: "3.11"
install: "pip"
sycl: "sycl"
include:
- sycl: sycl
os: ubuntu-latest
Expand All @@ -40,6 +47,10 @@ jobs:

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

defaults:
run:
shell: ${{ matrix.os == 'windows-latest' && 'cmd /U /C CALL {0}' || 'bash -el {0}' }}

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
Expand All @@ -51,6 +62,15 @@ jobs:
with:
fetch-depth: 0

# intel:numpy for python 3.11 is not upstreamed yet
- name: Patch numpy dependency for Python 3.11
if: matrix.python == '3.11'
shell: bash -l {0}
run: |
find ./environments -type f | xargs sed -i 's/intel::numpy/numpy/'
find ./environments -type f | xargs sed -i '/numba-mlir/d'
find ./environments -type f | xargs sed -i 's/setuptools>=42,<64/setuptools/'
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
Expand All @@ -63,32 +83,10 @@ jobs:
run-post: false

- name: Conda info
shell: bash -el {0}
run: |
conda info
conda list
- name: Setup OpenCL CPU device
if: runner.os == 'Windows'
shell: pwsh
run: |
$script_path="$env:CONDA_PREFIX\Scripts\set-intel-ocl-icd-registry.ps1"
&$script_path
echo "OCL_ICD_FILENAMES=$env:CONDA_PREFIX\Library\lib\intelocl64.dll" >> $env:GITHUB_ENV
echo "LIB=$env:CONDA_PREFIX\Library\lib;$env:CONDA_PREFIX\compiler\lib;$env:LIB" >> $env:GITHUB_ENV
echo "INCLUDE=$env:CONDA_PREFIX\include;$env:INCLUDE" >> $env:GITHUB_ENV
# Check the variable assisting OpenCL CPU driver to find TBB DLLs which are not located where it expects them by default
$cl_cfg="$env:CONDA_PREFIX\Library\lib\cl.cfg"
Get-Content -Tail 5 -Path $cl_cfg
- name: Configure Python
if: runner.os == 'Windows'
shell: pwsh
run: |
# Set python encoding to support utf-8 symblos like ms.
echo "PYTHONIOENCODING=utf-8" >> $env:GITHUB_ENV
- name: Patch IntelLLVM cmake
if: runner.os == 'Windows' && matrix.sycl == 'sycl'
shell: pwsh
Expand All @@ -98,6 +96,27 @@ jobs:
$env:FN="Windows-IntelLLVM.cmake"
Copy-Item ".github\workflows\Windows-IntelLLVM_${env:PATCHED_CMAKE_VERSION}.cmake" "${env:PLATFORM_DIR}\${env:FN}"
# TODO: remove it once it is removed from hard dependency. Not presented
# in conda-forge version, but there are some blockers before we could use
# it.
- name: Remove vs env
if: runner.os == 'Windows' && matrix.sycl == 'sycl'
run: |
conda remove --force vs2017_win-64
# Github pre-installed versions:
# https://github.com/actions/runner-images/blob/main/images/win/Windows2022-Readme.md
# Intel's compatible versions:
# https://www.intel.com/content/www/us/en/developer/articles/reference-implementation/intel-compilers-compatibility-with-microsoft-visual-studio-and-xcode.html
# TODO: do we want to enforce installing version that we want?
# Is it as easy as `choco install msvc==14.35`?
- name: Configure MSBuild
if: runner.os == 'Windows' && matrix.sycl == 'sycl'
# TODO: uses: microsoft/setup-msbuild ?
uses: ilammy/msvc-dev-cmd@v1
with:
toolset: 14.2

- name: Configure Sycl
if: matrix.sycl == 'sycl'
shell: bash -el {0}
Expand All @@ -108,31 +127,49 @@ jobs:
echo "DPBENCH_SYCL=1" >> "$GITHUB_ENV"
echo "WORKLOADS=$WORKLOADS,sycl" >> "$GITHUB_ENV"
- name: Build dpbench
if: matrix.install == 'pip'
- name: Configure compiler
shell: bash -el {0}
run: |
pip install \
--no-index --no-deps --no-build-isolation -e . -v
echo "CMAKE_GENERATOR=Ninja" >> "$GITHUB_ENV"
- name: Configure OneAPI
run: |
echo "ONEAPI_DEVICE_SELECTOR=opencl:cpu" >> "$GITHUB_ENV"
- name: Populate conda environment paths
shell: pwsh
if: runner.os == 'Windows'
run: |
echo "LIB=$env:CONDA_PREFIX\Library\lib;$env:CONDA_PREFIX\compiler\lib;$env:LIB" >> $env:GITHUB_ENV
echo "INCLUDE=$env:CONDA_PREFIX\include;$env:INCLUDE" >> $env:GITHUB_ENV
- name: Build dpbench
if: matrix.install == 'pip'
run: pip install --no-index --no-deps --no-build-isolation -e . -v

- name: Build dpbench
if: matrix.install == 'setup.py'
shell: bash -el {0}
run: |
python setup.py develop
run: python setup.py develop

- name: Run benchmarks
- name: Configure dpbench
shell: bash -el {0}
run: |
export NUMBA_MLIR_GPU_RUNTIME=sycl
# Turn off numba-dpex autofall back
export NUMBA_DPEX_FALLBACK_ON_CPU=0
# Make sure numba-dpex is using native atomics in github CI
export NUMBA_DPEX_ACTIVATE_ATOMICS_FP_NATIVE=1
echo "NUMBA_DPEX_FALLBACK_ON_CPU=0" >> "GITHUB_ENV"
dpbench -i ${WORKLOADS} run -r2 --no-print-results || exit 1
- name: Setup OpenCL CPU device
if: runner.os == 'Windows'
shell: pwsh
run: |
$script_path="$env:CONDA_PREFIX\Scripts\set-intel-ocl-icd-registry.ps1"
&$script_path
echo "OCL_ICD_FILENAMES=$env:CONDA_PREFIX\Library\lib\intelocl64.dll" >> $env:GITHUB_ENV
- name: Run benchmarks
run: dpbench -i ${{env.WORKLOADS}} run -r2 --no-print-results --precision=${{matrix.precision}} || exit 1

- name: Run rodinia benchmarks
run: dpbench -i ${{env.WORKLOADS}} --last-run run -r2 --no-print-results --rodinia --no-dpbench --precision=${{matrix.precision}} || exit 1

- name: Generate report
shell: bash -el {0}
run: |
dpbench -i ${WORKLOADS} report || exit 1
run: dpbench -i ${{env.WORKLOADS}} report || exit 1
Loading

0 comments on commit 9b8db03

Please sign in to comment.