hiddenSymmetries / simsopt

Simons Stellarator Optimizer Code
https://simsopt.readthedocs.io
MIT License
83 stars 43 forks source link

Fix for python 3.8 and numpy dependency #432

Closed mbkumar closed 2 weeks ago

mbkumar commented 3 weeks ago

This PR adds python-version specific dependencies to address numpy compatibility with v1.x and v2.x.

There is one spec test failing in 3.8. Could that be due to numpy 2.0 and numpy 1.x differences? @smiet, can you please invetigate?

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 91.99%. Comparing base (9dd34c5) to head (6ac3fa8). Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #432 +/- ## ======================================= Coverage 91.99% 91.99% ======================================= Files 75 75 Lines 13499 13499 ======================================= Hits 12419 12419 Misses 1080 1080 ``` | [Flag](https://app.codecov.io/gh/hiddenSymmetries/simsopt/pull/432/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hiddenSymmetries) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/hiddenSymmetries/simsopt/pull/432/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hiddenSymmetries) | `91.99% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hiddenSymmetries#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

smiet commented 3 weeks ago

all passing now, fixed on current spec master by not requiring 2.0 if python<3.8.

There is a new PR waiting that removes numpy dependency on install, but that shouldn't affect this.

mbkumar commented 3 weeks ago

@smiet

Spec related tests are still failing. https://github.com/hiddenSymmetries/simsopt/actions/runs/9713949797/job/26811901758 Can you please check?

smiet commented 3 weeks ago

@mbkumar the failures you are referring to are caused by an identifier collision in the python cache of the Fortran memory. They occur because f90rwap uses an identifier based on the pointer in memory for its python-cache, and re-loading a Spec object results in sucessive deallocation and allocation, with possibility of occupying the same location on memory-constrained systems (such as runners). This results in the collision such that python references an outdated and misshapen array.

Will be addressed and fixed in PR #431, if you want to speed it up, give it an approve, or directly merge it ;)