Skip to content

Compatibility with numpy 2#764

Merged
julesghub merged 8 commits into
underworldcode:v2.18.xfrom
julesghub:np_1_2_update
Jun 29, 2026
Merged

Compatibility with numpy 2#764
julesghub merged 8 commits into
underworldcode:v2.18.xfrom
julesghub:np_1_2_update

Conversation

@julesghub

@julesghub julesghub commented Jun 29, 2026

Copy link
Copy Markdown
Member

Numpy 2 compatibility.

PR Checklist

  • I have read the CONTRIBUTING.rst document.
  • I have updated the docstrings accordingly.
  • I have updated CHANGELOG.md.
  • I have added tests which give complete coverage for my changes.
  • I have provided a usage example for my changes.
  • All new and existing tests pass.

Still numpy 1 is set as the default, but now underworld2 can be compiled and run with numpy 2 as well. This extends the longevity of underworld2 for ages to come.

For those interested in coupling models: UWGeo + Badlands no numpy 2 yet as Badlands is not numpy 2 compatible yet.

TL;DL; of the changes
- Numpy C-API dispatch table use changed: Now every .so created by UW2 (libStGermain.so, libUnderworld.so, etc...) gets it's own private version of the dispatch table. Previously only libStGermain.so got a copy and shared it to other .so files. In numpy 2 this sharing is no longer on by default. Changing all .so files to have their own version of the table works for both numpy 1 & 2. The redundancy of this table is negligable.
- SWIG files rejigged for change with dispatch table C-API: calling import_array()
- data "lock" flag implemented as flags.writeable is no longer in np2
- Changes to float() and int() as per numpy 2 changes.

julesghub and others added 6 commits May 18, 2026 12:03
Long commit description provided.
Quick overview.

- Numpy C-API dispatch table use changed.
- SWIG files rejigged for change C-API.
- data "lock" flag implemented as flags.writeable is no longer in np2
- Changes to float() and int().
- pixi.toml changes to run np2. Badlands is only np1 now so full testing
  with it can only happen once badlands np2 is release.
* Fix - Update path in environment.yml to correct file

* Fix typo

* add old version on README

* GH workflow updates

Taken from `issue-metric-patch` changes

* Sending _rebuild_solver = True for init_temp in UWGeodynamics

If the temperature fields, BCs, solver are initialised after the
`Model.solver` then stale temperature fields can be used.
This change prevents this occurring.

* Applying fix for github runners and openmpi comms layer choice

* Disable ucx comms in conda-build-test.yml

UCX isn't offered as a communication style for github runners. So it's disabled at test runtime..

* update conda dir

- update the environment.yml to reference a new definitions taken from
pixi. ie `pixi project export conda-environment > environment.yml`

- remove obsolete bits for the conda build definitions.

These changes should enable a v2.18.x binder image.

* Update README

* Pin zipp

binder issues with zipp, let's try pin it to another version

* add dockerignore to minimise the binder build size

* Improve dockerignore

* update .dockerignore
numpy 1 and 2 compatibility fixes
- by default numpy < 2 is switched on
- numpy 2 is supported by underworld2.
- numpy 2 isn't supported by badlands, therefore UWGeo-Badlands coupling
  can only run numpy 1.
@julesghub julesghub marked this pull request as ready for review June 29, 2026 09:46
julesghub and others added 2 commits June 29, 2026 19:58
Updated changelog for release 2.18.0 with new features, changes, and fixes.
@julesghub julesghub merged commit 2cc49a8 into underworldcode:v2.18.x Jun 29, 2026
1 check passed
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.

1 participant