Address Issues with Face Selectors#458
Conversation
Update stable for vn3.1
DanStoneMO
left a comment
There was a problem hiding this comment.
Tested this with JEDI and all is good. No linked lfric-jedi PR will be needed.
iboutle
left a comment
There was a problem hiding this comment.
Just one thing to look at
| real(kind=r_bl), dimension(0:bl_levels-1) :: tau_grad, tau_non_grad, u_sp, & | ||
| rdz_sp, rhokm_sp, ngstress_sp, tau_sp, fd_tau_sp | ||
|
|
||
| total_faces = MIN( & |
There was a problem hiding this comment.
I noticed that the checksums had changed for the coma9 and comorph_dev SCM tests, but none of the other SCM tests, which seemed suspicious - these are the 2 jobs which use the version of this kernel on cell-centres.
The code to account for this does not seem to be working properly. For a 2x2 biperiodic domain (although I would assume the same is true for any biperiodic domain), the face selectors pick all 4 faces of the 1st cell, 2 faces of the 2nd and 3rd cells, and no faces of the final cell. This means that the cell centre code for the final cell also gets missed, because total_faces=0 by this line.
I think a suitable replacement would be:
if (nfaces == 1) then
total_faces = 1
else
total_faces = ABS(face_selector_ew(map_w3_2d(1))) + ABS(face_selector_ns(map_w3_2d(1)))
end if
which would give the correct behaviour for the cell face application of the kernel, but ensure that it is always executed for cell centres.
With this, the KGO for all SCM jobs should then remain unchanged.
There was a problem hiding this comment.
Thanks for spotting that! Yes, having fixed that the SCM jobs now don't change KGOs.
There was a problem hiding this comment.
Thanks Tom - out of interest, why does the update to fix this have more KGO changes than just the SCM jobs - were the rest just out-of-date and in need of updating anyway, or does the fix affect the KGO of all job (which I wouldn't have expected)?
There was a problem hiding this comment.
This was a good point so I've double-checked this. The KGOs were not up-to-date previously -- I have checked the effect of reverting the change in the previous commit, and only the jobs using Comorph change KGOs, which is as it should be!
|
I'm now on leave until 26th May - I'm happy for this to progress on to code review before the 22nd deadline when the issue with the SCM KGOs has been resolved - everything else is fine. |
PR Summary
Sci/Tech Reviewer: iboutle
Code Reviewer: Yaswant Pradhan (@yaswant)
This is the Apps part of work to revamp the
face_selectorinfrastructure, which ensure that when looping over faces within columns, faces are only looped over once. This PR fixes a number of flaws and deficiencies with them. It does this by changing how theface_selectorfields are computed, and changing the values they can take.Kernels with this data access pattern that were previously not using the face selectors now are, which is a modest performance improvement.
In particular:
WandSfaces. Now they can just iterate overN,Eor no faces if necessaryThis fixes a number of problems:
face_selectorfields now take sensible values in halos, which may allow some kernels to used with redundant computationLinked-To
Details
face_selectorsare updated to use their new formface_selectorshave been added to a series of kernels (mainly physics kernels) that have the same access pattern of writing to a face from only one kernelDocumentation
See the linked core PR for documentation
Results
Here are PDFs containing plots from the test suite showing the neutral scientific impact:
gungho:
results_face_selector_gungho.pdf
lfric_atm:
results_face_selector_lfric_atm.pdf
There should be a modest reduction in time by using this scheme in the boundary layer. Here are timings from differnt tests in the lfric_atm_weekly suite (just from a single run, so subject to variability) that demonstrate this:
Code Quality Checklist
Testing
trac.log
Test Suite Results - lfric_apps - face_selector_apps/run6
Suite Information
Task Information
✅ succeeded tasks - 1511
Security Considerations
Performance Impact
AI Assistance and Attribution
Documentation
PSyclone Approval
Sci/Tech Review
(Please alert the code reviewer via a tag when you have approved the SR)
Code Review