Skip to content

Commit

Permalink
Merge branch 'main' into gold/2021
Browse files Browse the repository at this point in the history
  • Loading branch information
PokhodenkoSA committed Oct 28, 2021
2 parents d02059e + addaf4b commit 92bb6b7
Show file tree
Hide file tree
Showing 14 changed files with 162 additions and 36 deletions.
31 changes: 17 additions & 14 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Conda package

on: push
on:
push:
branches:
tags:

env:
PACKAGE_NAME: numba-dppy
Expand All @@ -12,7 +15,7 @@ jobs:

strategy:
matrix:
python: ["3.8"]
python: [3.8, 3.9]
integration_channels: [""]
experimental: [true] # packages are not available on -c intel yet
artifact_name: [""]
Expand Down Expand Up @@ -68,7 +71,7 @@ jobs:

strategy:
matrix:
python: ["3.8"]
python: [3.8, 3.9]
integration_channels: [""]
experimental: [true] # packages are not available on -c intel yet
artifact_name: [""]
Expand Down Expand Up @@ -118,13 +121,15 @@ jobs:

strategy:
matrix:
python: ["3.8"]
python: [3.8, 3.9]
numba: [0.54, 0.55]
integration_channels: [""]
experimental: [true] # packages are not available on -c intel yet
artifact_name: [""]
dependencies: [""]
include:
- python: "3.8"
numba: 0.54
integration_channels: -c dppy/label/dev
artifact_name: -c dppy_label_dev
experimental: false # current stable
Expand Down Expand Up @@ -171,7 +176,7 @@ jobs:
- name: Install numba-dppy
run: |
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
conda install $PACKAGE_NAME pytest python=${{ matrix.python }} ${{ matrix.dependencies }} $CHANNELS
conda install $PACKAGE_NAME pytest python=${{ matrix.python }} numba=${{ matrix.numba }} ${{ matrix.dependencies }} $CHANNELS
# Test installed packages
conda list
- name: Run tests
Expand All @@ -186,7 +191,7 @@ jobs:

strategy:
matrix:
python: ["3.8"]
python: [3.8, 3.9]
integration_channels: [""]
experimental: [true] # packages are not available on -c intel yet
artifact_name: [""]
Expand Down Expand Up @@ -248,17 +253,16 @@ jobs:
upload_linux:
needs: test_linux
if: ${{ github.ref == 'refs/heads/main' }}
if: ${{ github.ref }} == 'refs/heads/main' || ${{ github.ref }} == 'refs/heads/release*'
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8"]
python: [3.8, 3.9]
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
# `-c dppy_label_dev`: packages not published on `-c intel` yet
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} -c dppy_label_dev
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}

- name: Install anaconda-client
run: conda install anaconda-client
Expand All @@ -274,17 +278,16 @@ jobs:
upload_windows:
needs: test_windows
if: ${{ github.ref == 'refs/heads/main' }}
if: ${{ github.ref }} == 'refs/heads/main' || ${{ github.ref }} == 'refs/heads/release*'
runs-on: windows-latest
strategy:
matrix:
python: [3.8]
python: [3.8, 3.9]
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
# `-c dppy_label_dev`: packages not published on `-c intel` yet
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} -c dppy_label_dev
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}

- uses: conda-incubator/setup-miniconda@v2
with:
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/numba.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Test w/ Numba PRs

on:
workflow_dispatch:
inputs:
numba_pr:
description: Numba PR
required: true
default: 7177

jobs:
build:
runs-on: ubuntu-latest

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

steps:
- name: Checkout numba-dppy
uses: actions/checkout@v2
with: {path: numba-dppy}

- name: Checkout numba
uses: actions/checkout@v2
with:
repository: numba/numba
path: numba

# See https://docs.github.com/en/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally
- name: Checkout numba PR
run: |
cd numba
git fetch origin pull/${{env.ID}}/head:pr${{env.ID}}
git checkout pr${{env.ID}}
- name: Add conda to system path
shell: bash
run: echo $CONDA/bin >> $GITHUB_PATH

