-
Notifications
You must be signed in to change notification settings - Fork 57
Solver improvements #177
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
base: main
Are you sure you want to change the base?
Solver improvements #177
Conversation
tommbendall
left a comment
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.
This is a really good speed-up. I'm happy that this is scientifically equivalent to main and the KGOs are only changing from bit-wise differences in the kernels.
I am generally happy -- the new mixed solver kernels have been literally taken from the existing kernel and split into two parts, making this easy to review.
My main thoughts that aren't captured through my comments on the code:
- Do you prefer to keep the old
apply_mixed_operator_kernel_mod.F90file, which I think is now unused? Or could it be removed? - For the
assemble_w2h_from_w2hb_kernel, there is already a very similar kernel in the core repo: https://github.com/MetOffice/lfric_core/blob/main/components/science/source/kernel/inter_function_space/sci_average_w2b_to_w2_kernel_mod.F90 . I think it could be better to modify the existing kernel to work for both W2H and W2, rather than add a new kernel here? (appreciating that you'd rather not make this a linked ticket, so feel free to refuse) - The timers will conflict with the changes from #68 and #176 -- so I'm suggesting reverting these changes
science/gungho/unit-test/kernel/solver/apply_mixed_wp_operator_kernel_mod_test.pf
Outdated
Show resolved
Hide resolved
science/gungho/unit-test/kernel/solver/apply_mixed_u_operator_kernel_mod_test.pf
Outdated
Show resolved
Hide resolved
| @@ -0,0 +1,86 @@ | |||
| !----------------------------------------------------------------------------- | |||
| ! Copyright (c) 2017, Met Office, on behalf of HMSO and Queen's Printer | |||
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.
This looks like the old copyright statement
| if ( LPROF ) call start_timing( id, 'mixed_operator' ) | ||
| type(r_solver_field_type) :: y_uv_broken | ||
|
|
||
| if ( subroutine_timers ) call timer('mixed_solver.operator') |
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.
| @@ -418,7 +414,7 @@ contains | |||
| call invoke( inc_X_times_Y(rhs, h_diag) ) | |||
| end if | |||
|
|
|||
| if ( LPROF ) call stop_timing( id, 'mixed_schur_rhs' ) | |||
| if ( subroutine_timers ) call timer('schur_precon.rhs') | |||
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.
|
|
||
| if ( LPROF ) call start_timing( id, 'schur_back_substitute' ) | ||
| type(r_solver_field_type), target :: uvw_norm | ||
| if ( subroutine_timers ) call timer('schur_precon.back_sub') |
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.
| @@ -507,7 +504,7 @@ contains | |||
| state_p => state%get_field_from_position(isol_p) | |||
| call invoke( setval_X(state_p, exner_inc) ) | |||
|
|
|||
| if ( LPROF ) call stop_timing( id, 'schur_back_substitute' ) | |||
| if ( subroutine_timers ) call timer('schur_precon.back_sub') | |||
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.
|
|
||
| if ( LPROF ) call start_timing( id, 'helmholtz_lhs' ) | ||
| if ( subroutine_timers ) call timer('pressure_solver.helmholtz_lhs') |
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.
| @@ -242,7 +241,7 @@ contains | |||
| nullify( w3_mask, w2_mask ) | |||
| end if | |||
| nullify( x_vec, y_vec ) | |||
| if ( LPROF ) call stop_timing( id, 'helmholtz_lhs' ) | |||
| if ( subroutine_timers ) call timer('pressure_solver.helmholtz_lhs') | |||
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.
Co-authored-by: Thomas Bendall <[email protected]>
Reverting back to stable version
…_kernel_mod_test.pf Co-authored-by: Thomas Bendall <[email protected]>
…kernel_mod_test.pf Co-authored-by: Thomas Bendall <[email protected]>
|
tommbendall
left a comment
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.
Thanks for the reply. I'm happy with the changes in that case, so this passes science review.
This is now ready for code review @mo-rickywong










PR Summary
Sci/Tech Reviewer: @tommbendall
Code Reviewer: @mo-rickywong
Add in a number of solver optimisations.
The principle performance improvement in this pull request is to split the application of the mixed operator into two seperate new kernels.
These changes result in a performance improvement for 2 main reasons
The C224 & C896 lfric atm tests in the test suite were run with these changes giving the following solver times
Code Quality Checklist
Testing
trac.log
These results are from before the KGO update. The failure in the lfric_inputs appears not to be due to this pull request as none of the code changes should be used and is likely one of the occasional lfric_inputs failures that we see
Test Suite Results - lfric_apps - solver_improvements/run6
Suite Information
Task Information
❌ failed tasks - 150
⌛ waiting tasks - 2
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