Skip to content

Commit 6594b30

Browse files
committed
Merge branch 'main' into gold/2021
2 parents 8e5d465 + 127cc7f commit 6594b30

File tree

144 files changed

+6337
-3272
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+6337
-3272
lines changed

.github/workflows/black.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
# This workflow contains a single job called "black"
1515
black:
1616
# The type of runner that the job will run on
17-
runs-on: ubuntu-latest
17+
runs-on: ubuntu-20.04
1818

1919
# Steps represent a sequence of tasks that will be executed as part of the job
2020
steps:
@@ -27,3 +27,4 @@ jobs:
2727
- uses: psf/black@stable
2828
with:
2929
args: ". --check"
30+
version: "23.1.0"

.github/workflows/conda-package.yml

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ env:
1616

1717
jobs:
1818
build_linux:
19-
runs-on: ubuntu-latest
19+
runs-on: ubuntu-20.04
2020

2121
strategy:
2222
matrix:
23-
python: ["3.8", "3.9"]
23+
python: ["3.8", "3.9", "3.10"]
2424

2525
steps:
2626
- uses: actions/checkout@v3
@@ -46,18 +46,12 @@ jobs:
4646

4747
strategy:
4848
matrix:
49-
python: ["3.8", "3.9"]
50-
integration_channels: [""]
49+
python: ["3.8", "3.9", "3.10"]
5150
experimental: [false]
5251
artifact_name: [""]
53-
include:
54-
- python: "3.8"
55-
integration_channels: -c dppy/label/dev
56-
artifact_name: -c dppy_label_dev
57-
experimental: true
5852
continue-on-error: ${{ matrix.experimental }}
5953
env:
60-
CHANNELS: ${{ matrix.integration_channels }} -c intel -c defaults -c numba -c numba/label/dev -c dppy/label/dev --override-channels
54+
CHANNELS: -c dppy/label/dev -c intel -c defaults -c numba -c numba/label/dev --override-channels
6155
conda-bld: C:\Miniconda\conda-bld\win-64\
6256

6357
steps:
@@ -92,11 +86,11 @@ jobs:
9286

9387
test_linux:
9488
needs: build_linux
95-
runs-on: ubuntu-latest
89+
runs-on: ubuntu-20.04
9690

9791
strategy:
9892
matrix:
99-
python: ["3.8", "3.9"]
93+
python: ["3.8", "3.9", "3.10"]
10094
numba: ["0.56"]
10195
dpnp: ["0.11"]
10296

@@ -143,28 +137,34 @@ jobs:
143137
# echo "libintelocl.so" | tee /etc/OpenCL/vendors/intel-cpu.icd
144138
export OCL_ICD_FILENAMES=libintelocl.so
145139
python -m pytest -q -ra --disable-warnings --pyargs $MODULE_NAME -vv
140+
- name: Run examples
141+
run: |
142+
ls
143+
pwd
144+
cd ./numba-dpex/numba_dpex/examples/
145+
source $CONDA/etc/profile.d/conda.sh
146+
conda activate numba_dpex_env
147+
# echo "libintelocl.so" | tee /etc/OpenCL/vendors/intel-cpu.icd
148+
export OCL_ICD_FILENAMES=libintelocl.so
149+
for script in $(find . \( -not -name "_*" -not "vector_sum2D.py" -not -name "vectorize.py" -not -name "scan.py" -and -name "*.py" \))
150+
do
151+
echo "Executing ${script}"
152+
python ${script} || exit 1
153+
done
146154
147155
test_windows:
148156
needs: build_windows
149157
runs-on: windows-latest
150158

151159
strategy:
152160
matrix:
153-
python: ["3.8", "3.9"]
161+
python: ["3.8", "3.9", "3.10"]
154162
integration_channels: [""]
155-
experimental: [true] # packages are not available on -c intel yet
156-
artifact_name: [""]
157-
dependencies: [""]
158-
include:
159-
- python: "3.8"
160-
integration_channels: -c dppy/label/dev
161-
artifact_name: -c dppy_label_dev
162-
experimental: true # current stable
163-
dependencies: ""
163+
experimental: [false] # packages are not available on -c intel yet
164164
continue-on-error: ${{ matrix.experimental }}
165165
env:
166166
# conda-forge: llvm-spirv 11 not on intel channel yet
167-
CHANNELS: ${{ matrix.integration_channels }} -c dppy/label/dev -c intel -c defaults -c numba -c numba/label/dev -c conda-forge --override-channels
167+
CHANNELS: -c dppy/label/dev -c intel -c defaults -c numba -c numba/label/dev --override-channels
168168

169169
steps:
170170
- name: Create dir for numba-dpex repo
@@ -175,15 +175,16 @@ jobs:
175175
path: dpex-repo
176176
fetch-depth: 0
177177
- name: Download artifact
178-
uses: actions/download-artifact@v2
178+
uses: actions/download-artifact@v3
179179
with:
180-
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} ${{ matrix.artifact_name }}
180+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
181181
- uses: conda-incubator/setup-miniconda@v2
182182
with:
183-
auto-activate-base: true
184-
activate-environment: ""
185-
- name: Install conda-build
186-
run: conda install conda-build
183+
use-only-tar-bz2: true
184+
auto-update-conda: true
185+
conda-build-version: '*'
186+
miniconda-version: 'latest'
187+
activate-environment: "numba_dpex_wintest"
187188
- name: Create conda channel
188189
run: |
189190
mkdir -p $env:GITHUB_WORKSPACE/channel/win-64
@@ -196,7 +197,7 @@ jobs:
196197
- name: Cache conda packages
197198
uses: actions/cache@v2
198199
env:
199-
CACHE_NUMBER: 0 # Increase to reset cache
200+
CACHE_NUMBER: 1 # Increase to reset cache
200201
with:
201202
path: /home/runner/conda_pkgs_dir
202203
key:
@@ -256,10 +257,10 @@ jobs:
256257
upload_linux:
257258
needs: test_linux
258259
if: ${{github.ref == 'refs/heads/main' || (startsWith(github.ref, 'refs/heads/release') == true)}}
259-
runs-on: ubuntu-latest
260+
runs-on: ubuntu-20.04
260261
strategy:
261262
matrix:
262-
python: ["3.8", "3.9"]
263+
python: ["3.8", "3.9", "3.10"]
263264
steps:
264265
- name: Download artifact
265266
uses: actions/download-artifact@v2
@@ -287,7 +288,7 @@ jobs:
287288
runs-on: windows-latest
288289
strategy:
289290
matrix:
290-
python: ["3.8", "3.9"]
291+
python: ["3.8", "3.9", "3.10"]
291292
steps:
292293
- name: Download artifact
293294
uses: actions/download-artifact@v2

.github/workflows/license.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
- name: Check license
2222
run: |
2323
export PATH=${PATH}:`go env GOPATH`/bin
24-
addlicense -check -l apache -c "Intel Corporation" numba_dpex/**/*.py numba_dpex/*.py setup.py
24+
addlicense -check -l apache -c "Intel Corporation" -ignore numba_dpex/_version.py numba_dpex/**/*.py numba_dpex/*.py setup.py

.github/workflows/numba.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
build:
13-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-20.04
1414

1515
env:
1616
ID: ${{ github.event.inputs.numba_pr }}

.github/workflows/pre-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
pre-commit:
10-
runs-on: ubuntu-latest
10+
runs-on: ubuntu-20.04
1111
steps:
1212
- uses: actions/checkout@v2
1313
- uses: actions/setup-python@v2

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ docs/_build/
1818
docs/gh-pages/
1919
dist/
2020
.idea/
21-
.vscode/settings.json
21+
.vscode/
2222
.mypy_cache/
2323
.ipynb_checkpoints/
2424
__pycache__/

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repos:
1313
- id: end-of-file-fixer
1414
- id: trailing-whitespace
1515
- repo: https://github.com/psf/black
16-
rev: 22.10.0
16+
rev: 23.1.0
1717
hooks:
1818
- id: black
1919
exclude: "versioneer.py|numba_dpex/_version.py"
@@ -23,7 +23,7 @@ repos:
2323
- id: blacken-docs
2424
additional_dependencies: [black==22.10]
2525
- repo: https://github.com/pycqa/isort
26-
rev: 5.10.1
26+
rev: 5.12.0
2727
hooks:
2828
- id: isort
2929
name: isort (python)

.vscode/extensions.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

conda-recipe/meta.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ requirements:
1919
- setuptools
2020
- cython
2121
- numba 0.56*
22-
- dpctl >=0.13.0
22+
- dpctl >=0.14*
2323
- dpnp >=0.11*
2424
- wheel
2525
run:
2626
- python
2727
- numba >=0.56*
28-
- dpctl >=0.13.0
28+
- dpctl >=0.14*
2929
- spirv-tools
3030
- llvm-spirv 11.*
3131
- dpnp >=0.11*

docs/developer_guides/caching.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.. _caching:
2+
3+
Caching Mechanism in Numba-dpex
4+
================================
5+
6+
Caching is done by saving the compiled kernel code, the ELF object of the executable code. By using the kernel code, cached kernels have minimal overhead because no compilation is needed.
7+
8+
Unlike Numba, we do not perform file-based caching, instead we use an Least Recently Used (LRU) caching mechanism. However when a kernel needs to be evicted, we utilize numba's file-based caching mechanism described `here <https://numba.pydata.org/numba-doc/latest/developer/caching.html>`_.
9+
10+
Algorithm
11+
==========
12+
13+
The caching mechanism for Numba-dpex works as follows: The cache is an LRU cache backed by an ordered dictionary mapped onto a doubly linked list. The tail of the list contains the most recently used (MRU) kernel and the head of the list contains the least recently used (LRU) kernel. The list has a fixed size. If a new kernel arrives to be cached and if the size is already on the maximum limit, the algorithm evicts the LRU kernel to make room for the MRU kernel. The evicted item will be serialized and pickled into a file using Numba's caching mechanism.
14+
15+
Everytime whenever a kernel needs to be retrieved from the cache, the mechanism will look for the kernel in the cache and will be loaded if it's already present. However, if the program is seeking for a kernel that has been evicted, the algorithm will load it from the file and enqueue in the cache.
16+
17+
Settings
18+
========
19+
20+
Therefore, we employ similar environment variables as used in Numba, i.e. ``NUMBA_CACHE_DIR`` etc. However we add three more environment variables to control the caching mechanism.
21+
22+
- In order to specify cache capacity, one can use ``NUMBA_DPEX_CACHE_SIZE``. By default, it's set to 10.
23+
- ``NUMBA_DPEX_ENABLE_CACHE`` can be used to enable/disable the caching mechanism. By default it's enabled, i.e. set to 1.
24+
- In order to enable the debugging messages related to caching, one can set ``NUMBA_DPEX_DEBUG_CACHE`` to 1. All environment variables are defined in :file:`numba_dpex/config.py`.

0 commit comments

Comments
 (0)