- name: Configure environment
run: |
cd numba-dppy
conda env update -n base -f environment.yml --prune
conda remove -n base numba --force
conda list
which python
- name: Install numba
run: |
cd numba
git log -1
python setup.py develop
- name: Install numba-dppy
run: |
cd numba-dppy
git log -1
python setup.py develop
- name: Test installation
run: |
conda list
# echo "libintelocl.so" | tee /etc/OpenCL/vendors/intel-cpu.icd
export OCL_ICD_FILENAMES=libintelocl.so
python -c "import numba; print(numba.__file__)"
python -c "import numba_dppy; print(numba_dppy.__file__)"
- name: Test
run: |
# echo "libintelocl.so" | tee /etc/OpenCL/vendors/intel-cpu.icd
export OCL_ICD_FILENAMES=libintelocl.so
pytest -q -ra --disable-warnings --pyargs numba_dppy -vv
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ https://intelpython.github.io/dpnp/

## Dependencies

* numba 0.54.*
* dpctl 0.10.*
* dpnp 0.8.* (optional)
* numba 0.54.* or 0.55.*
* dpctl 0.11.*
* dpnp 0.9.* (optional)
* llvm-spirv 11.* (SPIRV generation from LLVM IR)
* spirv-tools
* packaging
Expand Down
12 changes: 6 additions & 6 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ requirements:
- python
- setuptools
- cython
- numba 0.54*
- dpctl >=0.10*
- dpnp >=0.8* # [linux]
- numba 0.54*|0.55*
- dpctl 0.10*|0.11*
- dpnp 0.8*|0.9* # [linux]
- wheel
run:
- python
- numba 0.54*
- dpctl >=0.10*
- numba 0.54*|0.55*
- dpctl 0.10*|0.11*
- spirv-tools
- llvm-spirv 11.*
- dpnp >=0.8* # [linux]
- dpnp 0.8*|0.9* # [linux]
- packaging

test:
Expand Down
4 changes: 0 additions & 4 deletions docs/user_guides/debugging/debugging_environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ Configure debugging environment
conda create numba-dppy-dev numba-dppy
conda activate numba-dppy-dev
.. note::

Debugging features were tested with the following packages: ``numba-dppy=0.14``, ``dpctl=0.8``, ``numba=0.53``.

3) Activate NEO drivers (optional).

If you want to use the local NEO driver, activate the variables for it. See the :ref:`NEO-driver`.
Expand Down
2 changes: 1 addition & 1 deletion docs/user_guides/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Installation

Numba-dppy depends on following components:

* numba 0.54.* (`Numba`_)
* numba 0.54.* or 0.55.* (`Numba`_)
* dpctl 0.9.* (`Intel Python dpctl`_)
* dpnp >=0.6.* (optional, `Intel Python DPNP`_)
* `llvm-spirv`_ (SPIRV generation from LLVM IR)
Expand Down
6 changes: 3 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ dependencies:
- gxx_linux-64
- dpcpp_linux-64
- cython
- numba 0.54*
- dpctl 0.10*
- dpnp 0.8*
- numba 0.55*
- dpctl 0.11*
- dpnp 0.9*
- spirv-tools
# - llvm-spirv 11.*
- packaging
Expand Down
1 change: 1 addition & 0 deletions numba_dppy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ def main():

import numba.testing

from numba_dppy.interop import asarray
from numba_dppy.retarget import offload_to_sycl_device

from . import config
Expand Down
41 changes: 41 additions & 0 deletions numba_dppy/interop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Support for interoperability."""

import dpctl.tensor as dpt


def asarray(container):
"""Convert container supported by interoperability to numba-dppy container.
Currently used dpctl.tensor.asarray().
"""
try:
return dpt.asarray(container)
except:
pass

# Workaround for dpnp_array if dpctl asarray() does not support it.
try:
from dpnp.dpnp_array import dpnp_array

if isinstance(container, dpnp_array) and hasattr(container, "_array_obj"):
import warnings

warnings.warn("asarray() uses internals from dpnp.")
return container._array_obj
except:
pass

raise NotImplementedError("dpctl asarray() does not support " + type(container))
6 changes: 3 additions & 3 deletions numba_dppy/tests/integration/test_dpnp_interop.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def data_parallel_sum(a, b, c):
global_size = 1021

with dppy.offload_to_sycl_device(offload_device):
a = dpnp.arange(global_size, dtype=dtype)
b = dpnp.arange(global_size, dtype=dtype)
c = dpnp.ones_like(a)
a = dppy.asarray(dpnp.arange(global_size, dtype=dtype))
b = dppy.asarray(dpnp.arange(global_size, dtype=dtype))
c = dppy.asarray(dpnp.ones_like(a))

data_parallel_sum[global_size, dppy.DEFAULT_LOCAL_SIZE](a, b, c)
6 changes: 6 additions & 0 deletions numba_dppy/tests/njit_tests/dpnp/test_numpy_linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def eig_input(request):
return symm_a


@pytest.mark.skip(reason="Freeze...")
def test_eig(filter_str, eig_input, capfd):
if skip_test(filter_str):
pytest.skip()
Expand Down Expand Up @@ -152,6 +153,7 @@ def dot_name(request):
return request.param


@pytest.mark.skip(reason="Freeze...")
def test_dot(filter_str, dot_name, dot_input, dtype, capfd):
if skip_test(filter_str):
pytest.skip()
Expand Down Expand Up @@ -180,6 +182,7 @@ def test_dot(filter_str, dot_name, dot_input, dtype, capfd):
assert np.allclose(actual, expected)


@pytest.mark.skip(reason="Freeze...")
def test_matmul(filter_str, dtype, capfd):
if skip_test(filter_str):
pytest.skip()
Expand Down Expand Up @@ -256,6 +259,7 @@ def test_det(filter_str, det_input, dtype, capfd):
assert np.allclose(actual, expected)


@pytest.mark.skip(reason="Freeze...")
def test_multi_dot(filter_str, capfd):
if skip_test(filter_str):
pytest.skip()
Expand Down Expand Up @@ -303,6 +307,7 @@ def matrix_power_input(request):
return request.param


@pytest.mark.skip(reason="Freeze...")
def test_matrix_power(filter_str, matrix_power_input, power, dtype, capfd):
if skip_test(filter_str):
pytest.skip()
Expand Down Expand Up @@ -350,6 +355,7 @@ def test_matrix_rank(filter_str, matrix_rank_input, capfd):
assert np.allclose(actual, expected)


@pytest.mark.skip(reason="Freeze...")
def test_eigvals(filter_str, eig_input, capfd):
if skip_test(filter_str):
pytest.skip()
Expand Down
1 change: 1 addition & 0 deletions numba_dppy/tests/njit_tests/dpnp/test_numpy_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def unary_op(request):
return wrapper_function("a", f"np.{request.param}(a)", globals()), request.param


@pytest.mark.skip(reason="Freeze...")
def test_unary_ops(filter_str, unary_op, input_arrays, get_shape, capfd):
if skip_test(filter_str):
pytest.skip()
Expand Down
4 changes: 3 additions & 1 deletion numba_dppy/tests/test_debug_dppy_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import pytest

import numba_dppy
from numba_dppy import config

pexpect = pytest.importorskip("pexpect")

Expand All @@ -44,7 +45,8 @@ def spawn(self):
env["NUMBA_OPT"] = "0"

self.child = pexpect.spawn("gdb-oneapi -q python", env=env, encoding="utf-8")
# self.child.logfile = sys.stdout
if config.DEBUG:
self.child.logfile = sys.stdout

def setup_gdb(self):
self.child.expect("(gdb)", timeout=5)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def spirv_compile():
packages = find_packages(include=["numba_dppy", "numba_dppy.*"])
build_requires = ["cython"]
install_requires = [
"numba >={},<{}".format("0.54.0", "0.55"),
"numba >={},<{}".format("0.54.0", "0.56"),
"dpctl",
"packaging",
]
Expand Down

0 comments on commit 92bb6b7

Please sign in to comment.