Skip to content

Remove redundant timestep code #836

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

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

Conversation

danieljvickers
Copy link
Collaborator

@danieljvickers danieljvickers commented May 14, 2025

Description

I noticed about 300 lines of extremely similar code related to how the RK steps were implemented. I instead created a single subroutine and removed the redundant copies. I also merged two of the parallel loops into one, as there was no race condition created by the two loops

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Something else

Scope

  • This PR comprises a set of related changes with a common goal

If you cannot check the above box, please split your PR into multiple PRs that each have a common goal.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.
Provide instructions so we can reproduce.
Please also list any relevant details for your test configuration

  • Ran the test suite called with mfc.sh

Test Configuration:

  • What computers and compilers did you use to test this:

Ran on my local machine

Checklist

  • I have added comments for the new code
  • I added Doxygen docstrings to the new code
  • I have made corresponding changes to the documentation (docs/)
  • I have added regression tests to the test suite so that people can verify in the future that the feature is behaving as expected
  • I have added example cases in examples/ that demonstrate my new feature performing as expected.
    They run to completion and demonstrate "interesting physics"
  • I ran ./mfc.sh format before committing my code
  • New and existing tests pass locally with my changes, including with GPU capability enabled (both NVIDIA hardware with NVHPC compilers and AMD hardware with CRAY compilers) and disabled
  • This PR does not introduce any repeated code (it follows the DRY principle)
  • I cannot think of a way to condense this code and reduce any introduced additional line count

If your code changes any code source files (anything in src/simulation)

To make sure the code is performing as expected on GPU devices, I have:

  • Checked that the code compiles using NVHPC compilers
  • Checked that the code compiles using CRAY compilers
  • Ran the code on either V100, A100, or H100 GPUs and ensured the new feature performed as expected (the GPU results match the CPU results)
  • Ran the code on MI200+ GPUs and ensure the new features performed as expected (the GPU results match the CPU results)
  • Enclosed the new feature via nvtx ranges so that they can be identified in profiles
  • Ran a Nsight Systems profile using ./mfc.sh run XXXX --gpu -t simulation --nsys, and have attached the output file (.nsys-rep) and plain text results to this PR
  • Ran an Omniperf profile using ./mfc.sh run XXXX --gpu -t simulation --omniperf, and have attached the output file and plain text results to this PR.
  • Ran my code using various numbers of different GPUs (1, 2, and 8, for example) in parallel and made sure that the results scale similarly to what happens if you run without the new code/feature

Copy link

codecov bot commented May 15, 2025

Codecov Report

Attention: Patch coverage is 78.57143% with 3 lines in your changes missing coverage. Please review.

Project coverage is 43.58%. Comparing base (ba33af4) to head (75d69a2).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
src/simulation/m_time_steppers.fpp 78.57% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #836      +/-   ##
==========================================
+ Coverage   43.24%   43.58%   +0.33%     
==========================================
  Files          68       68              
  Lines       20183    19691     -492     
  Branches     2402     2359      -43     
==========================================
- Hits         8728     8582     -146     
+ Misses       9986     9669     -317     
+ Partials     1469     1440      -29     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…n issue for the intel compiler. I also have split out the loops in the subroutine to test if trying to block those together is causing an issue
… separate my for loops. Definately not desired behavior for ACC, but simple enough to work around.
@wilfonba
Copy link
Contributor

wilfonba commented May 17, 2025

Instead of scaler1,...,scalarN, could you use an array to store the coefficients and pass the correct row/column of that array to the s_advance_q_pb_mv subroutine? The array could be allocated and assigned in s_initialize_time_steppers_module. Additionally, I'd suggest the name dst for destination to replace index.

@danieljvickers danieljvickers force-pushed the remove-redundant-timestep-code branch from 3899ac5 to 272ccc4 Compare May 30, 2025 14:13
@danieljvickers
Copy link
Collaborator Author

Reverting back a commit since it looks like that small change broke almost every test case

@danieljvickers danieljvickers force-pushed the remove-redundant-timestep-code branch from d178ffc to 75d69a2 Compare June 2, 2025 03:25
@sbryngelson
Copy link
Member

sbryngelson commented Jun 2, 2025

@danieljvickers, this is getting a little silly/comedic. Why don't you move on to a different issue that you feel you're suited for (send me a message of what you think it is, perhaps), and I'll think about this one a bit. This is really an edge case that probably needs a little more thought from our previous snafus with different types of runners (though this one seems especially special AKA stupid)...

You're in a good place to create some containers for MFC. We could try creating those in a few different formats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants