Skip to content
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

ENH: add less ufunc #150

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tylerjereddy
Copy link
Contributor

  • draft the less() ufunc and turn its array API standard test on in CI

  • some of the changes here are modified/copied from other recent binary ufunc pull requests, like the
    broadcasting and type matching machinery; type matching in particular was expanded to include floating types, at least crudely

  • there are probably some formatting improvements that could be made for some of the ufunc workunits added here--feel free to push those in--some of that work is basically just find/replace in text editor...

* draft the `less()` ufunc and turn its array API
standard test on in CI

* some of the changes here are modified/copied from other
recent binary ufunc pull requests, like the
broadcasting and type matching machinery; type matching
in particular was expanded to include floating types,
at least crudely

* there are probably some formatting improvements that
could be made for some of the ufunc workunits added here--feel
free to push those in--some of that work is basically just
find/replace in text editor...
def astype(view, dtype):
new_view = pk.View([*view.shape], dtype=dtype)
new_view[:] = view
return new_view
Copy link
Contributor Author

Choose a reason for hiding this comment

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

was needed by the array API testing machinery for less()

def less_impl_5d_int8(tid: int,
view1: pk.View5D[pk.int8],
view2: pk.View5D[pk.int8],
out: pk.View5D[pk.uint8]):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

column-alignment could be cleaned up--feel free to help me with that... wasn't a high priority of course

view1_new = pk.View([*view1.shape], dtype=effective_dtype)
view1_new[:] = view1
view1 = view1_new
return view1, view2, effective_dtype
Copy link
Contributor Author

Choose a reason for hiding this comment

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

above two functions show up in some of my other binary ufunc branches/PRs, they may be slightly different here to accommodate expanding needs

* handle a few more dtype styles in
`_typematch_views()`, which seem to be needed
for the array API testsuite to pass with newer
versions of `hypothesis`
* use properly sized integer types for `__lt__`
comparisons
tylerjereddy added a commit to tylerjereddy/pykokkos that referenced this pull request Jan 9, 2023
* adjust the `greater()` ufunc to pass its array
API standard test, and turn this test on in the CI

* this largely mirrors the changes in kokkosgh-150, except
that we already had a draft implementation of `greater()`
in place here
tylerjereddy added a commit to tylerjereddy/pykokkos that referenced this pull request Jan 12, 2023
* add the `less_equal()` ufunc and turn its array API standard
test on in the CI; this is naturally quite similar to kokkosgh-150
@NaderAlAwar NaderAlAwar changed the base branch from develop to main May 24, 2023 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant