-
Notifications
You must be signed in to change notification settings - Fork 9
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
Enable indexing FieldVectors with column indices #1441
Conversation
374cc48
to
ace210f
Compare
00e41a8
to
18a2ceb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for adding this method.
bors try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add an inference test to this? I don't think that the FieldVector outer constructor is type stable
tryBuild succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
Hi @charleskawczynski , thanks for reviewing. And sure we can add an interface test! What exactly do you have in mind? There are other functions in the same file that test methods dispatched on |
It's safe, but calling that particular outer constructor is not type-stable. Please see CliMA/ClimaAtmos.jl#2079 for an attempted fix where we're hitting the same problem with the old TC code. It has a huge performance penalty-- note that it's completely fine to use once or twice (outside of |
18a2ceb
to
1081697
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, this new version is fully inferred and only allocates 32 bytes (per column). So I think this can work.
Thanks for fixing this @LenkaNovak!
Actually, I'm not sure that this is working, see this build, which fails 🤔 |
Awesome, thank you for your help, @charleskawczynski !
Ahh, is that indexing a FieldVector of FieldVectors? |
1081697
to
5da30b0
Compare
Actually, I think the breaking part is due to how we handled names in the old TC code. I think this should be fine, so long we add a test that |
bors try |
tryBuild failed: |
9175abd
to
7e24dc3
Compare
bors try |
7e24dc3
to
43106cc
Compare
bors try |
tryAlready running a review |
tryBuild failed: |
bors try |
2079: Try to fix FieldVector inference r=charleskawczynski a=charleskawczynski This PR is an attempt to fix the very bad remaining inference failure in the TC step! function, by calling a different FieldVector constructor to avoid the inference failure in (what I assume is `promote_type(map(RecursiveArrayTools.recursive_bottom_eltype, values)...)`). Inference currently looks like this in the EDMF flame graph: ![Screen Shot 2023-09-08 at 11 09 07 AM](https://github.com/CliMA/ClimaAtmos.jl/assets/1880641/c3e984cf-a42f-42ab-bfe1-a306604854fd) Let's see if this PR has any impact. cc `@LenkaNovak,` `@akshaysridhar` This is why I suggested adding JET tests in CliMA/ClimaCore.jl#1441, it will work, but it will be impractically slow. This flame graph is for a column, I imagine the sphere would be much worse. Co-authored-by: Charles Kawczynski <[email protected]>
tryBuild failed: |
d51abc7
to
f9ef25a
Compare
bors try |
tryBuild failed: |
f9ef25a
to
ede17f2
Compare
bors try |
tryBuild failed: |
move func to indices.jl prior format make output a FieldVector rev + type stable Co-authored-by: @charleskawczynski <[email protected]> add name test rm parent idx in test convert to Array fix fix cuda test with @allowscalar alloc test only for CPU timeout fix
ede17f2
to
13ffca3
Compare
bors try |
tryBuild succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
bors r+ |
1441: Enable indexing FieldVectors with column indices r=LenkaNovak a=LenkaNovak Co-authored-by: LenkaNovak <[email protected]>
Build failed: |
bors r+ |
Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
Closes #1442