8000 DOC: Update roadmap a bit more by seberg · Pull Request #26722 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

DOC: Update roadmap a bit more #26722

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 3 commits into from
Jul 2, 2024
Merged

DOC: Update roadmap a bit more #26722

merged 3 commits into from
Jul 2, 2024

Conversation

seberg
Copy link
Member
@seberg seberg commented Jun 17, 2024

Just some thoughts, I didn't include ufunc chaining, although I think it would also be valid to mention it (even if I doubt anyone will work on it). All others are things that have been discussed multiple times at least, so I think they are fine to add, even if I don't know if anyone will work on it: That is true for practically everything.

I also always play with the idea that labeled axes might not be all that bad to think about. But it may need a quite a lot of dedication. (It might not be that bad, but its a pretty broad thing.)

Just some thoughts, I didn't include ufunc chaining, although I think
it would also be valid to mention it (even if I doubt anyone will work
on it).  All others are things that have been discussed multiple times
at least, so I think they are fine to add, even if I don't know if
anyone will work on it:  That is true for practically everything.

I also always play with the idea that labeled axes might not be all that
bad to think about.  But it may need a quite a lot of dedication.
(It might not be that bad, but its a pretty broad thing.)
@@ -29,8 +29,6 @@ needed based on real-world experience and needs.

In addition, the ``__array_ufunc__`` and ``__array_function__`` protocols
fulfill a role here - they are stable and used by several downstream projects.
They do not cover the whole API, so use of the array API standard is preferred
for new code.
Copy link
Member Author

Choose a reason for hiding this comment

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

The "They don't cover the whole API" seemed wrong to me and I didn't have thought on how to rephrase so just delete it.

The correct spin should probably be that the Array API may be preferred for new library code, while array-function/array-ufunc is definitely still relevant for array object authors who like to integrate deeply with NumPy.

Copy link
Member

Choose a reason for hiding this comment

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

Seems fine to me to delete.

@@ -97,6 +97,9 @@ first, and that could potentially be upstreamed into NumPy later, include:
``latin1``)
- A unit dtype

We further plan to extend the new API around ufuncs as the needs arise.
One possibility here is creating a new, more powerful, API to allow hooking
into existing NumPy ufunc implementations.
Copy link
Member Author

Choose a reason for hiding this comment

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

Note sure anyone can understand it, but I don't mind :). I am talking about pnumpy here, we should have a better story for it (or decide to not have a story at all).

Copy link
Member

Choose a reason for hiding this comment

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

Change "new API around ufuncs" to "ufunc C API"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, better.

Copy link
Contributor

Choose a reason for hiding this comment

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

I had never heard of pnumpy, but it seems interesting. Maybe add at end "... implementations, e.g., to allow parallel execution as done by pnumpy"

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure how maintained it still is (or quite how well it worked in practice), but if others think it is stable enough to link, sure.
(Also, parallel execution belongs on a different level IMO, but that is part of the potential things here.)

Copy link
Member

Choose a reason for hiding this comment

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

It's not maintained. It was an experiment, it worked and yielded interesting performance gains, but it wasn't interesting enough to pursue further at that point. I think it is an example of the types of things people would like to be able to do though, so it can serve as an example use case I'd say. @mattip may have more thoughts on it.

Copy link
Contributor

Choose a reason for hiding this comment

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

If it is not pursued anymore then linking to it is perhaps not such a good idea... But it helps to give some example of why linking into the implementations might be useful.

Copy link
Member

Choose a reason for hiding this comment

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

pnumpy is unmaintained. I wouldn't want to draw more attention to it.

Copy link
Member
@rgommers rgommers left a comment

Choose a reason for hiding this comment

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

8000

Thanks Sebastian. Overall LGTM, a few comments.

@@ -29,8 +29,6 @@ needed based on real-world experience and needs.

In addition, the ``__array_ufunc__`` and ``__array_function__`` protocols
fulfill a role here - they are stable and used by several downstream projects.
They do not cover the whole API, so use of the array API standard is preferred
for new code.
Copy link
Member

Choose a reason for hiding this comment

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

Seems fine to me to delete.

@@ -51,6 +49,8 @@ Other performance improvement ideas include:

- A better story around parallel execution (related is support for free-threaded
CPython, see further down).
- Using recent improvements in our ufunc context to allow users for example to
Copy link
Member

Choose a reason for hiding this comment

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

Can you rephrase this slightly, removing "our" and perhaps pointing the API that is meant here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I added errstate in brackets, which is what I mean (mostly). Since I think that is a path towards switching ufunc loops, but of course I also mean the new C API which allows us to actually propagate that information.

Copy link
Member Author
@seberg seberg Jun 18, 2024

Choose a reason for hiding this comment

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

Updated to:

- Enable the ability to allow NumPy to use faster, but less precise,
  implementations for ufuncs.
  Until now, the only state modifying ufunc behavior has been ``np.errstate``.
  But, with NumPy 2.0 improvements in the ``np.errstate`` and the ufunc C
  implementation make this type of addition easier.

since I realized it is actually both the behind the scenes implementation and the not quite behind the scenes errstate improvements that are (at least likel) helpful.

@@ -97,6 +97,9 @@ first, and that could potentially be upstreamed into NumPy later, include:
``latin1``)
- A unit dtype

We further plan to extend the new API around ufuncs as the needs arise.
One possibility here is creating a new, more powerful, API to allow hooking
into existing NumPy ufunc implementations.
Copy link
Member

Choose a reason for hiding this comment

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

Change "new API around ufuncs" to "ufunc C API"?

@@ -122,6 +125,13 @@ We intend to write a NEP covering the support levels we provide and what is
required for a platform to move to a higher tier of support, similar to
`PEP 11 <https://peps.python.org/pep-0011/>`__.

Further consistency fixes to promotion and scalar logic
```````````````````````````````````````````````````````
NumPy 2 fixed many issues around promotion especially with respect to scalars.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
NumPy 2 fixed many issues around promotion especially with respect to scalars.
NumPy 2.0 fixed many issues around promotion especially with respect to scalars.

Further consistency fixes to promotion and scalar logic
```````````````````````````````````````````````````````
NumPy 2 fixed many issues around promotion especially with respect to scalars.
We plan to continue slowly fixing remaining inconsistencies.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
We plan to continue slowly fixing remaining inconsistencies.
We plan to continue fixing remaining inconsistencies.

```````````````````````````````````````````````````````
NumPy 2 fixed many issues around promotion especially with respect to scalars.
We plan to continue slowly fixing remaining inconsistencies.
For example, NumPy converts 0-D objects to scalars and some promotions
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
For example, NumPy converts 0-D objects to scalars and some promotions
For example, NumPy converts 0-D objects to scalars, and some promotions

Copy link
Member

Choose a reason for hiding this comment

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

Do we (you, or anyone else) actually plan to do anything about 0-D arrays vs. scalars? If not, we shouldn't mention it here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not promising to do this right now, but that is true for most points on the list.

So yes, I think this is much more concrete than most points. In fact, it is even mostly done, since I did most (maybe all) of the foundational work in NumPy 2! (and one of that was another small compat break ;).)

Copy link
Contributor
@mhvk mhvk left a comment

Choose a reason for hiding this comment

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

Nice. One suggestion in-line, but fine without too.

@@ -97,6 +97,9 @@ first, and that could potentially be upstreamed into NumPy later, include:
``latin1``)
- A unit dtype

We further plan to extend the new API around ufuncs as the needs arise.
One possibility here is creating a new, more powerful, API to allow hooking
into existing NumPy ufunc implementations.
Copy link
Contributor

Choose a reason for hiding this comment

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

I had never heard of pnumpy, but it seems interesting. Maybe add at end "... implementations, e.g., to allow parallel execution as done by pnumpy"

@rootsmusic
Copy link
rootsmusic commented Jun 21, 2024

Link issue #26157 to Support for free-threaded CPython? (Since there's only one tracking issue, I assume that the roadmap isn't to release incremental upgrades toward full compatibility with Python 3.13.)

@mattip
Copy link
Member
mattip commented Jul 2, 2024

Let's put this in, we can continue to iterate on it in future PRs.

@mattip mattip merged commit 95073d1 into numpy:main Jul 2, 2024
68 checks passed
@mattip
Copy link
Member
mattip commented Jul 2, 2024

Thanks @seberg and reviewers

@seberg seberg deleted the roadmap-update branch July 2, 2024 19:36
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.

5 participants
0