Skip to content

Resolve PyNumero incompatibilities with NumPy2#3408

Merged
blnicho merged 21 commits intoPyomo:mainfrom
jsiirola:numpy2
Nov 7, 2024
Merged

Resolve PyNumero incompatibilities with NumPy2#3408
blnicho merged 21 commits intoPyomo:mainfrom
jsiirola:numpy2

Conversation

@jsiirola
Copy link
Copy Markdown
Member

@jsiirola jsiirola commented Nov 7, 2024

Fixes # .

Summary/Motivation:

This resolves some incompatibilities between PyNumero and NumPy>=2, and should resolve the last of the test failures in #3401.

Changes proposed in this PR:

  • Some PyNumero tests were missing guards for networkx
  • NumPy2 no longer supports ndarray.ptp: remove that from the PyNumero BlockVector API when running with NumPy2
  • NumPy2's implementation of numpy.ptp performs vector reductions (using the reduce ufunc method). Update BlockVector to support (a limited set of) ufunc.reduce()
  • Start to clean up some of the logic in BlockVector.__arrau_ufunc__ (and helper functions)
  • Add a new GHA test that should exercise pynumero with numpy2 (at least until dependencies for the the main GHA jobs allow installation of NumPy2)

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@blnicho blnicho merged commit 5e9b0f2 into Pyomo:main Nov 7, 2024
@jsiirola jsiirola deleted the numpy2 branch November 7, 2024 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants