-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
162 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters