Skip to content

Rename dppl to dppy #42

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 7 commits into from
Dec 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
*.pyc
*.o
*.so
*.dylib
*.pyd
*.pdb
*.egg-info
*.sw[po]
*.out
*.ll
.coverage
.nfs*
tags
MANIFEST

build/
docs/_build/
docs/gh-pages/
dist/
htmlcov/
.idea/
.vscode/
.mypy_cache/
.ipynb_checkpoints/
__pycache__/

docs/source/developer/autogen*
6 changes: 3 additions & 3 deletions HowTo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ are listed below with the help of sample code snippets. In this release we have
the implementation of the OAK approach described in MS138 in section 4.3.2. The
new decorator is described below.

To access the features driver module have to be imported from numba_dppy.dppl_driver
To access the features driver module have to be imported from numba_dppy.dppy_driver

New Decorator
=============
Expand Down Expand Up @@ -61,7 +61,7 @@ Primitive types are passed by value to the kernel, currently supported are int,
Math Kernels
============

This release has support for math kernels. See numba_dppy/tests/dppl/test_math_functions.py
This release has support for math kernels. See numba_dppy/tests/dppy/test_math_functions.py
for more details.


Expand Down Expand Up @@ -170,6 +170,6 @@ Testing

All examples can be found in numba_dppy/examples/

All tests can be found in numba_dppy/tests/dppl and can be triggered by the following command:
All tests can be found in numba_dppy/tests/dppy and can be triggered by the following command:

``python -m numba.runtests numba_dppy.tests``
4 changes: 2 additions & 2 deletions numba_dppy/CHANGE_LOG
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NUMBA Version 0.48.0 + DPPL Version 0.3.0 (June 29, 2020)
NUMBA Version 0.48.0 + DPPY Version 0.3.0 (June 29, 2020)
--------------------------------------------------------

This release includes:

* Caching of dppl.kernels which will improve performance.
* Caching of dppy.kernels which will improve performance.
* Addition of support for Intel Advisor which will help in profiling applications.
52 changes: 26 additions & 26 deletions numba_dppy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@


Extensions to Numba for Intel GPUs introduce two new features into Numba:
a. A new backend that has a new decorator called @dppl.kernel that
a. A new backend that has a new decorator called @dppy.kernel that
exposes an explicit kernel programming interface similar to the
existing Numba GPU code-generation backends. The @dppl.kernel
existing Numba GPU code-generation backends. The @dppy.kernel
decorator currently implements a subset of OpenCL’s API through
Numba’s intrinsic functions.

Expand All @@ -20,48 +20,48 @@
Explicit Kernel Prgoramming with new Docorators:


@dppl.kernel
@dppy.kernel

The @dppl.kernel decorator can be used with or without extra arguments.
The @dppy.kernel decorator can be used with or without extra arguments.
Optionally, users can pass the signature of the arguments to the
decorator. When a signature is provided to the DK decorator the version
of the OpenCL kernel generated gets specialized for that type signature.

---------------------------------------------------------------------------
@dppl.kernel
@dppy.kernel
def data_parallel_sum(a, b, c):
i = dppl.get_global_id(0)
i = dppy.get_global_id(0)
c[i] = a[i] + b[i]
---------------------------------------------------------------------------

To invoke the above function users will need to provide a
global size (OpenCL) which is the size of a (same as b and c) and a
local size (dppl.DEFAULT_LOCAL_SIZE if user don't want to specify).
local size (dppy.DEFAULT_LOCAL_SIZE if user don't want to specify).
Example shown below:

---------------------------------------------------------------------------
data_parallel_sum[len(a), dppl.DEFAULT_LOCAL_SIZE](dA, dB, dC)
data_parallel_sum[len(a), dppy.DEFAULT_LOCAL_SIZE](dA, dB, dC)
---------------------------------------------------------------------------


@dppl.func
@dppy.func

The @dppl.func decorator is the other decorator provided in the explicit
The @dppy.func decorator is the other decorator provided in the explicit
kernel programming model. This decorator allows users to write “device”
functions that can be invoked from inside DK functions but cannot be invoked
from the host. The decorator also supports type specialization as with the
DK decorator. Functions decorated with @dppl.func will also be JIT compiled
and inlined into the OpenCL Program containing the @dppl.kernel function
calling it. A @dppl.func will not be launched as an OpenCL kernel.
DK decorator. Functions decorated with @dppy.func will also be JIT compiled
and inlined into the OpenCL Program containing the @dppy.kernel function
calling it. A @dppy.func will not be launched as an OpenCL kernel.

---------------------------------------------------------------------------
@dppl.func
@dppy.func
def bar(a):
return a*a

@dppl.kernel
@dppy.kernel
def foo(in, out):
i = dppl.get_global_id(0)
i = dppy.get_global_id(0)
out[i] = bar(in[i])
---------------------------------------------------------------------------

Expand All @@ -71,13 +71,13 @@ def foo(in, out):
The following table has the list of intrinsic functions that can be directly
used inside a DK function. All the functions are equivalent to the similarly
named OpenCL function. Wherever there is an implementation difference
between the Numba-PyDPPL version and the OpenCL version, the difference is
between the Numba-DPPY version and the OpenCL version, the difference is
explained in table. Note that these functions cannot be used anywhere else
outside of a DK function in a Numba application. Readers are referred to the
OpenCL API specs to review the functionality of each function.

+----------------------+----------------------------+----------------------+
| Numba-DPPL intrinsic | Equivalent OpenCL function | Notes |
| Numba-DPPY intrinsic | Equivalent OpenCL function | Notes |
+----------------------+----------------------------+----------------------+
| get_global_id | get_global_id | |
+----------------------+----------------------------+----------------------+
Expand Down Expand Up @@ -121,7 +121,7 @@ def foo(in, out):
|print |print(varargs) |The print function is a |
| | |subset of the OpenCL |
| | |printf function. The |
| | |Numba-DPPL version of |
| | |Numba-DPPY version of |
| | |print supports only int, |
| | |string, and float |
| | |arguments. |
Expand Down Expand Up @@ -160,16 +160,16 @@ def foo(in, out):



Complete Example using @dppl.kernel:
Complete Example using @dppy.kernel:

---------------------------------------------------------------------------
import numpy as np
import numba_dppy, numba_dppy as dppl
import numba_dppy, numba_dppy as dppy
import dpctl

@dppl.kernel
@dppy.kernel
def data_parallel_sum(a, b, c):
i = dppl.get_global_id(0)
i = dppy.get_global_id(0)
c[i] = a[i] + b[i]

def driver(device_env, a, b, c, global_size):
Expand All @@ -181,7 +181,7 @@ def driver(device_env, a, b, c, global_size):
print("before : ", dA._ndarray)
print("before : ", dB._ndarray)
print("before : ", dC._ndarray)
data_parallel_sum[global_size, dppl.DEFAULT_LOCAL_SIZE](dA, dB, dC)
data_parallel_sum[global_size, dppy.DEFAULT_LOCAL_SIZE](dA, dB, dC)
device_env.copy_array_from_device(dC)
print("after : ", dC._ndarray)

Expand Down Expand Up @@ -509,11 +509,11 @@ def main():
if dppy_present:
from .device_init import *
else:
raise ImportError("Importing dppl failed")
raise ImportError("Importing numba-dppy failed")

def test(*args, **kwargs):
if not dppy_present and not is_available():
dppl_error()
dppy_error()

return numba.testing.test("numba_dppy.tests", *args, **kwargs)

Expand Down
Loading