Skip to content

Merge master into gold/2021 #1266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2d43024
Use full() function from dpctl.tensor module instead of DPNP backend …
npolina4 Nov 2, 2022
30ae8d6
Added tests for dpnp.full() function that were previously skipped
npolina4 Nov 2, 2022
59a278e
Changed dtype checking for fill_value for full function.
npolina4 Nov 7, 2022
b837ada
Fix dtype for full() function
npolina4 Nov 8, 2022
c4809ee
Use main channel instead of defaults (#1241)
antonwolfy Nov 22, 2022
5a710bb
Use icpx instead of dpcpp due to deprecation (#1226)
antonwolfy Nov 28, 2022
737a253
Added array support for fill_value for full() and full_like() functio…
npolina4 Nov 28, 2022
38b7ac6
Merge branch 'master' into use_dpctl_full
npolina4 Nov 28, 2022
e6a72e9
Fixed merging for previous commit
npolina4 Nov 28, 2022
909e7a1
Fixed input shape for full() function. It cannot be None
npolina4 Nov 28, 2022
d5aaa6f
Build with python 3.10 in public CI (#1244)
antonwolfy Nov 29, 2022
0876932
Improve outer method (#1239)
antonwolfy Dec 1, 2022
b2aa36b
Update README.md
samaid Dec 3, 2022
f3c149d
Added tests for full() and full_like() functions
npolina4 Dec 7, 2022
de3e5ad
Merge branch 'master' into use_dpctl_full
npolina4 Dec 7, 2022
2b18781
Minor fix in tests for full() and full_like() functions
npolina4 Dec 7, 2022
eeab8dd
Conda packages must be built with Ubuntu 20.04 (#1252)
antonwolfy Dec 8, 2022
2d0d115
Fixed docstring for full() function
npolina4 Dec 8, 2022
3e0e79c
Merge branch 'master' into use_dpctl_full
oleksandr-pavlyk Dec 9, 2022
e5b088c
Merge pull request #1218 from IntelPython/use_dpctl_full
oleksandr-pavlyk Dec 9, 2022
2b8788d
Add asnumpy() method for dpnp_array (#1248)
antonwolfy Dec 13, 2022
f87f311
Use zeros() function from dpctl.tensor. (#1255)
npolina4 Dec 15, 2022
3a31b82
Map dtype to device in array creation functions (#1263)
antonwolfy Dec 21, 2022
51938b0
Update descriptions of functions in RandomState class (#1264)
antonwolfy Dec 21, 2022
d5ccdfd
dpnp.multiply() doesn't work properly with a scalar (#1254)
antonwolfy Dec 21, 2022
91b6880
Update build instruction in README (#1247)
antonwolfy Dec 22, 2022
6c6a690
Use ones() function from dpctl.tensor. (#1256)
npolina4 Dec 23, 2022
f125604
Use empty() function from dpctl.tensor module for empty_like() functi…
npolina4 Dec 23, 2022
62fa3ab
Add property flags to dpnp_array (#1265)
npolina4 Dec 24, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
- name: Build library
run: |
python setup.py build_clib
CC=dpcpp python setup.py build_ext --inplace
CC=icpx python setup.py build_ext --inplace
python setup.py develop

- name: Build docs
Expand Down
154 changes: 38 additions & 116 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
env:
PACKAGE_NAME: dpnp
MODULE_NAME: dpnp
CHANNELS: '-c dppy/label/dev -c intel -c defaults --override-channels'
CHANNELS: '-c dppy/label/dev -c intel -c main --override-channels'
TEST_SCOPE: >-
test_arraycreation.py
test_dparray.py
Expand All @@ -24,80 +24,24 @@ env:
VER_SCRIPT2: "d = j['dpnp'][0]; print('='.join((d[s] for s in ('version', 'build'))))"

jobs:
build_linux:
runs-on: ubuntu-latest

defaults:
run:
shell: bash -l {0}
build:
name: Build ['${{ matrix.os }}', python='${{ matrix.python }}']

strategy:
matrix:
python: ['3.8', '3.9']
os: [ubuntu-20.04, windows-latest]
include:
- python: '3.10'
os: ubuntu-20.04

env:
conda-pkgs: '/home/runner/conda_pkgs_dir/'

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Checkout DPNP repo
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Setup miniconda
uses: conda-incubator/[email protected]
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
miniconda-version: 'latest'
activate-environment: 'build'
use-only-tar-bz2: true

- name: Store conda paths as envs
run: echo "CONDA_BLD=$CONDA_PREFIX/conda-bld/linux-64/" >> $GITHUB_ENV

- name: Install conda-build
run: conda install conda-build

- name: Cache conda packages
uses: actions/[email protected]
env:
CACHE_NUMBER: 1 # Increase to reset cache
with:
path: ${{ env.conda-pkgs }}
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
restore-keys: |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-

- name: Build conda package
run: conda build --no-test --python ${{ matrix.python }} ${{ env.CHANNELS }} conda-recipe

- name: Upload artifact
uses: actions/[email protected]
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.tar.bz2

build_windows:
runs-on: windows-latest
runs-on: ${{ matrix.os }}

defaults:
run:
shell: cmd /C CALL {0}

strategy:
matrix:
python: ['3.8', '3.9']
shell: ${{ matrix.os == 'windows-latest' && 'cmd /C CALL {0}' || 'bash -l {0}' }}

env:
conda-pkgs: 'C:\Users\runneradmin\conda_pkgs_dir\'
continue-on-error: false

steps:
- name: Cancel Previous Runs
Expand All @@ -119,26 +63,31 @@ jobs:
activate-environment: 'build'
use-only-tar-bz2: true

- name: Store conda paths as envs
- if: matrix.os == 'ubuntu-20.04'
name: Store conda paths as envs on Linux
run: echo "CONDA_BLD=$CONDA_PREFIX/conda-bld/linux-64/" >> $GITHUB_ENV

- if: matrix.os == 'windows-latest'
name: Store conda paths as envs on Win
run: |
@echo on
(echo CONDA_BLD=%CONDA_PREFIX%\conda-bld\win-64\) >> %GITHUB_ENV%

- name: Install conda-build
run: conda install conda-build

- name: Cache conda packages
uses: actions/[email protected]
env:
CACHE_NUMBER: 1 # Increase to reset cache
with:
path: ${{ env.conda-pkgs }}
path: ${{ env.CONDA_PKGS_DIR }}
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
restore-keys: |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-

- name: Install conda-build
run: conda install conda-build

- name: Build conda package
run: conda build --no-test --python ${{ matrix.python }} ${{ env.CHANNELS }} conda-recipe

Expand All @@ -149,9 +98,11 @@ jobs:
path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.tar.bz2

test_linux:
needs: build_linux
name: Test ['${{ matrix.os }}', python='${{ matrix.python }}']

runs-on: ubuntu-latest
needs: build

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

defaults:
run:
Expand All @@ -160,6 +111,8 @@ jobs:
strategy:
matrix:
python: ['3.8', '3.9']
os: [ubuntu-20.04, ubuntu-latest]

experimental: [false]

continue-on-error: ${{ matrix.experimental }}
Expand Down Expand Up @@ -250,7 +203,9 @@ jobs:
working-directory: ${{ env.tests-path }}

test_windows:
needs: build_windows
name: Test ['windows-latest', python='${{ matrix.python }}']

needs: build

runs-on: windows-latest

Expand Down Expand Up @@ -422,61 +377,28 @@ jobs:
python -m pytest -q -ra --disable-warnings -vv ${{ env.TEST_SCOPE }}
working-directory: ${{ env.tests-path }}

upload_linux:
needs: test_linux

if: |
(github.repository == 'IntelPython/dpnp') &&
(github.ref == 'refs/heads/master' || (startsWith(github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains(github.ref, 'refs/tags/'))

runs-on: ubuntu-latest
upload:
name: Upload ['${{ matrix.os }}', python='${{ matrix.python }}']

defaults:
run:
shell: bash -l {0}
needs: [test_linux, test_windows]

strategy:
matrix:
python: ['3.8', '3.9']
os: [ubuntu-20.04, windows-latest]

steps:
- name: Download artifact
uses: actions/[email protected]
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}

- name: Setup miniconda
uses: conda-incubator/[email protected]
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
miniconda-version: 'latest'
activate-environment: 'upload'
runs-on: ${{ matrix.os }}

- name: Install anaconda-client
run: conda install anaconda-client

- name: Upload
run: anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.tar.bz2
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
defaults:
run:
shell: ${{ matrix.os == 'windows-latest' && 'cmd /C CALL {0}' || 'bash -l {0}' }}

upload_windows:
needs: test_windows
continue-on-error: false

if: |
(github.repository == 'IntelPython/dpnp') &&
(github.ref == 'refs/heads/master' || (startsWith(github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains(github.ref, 'refs/tags/'))

runs-on: windows-latest

defaults:
run:
shell: cmd /C CALL {0}

strategy:
matrix:
python: ['3.8', '3.9']
steps:
- name: Download artifact
uses: actions/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions 0.build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ python setup.py clean
python setup.py build_clib

# inplace build
CC=dpcpp python setup.py build_ext --inplace
CC=icpx python setup.py build_ext --inplace

# development build. Root privileges needed
# python setup.py develop

echo
echo =========example3==============
dpcpp -g -fPIC dpnp/backend/examples/example3.cpp -Idpnp -Idpnp/backend/include -Ldpnp -Wl,-rpath='$ORIGIN'/dpnp -ldpnp_backend_c -o example3
icpx -fsycl -g -fPIC dpnp/backend/examples/example3.cpp -Idpnp -Idpnp/backend/include -Ldpnp -Wl,-rpath='$ORIGIN'/dpnp -ldpnp_backend_c -o example3
# LD_DEBUG=libs,bindings,symbols ./example3
./example3

Expand Down
38 changes: 5 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,26 @@
[![Build Status](https://dev.azure.com/IntelPython/dpnp/_apis/build/status/IntelPython.dpnp?branchName=master)](https://dev.azure.com/IntelPython/dpnp/_build/latest?definitionId=6&branchName=master)
[![Pre-commit](https://github.com/IntelPython/dpnp/actions/workflows/pre-commit.yml/badge.svg?branch=master&event=push)](https://github.com/IntelPython/dpnp/actions/workflows/pre-commit.yml)
[![Conda package](https://github.com/IntelPython/dpnp/actions/workflows/conda-package.yml/badge.svg?branch=master&event=push)](https://github.com/IntelPython/dpnp/actions/workflows/conda-package.yml)
[![codecov](https://codecov.io/gh/IntelPython/dpnp/branch/master/graph/badge.svg)](https://codecov.io/gh/IntelPython/dpnp)
[![Build Sphinx](https://github.com/IntelPython/dpnp/workflows/Build%20Sphinx/badge.svg)](https://intelpython.github.io/dpnp)

# DPNP: NumPy Drop-In Replacement for Intel(R) XPU
# DPNP - Data Parallel Extension for NumPy*
[API coverage summary](https://intelpython.github.io/dpnp/reference/comparison.html#summary)

[Full documentation](https://intelpython.github.io/dpnp/)

[DPNP C++ backend documentation](https://intelpython.github.io/dpnp/backend_doc/)

The project contains:
- Python interface with NumPy-like API
- C++ library with SYCL based kernels

## How to run
By default main CPU SYCL queue is used. To use Intel GPU please use:
```bash
DPNP_QUEUE_GPU=1 python examples/example1.py
```

## Build from source:
Ensure you have the following prerequisite packages installed:
Ensure you have the following prerequisite packages installed:

- `mkl-devel-dpcpp`
- `dpcpp_linux-64` or `dpcpp_win-64` (depending on your OS)
- `onedpl-devel`
- `tbb-devel`
- `dpctl`

In addition, you need oneDPL installed on your system. There are two ways to do
so:

1. Install oneAPI and run the oneDPL activation script. E.g., on linux:

```bash
source /opt/intel/oneapi/dpl/latest/env/vars.sh
```

2. Clone dpl from https://github.com/oneapi-src/oneDPL and set the `DPL_ROOT`
environment variable to point to the `include` directory in the repository.

E.g., on linux

```bash
git clone https://github.com/oneapi-src/oneDPL
export DPL_ROOT=$(pwd)/oneDPL/include
```

After these steps, `dpnp` can be built in debug mode as follows:


```bash
git clone https://github.com/IntelPython/dpnp
cd dpnp
Expand Down
4 changes: 2 additions & 2 deletions dpnp/backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ string(CONCAT COMMON_LINK_FLAGS
"-fsycl-device-code-split=per_kernel "
)
if(UNIX)
set(CMAKE_CXX_COMPILER "dpcpp")
set(CMAKE_CXX_COMPILER "icpx")
# add_compile_options(-fPIC)
elseif(WIN32)
set(CMAKE_CXX_COMPILER "dpcpp")
set(CMAKE_CXX_COMPILER "icx")
# set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=lld-link")
# set(CMAKE_LINKER "lld-link")
# include (Platform/Windows-Clang)
Expand Down
6 changes: 0 additions & 6 deletions dpnp/backend/include/dpnp_iface_fptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,7 @@ enum class DPNPFuncName : size_t
DPNP_FN_FMOD, /**< Used in numpy.fmod() impl */
DPNP_FN_FMOD_EXT, /**< Used in numpy.fmod() impl, requires extra parameters */
DPNP_FN_FULL, /**< Used in numpy.full() impl */
DPNP_FN_FULL_EXT, /**< Used in numpy.full() impl, requires extra parameters */
DPNP_FN_FULL_LIKE, /**< Used in numpy.full_like() impl */
DPNP_FN_FULL_LIKE_EXT, /**< Used in numpy.full_like() impl, requires extra parameters */
DPNP_FN_HYPOT, /**< Used in numpy.hypot() impl */
DPNP_FN_HYPOT_EXT, /**< Used in numpy.hypot() impl, requires extra parameters */
DPNP_FN_IDENTITY, /**< Used in numpy.identity() impl */
Expand Down Expand Up @@ -230,9 +228,7 @@ enum class DPNPFuncName : size_t
DPNP_FN_NONZERO, /**< Used in numpy.nonzero() impl */
DPNP_FN_NONZERO_EXT, /**< Used in numpy.nonzero() impl, requires extra parameters */
DPNP_FN_ONES, /**< Used in numpy.ones() impl */
DPNP_FN_ONES_EXT, /**< Used in numpy.ones() impl, requires extra parameters */
DPNP_FN_ONES_LIKE, /**< Used in numpy.ones_like() impl */
DPNP_FN_ONES_LIKE_EXT, /**< Used in numpy.ones_like() impl, requires extra parameters */
DPNP_FN_PARTITION, /**< Used in numpy.partition() impl */
DPNP_FN_PARTITION_EXT, /**< Used in numpy.partition() impl, requires extra parameters */
DPNP_FN_PLACE, /**< Used in numpy.place() impl */
Expand Down Expand Up @@ -375,9 +371,7 @@ enum class DPNPFuncName : size_t
DPNP_FN_VAR, /**< Used in numpy.var() impl */
DPNP_FN_VAR_EXT, /**< Used in numpy.var() impl, requires extra parameters */
DPNP_FN_ZEROS, /**< Used in numpy.zeros() impl */
DPNP_FN_ZEROS_EXT, /**< Used in numpy.zeros() impl, requires extra parameters */
DPNP_FN_ZEROS_LIKE, /**< Used in numpy.zeros_like() impl */
DPNP_FN_ZEROS_LIKE_EXT, /**< Used in numpy.zeros_like() impl, requires extra parameters */
DPNP_FN_LAST, /**< The latest element of the enumeration */
};

Expand Down
Loading