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

compiler: Concretize SubDimensions to same object across repeated calls to concretize_subdims #2509

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ZoeLeibowitz
Copy link
Contributor

@ZoeLeibowitz ZoeLeibowitz commented Jan 6, 2025

Ensure that SubDimensions are consistently concretized to the same object across multiple calls to the function. This is important when using rcompile on equations with SubDimensions.

TODO: Enhance SymbolRegistry by making it rebuildable, enabling operations such as rcompile on specific subsets.

Copy link

codecov bot commented Jan 6, 2025

Codecov Report

Attention: Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.

Project coverage is 87.29%. Comparing base (71e7eda) to head (6835b2b).

Files with missing lines Patch % Lines
tests/test_builtins.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2509   +/-   ##
=======================================
  Coverage   87.28%   87.29%           
=======================================
  Files         238      238           
  Lines       45703    45716   +13     
  Branches     4057     4057           
=======================================
+ Hits        39892    39906   +14     
- Misses       5126     5127    +1     
+ Partials      685      683    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@mloubout mloubout left a comment

Choose a reason for hiding this comment

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

Not completely sure carrying around an extra mapper is the best way but don't have a better option top of my head without lots of rework

@@ -1,7 +1,7 @@
import pytest
import numpy as np
from scipy.ndimage import gaussian_filter
from scipy.misc import ascent
from scipy.datasets import ascent
Copy link
Contributor

Choose a reason for hiding this comment

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

If I remember correctly this one behaves a bit differently and was leading to issues in the tests but if ci is green that's fine. The requirements need to be update though to scipy version with that import

Copy link
Contributor

Choose a reason for hiding this comment

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

CI now fails with the old version. See here

Copy link
Contributor

@EdCaunt EdCaunt left a comment

Choose a reason for hiding this comment

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

Looks good to me. As @mloubout mentioned, we should probably revisit and rework this at some point in the future, but it is a relatively minor intervention for now

tests/test_dimension.py Outdated Show resolved Hide resolved
@@ -1,4 +1,4 @@
matplotlib
pyrevolve==2.2.4
scipy
scipy>=1.13.0
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's too restrictive, it's a very new version, would wrap the import in try/except to handle different version import path

Copy link
Contributor

Choose a reason for hiding this comment

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

ah sorry jsut saw that

@@ -1,4 +1,4 @@
matplotlib
pyrevolve==2.2.4
scipy>=1.13.0
scipy
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is better to add an upper bound:

e.g. <=

and then (if needed) do what @mloubout did here (?):

dee09dd

Copy link
Contributor

Choose a reason for hiding this comment

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

keep lower bound ofc

@FabioLuporini
Copy link
Contributor

Not completely sure carrying around an extra mapper is the best way but don't have a better option top of my head without lots of rework

We discussed this in yesterday's meeting, @mloubout .

My suggestion was to rather use sregistry. And, in fact, we could (should) use sregistry also in place of that mapper we are currently carrying along throughout the whole pass

@ZoeLeibowitz ZoeLeibowitz marked this pull request as draft January 8, 2025 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants