Skip to content
This repository was archived by the owner on Jul 13, 2026. It is now read-only.

Add support for dpctl.dparray. - #50

Merged
PokhodenkoSA merged 45 commits into
mainfrom
spokhode/dparray
Jan 13, 2021
Merged

Add support for dpctl.dparray.#50
PokhodenkoSA merged 45 commits into
mainfrom
spokhode/dparray

Conversation

@PokhodenkoSA

@PokhodenkoSAPokhodenkoSA commented Dec 4, 2020

Copy link
Copy Markdown
Contributor

Moved code from IntelPython/numba#116.

  • Update with main
  • Transform unit tests test_usmarray.py
  • Need to get rid of relative paths in setup.py

@DrTodd13DrTodd13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks correct at first glance. I didn't look to see why the tests were failing but that would be expected even if this is using the dpctl dparray branch since we removed the section of code there that looks for Numba meminfo objects. Once this is merged then I will add the code here to monkey-patch the meminfo objects with sycl_usm_array_interface.

DrTodd13and others added 11 commits December 9, 2020 15:41
Co-authored-by: etotmeni <elena.totmenina@intel.com>
* Del dppl dir in tests
* Del unused var
Co-authored-by: etotmeni <elena.totmenina@intel.com>
Co-authored-by: etotmeni <elena.totmenina@intel.com>
Co-authored-by: Diptorup Deb <diptorup.deb@intel.com>
…Numba-dppy pipeline (#52)
* Sum example
* Moved from infer_type, lower_builtin to overload
* Added two level module name functions
* Remove cython generated file
* Module name fix for moving to new extension
* Incomplete linalg.eig implementation
* Updted all dppl to dppy and moved rewrite_numpy_function_pass to it's own file
* Import module at correct locations
* Added comments
* Added test and updated comments
* Revert unneeded changes
* Update Eigen implementation
* Remove eig implementation
* Add checking equivalent IR
Co-authored-by: reazul.hoque <reazul.hoque@intel.com>
Comment threadnumba_dppy/numpy_usm_shared.py Outdated
todo_getattr = []

# For all Numpy identifiers that have been registered for typing in Numba...
# this registry contains functions, getattrs, setattrs, casts and constants...need to do them all? FIX FIX FIX

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please convert this comment into a ticket.

@PokhodenkoSA

Copy link
Copy Markdown
ContributorAuthor

This code was moved to dpctl.dptensor.

Is it relate to some line?

@PokhodenkoSA

PokhodenkoSA commented Dec 11, 2020

Copy link
Copy Markdown
ContributorAuthor

This PR requires IntelPython/dpctl#214.

…ass and the Numba integration were in the same file. I changed those to explicitly refer to the usmarray module in dpctl.
…n numpy_usm_shared in dpctl.dptensor. This fixes the ndindex issue.
@PokhodenkoSA

PokhodenkoSA commented Dec 15, 2020

Copy link
Copy Markdown
ContributorAuthor

Assertion error in last case:

print("------------------- Testing Numba usmarray.T")
sys.stdout.flush()
dp4 = f12(dp3)
print("dp4:", dp4, type(dp4))
assert isinstance(dp4, usmarray.ndarray)
assert usmarray.has_array_interface(dp4)
del dp3
del dp4
------------------- Testing Numba usmarray.T
...
<class 'numpy.ndarray'>
Traceback (most recent call last):
File "numba_dppy/tests/test_usmarray.py", line 220, in <module>
assert isinstance(dp4, usmarray.ndarray)
AssertionError

Fixed.

etotmeniand others added 3 commits December 15, 2020 06:47
* Split tests for usmarray in separate unittest test cases
* Remove prints and use unittest assertions
* Move functions to tests
* Give names to functions
* Add expectedFailure for failed tests
* Clean code
Comment threadsetup.py Outdated
@PokhodenkoSA

PokhodenkoSA commented Dec 15, 2020

Copy link
Copy Markdown
ContributorAuthor

3 tests failed and marked as expected failure:

  • test_numba_usmarray_mul_add - strange, it passed if runs not in batch
  • test_numba_usmarray_constructor_from_numpy_ndarray - was commented previously
  • test_numba_usmarray_T - did not work as I started

@DrTodd13

Copy link
Copy Markdown
Contributor

I would like to merge it. @DrTodd13 what is not ready yet?

I would like to merge it before #135 - black formatter. However I can do it in any order.

There are some parts of the USM array attribute class that use bound_function that don't seem to work with the current configuration and I'm not sure why. I say we merge what we currently have while I investigate this issue I described and we can have another PR for that.

Comment threadnumba_dppy/numpy_usm_shared.py Outdated
Comment threadnumba_dppy/numpy_usm_shared.py Outdated
Comment threadnumba_dppy/numpy_usm_shared.py Outdated
Comment threadnumba_dppy/numpy_usm_shared.py Outdated
Comment threadnumba_dppy/numpy_usm_shared.py Outdated
Comment threadnumba_dppy/numpy_usm_shared.py Outdated
Comment threadnumba_dppy/tests/test_usmarray.py Outdated
@PokhodenkoSA

PokhodenkoSA commented Dec 23, 2020

Copy link
Copy Markdown
ContributorAuthor

@DrTodd13
I have find interesting tests dependency and possibly an issue. Have you any idea about it?

importnumbaimportnumpyimportdpctl.dptensor.numpy_usm_sharedasusmarray@numba.njit()defnumba_mul(a, b): # a is usmarray, b is numpyreturna*b@numba.njit()defnumba_mul_add(a):
returna*2.0+13assertisinstance(numba_mul(usmarray.ones(10), numpy.ones(10)), usmarray.ndarray) # 1assertisinstance(numba_mul_add(numpy.ones(10)), numpy.ndarray) # 2assertisinstance(numba_mul_add(usmarray.ones(10)), usmarray.ndarray) # 3 - error
Traceback (most recent call last):
File "./usmarray_and_ndarray.py", line 27, in<module>
assert isinstance(numba_mul_add(usmarray.ones(10)), usmarray.ndarray)
AssertionError

If any of 1 or 2 are commented then 3 passed.
If change order of 1 or 2 then 3 passed.

Comment threadnumba_dppy/tests/test_usmarray.py Outdated
Comment threadnumba_dppy/numpy_usm_shared.py Outdated
@PokhodenkoSA

Copy link
Copy Markdown
ContributorAuthor

@DrTodd13
I have made formatting for the code with black. If you will face merge conflicts do following:

pip install black
black .

@PokhodenkoSAPokhodenkoSA mentioned this pull request Jan 11, 2021
@PokhodenkoSA

PokhodenkoSA commented Jan 11, 2021

Copy link
Copy Markdown
ContributorAuthor

@DrTodd13 is it ready to be merged? How can I help with it?

@DrTodd13

Copy link
Copy Markdown
Contributor

@DrTodd13 is it ready to be merged? How can I help with it?

Yes. We can merge. There are some known issues to be fixed but let's get the stuff that is working checked in and fix the rest later.

Comment threadnumba_dppy/numpy_usm_shared.py Outdated
@PokhodenkoSA

Copy link
Copy Markdown
ContributorAuthor

@diptorupd@DrTodd13
Could somebody of you please approve this PR ?

@PokhodenkoSA
PokhodenkoSA merged commit bafd654 into mainJan 13, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@PokhodenkoSA@DrTodd13@diptorupd@1e-to@reazulhoque