Skip to content

Conversation

bikegeek
Copy link
Contributor

@bikegeek bikegeek commented Apr 24, 2025

Expected Differences

  • Do these changes introduce new tools, command line arguments, or configuration file options? [Yes]

    If yes, please describe:

  • Benchmarking using the CTRACK tool that runs when the --enable-profiler option is included in the configuration step of a MET build.

Instrumented code:

  • src/basic/vx_util/main.cc
  • src/tools/core/ensemble_stat/ensemble_stat.cc
  • src/tools/core/ensemble_stat/ensemble_stat_conf.cc

Configuration:

benchmark.yaml:

  • for exercising MET code via command line options

  • for exercising MET code via METplus use case(s) (i.e. wrapper code)

  • Do these changes modify the structure of existing or add new output data types (e.g. statistic line types or NetCDF variables)? [No]

Pull Request Testing

  • Describe testing already performed for these changes:

    on host 'seneca':

    cloned MET code to:
    /d1/projects/Benchmark_EnsembleStat

    built code without and with --enable-profiler to verify the option is working as expected
    ran profiling/benchmarking tool, CTRACK on ensemble stat code via:
    - MET command line commands:
    - use the benchmark.yaml config file set up for running MET command
    - use the setup.bash script to set the appropriate environment variables
    - use the envs_for_met.bash for setting the environment variables needed to run MET command line command
    - METplus use case
    - set the settings for METplus in the benchmark.yaml config file

  • Recommend testing for the reviewer(s) to perform, including the location of input datasets, and any additional instructions:

    - verify that instructions under the Contributor's Guide are correct and make sense
    - only focus on testing MET command line tools
      use the benchmark.yaml config file
      use the setup.bash script to set the appropriate environment variables
      use the envs_for_met.bash  for setting the environment variables needed to run MET command line command
      verify that results are in the output directory specified in the benchmark.yaml config file
    
  • Do these changes include sufficient documentation updates, ensuring that no errors or warnings exist in the build of the documentation? [Yes ]

  • Do these changes include sufficient testing updates? [No]

  • Will this PR result in changes to the MET test suite? [No]

  • Will this PR result in changes to existing METplus Use Cases? [No]

    If yes, create a new Update Truth METplus issue to describe them.

  • Do these changes introduce new SonarQube findings? [Yes]

    If yes, please describe:
    may result in lower code coverage percentage for new code

  • Please complete this pull request review by for RC1 release.

Pull Request Checklist

See the METplus Workflow for details.

  • Review the source issue metadata (required labels, projects, and milestone).
  • Complete the PR definition above.
  • Ensure the PR title matches the feature or bugfix branch name.
  • Define the PR metadata, as permissions allow.
    Select: Reviewer(s) and Development issue
    Select: Milestone as the version that will include these changes
    Select: METplus-X.Y Support project for bugfix releases or MET-X.Y Development project for the next coordinated release
  • After submitting the PR, select the ⚙️ icon in the Development section of the right hand sidebar. Search for the issue that this PR will close and select it, if it is not already selected.
  • After the PR is approved, merge your changes. If permissions do not allow this, request that the reviewer do the merge.
  • Close the linked issue and delete your feature or bugfix branch from GitHub.

georgemccabe and others added 30 commits November 15, 2024 06:17
* Per #3020, add missing GridStatNcOutInfo::do_seeps flag and use it to determine if SEEPS information should be written to the Grid-Stat NetCDF matched pairs output file.

* Unrelated to #3020, fix broken NetCDF cf-conventions links in the User's Guide.

* Per #3020, no real changes. Just whitespace
… GridStatConfig_SEEPS config file needs to be updated with nc_pairs_flag.seeps = TRUE in order for the same output to be produced by the unit tests.
* Per #3032, add data type column to all of the output tables

* Per #3032, remove the first row from each output table since its info is repeated from the table name. Additional changes for consistency and accuracy in column names.

* Update docs/Users_Guide/gsi-tools.rst

Co-authored-by: Julie Prestopnik <jpresto@ucar.edu>

---------

Co-authored-by: Julie Prestopnik <jpresto@ucar.edu>
…o create and push an updated test output image.
* Per #3033, update version info, consolidate release notes, and add upgrade instructions.

* Per #3033, remove all instances of 'Bugfix: ' from the release notes since it's redundant with the dropdown name

* Per #3030, based on request from Randy Pierce, also add MTD header columns to met_header_columns_v12.0.txt to make it easier to parse the output from MET.

* Per #3033, fix typo and correct alignment in table
Removing reference to beta version
Remove references to beta version
Update paths for eckit and atlas
Remove beta references
…er use case config files, add more assertion checks
…ve to MET_BASE (<install_loc>/share/met) and other files that are only in the MET repo are found relative to MET_TEST_BASE (MET/internal/test_unit). Also remove MET_BUILD_BASE env var (#3052)
…after finishing, format the information file
@davidalbo
Copy link
Contributor

Assuming this is a first example of profiling to come, I'm wondering about putting the profiling in so many places in ensemble_stat. Not that I'm against that but is there a good reason for it? In other words, what is the intent of profiling this particular application, and does the way it is set up help accomplish that?

@bikegeek
Copy link
Contributor Author

bikegeek commented May 1, 2025 via email

@JohnHalleyGotway JohnHalleyGotway changed the title Feature 3065 benchmarking ensemble stat Feature #3065 benchmarking ensemble stat May 1, 2025
@davidalbo
Copy link
Contributor

Thinking out loud, I'd describe my thinking like this: Start at a high level, look for bottlenecks, and drill down from there, meaning put only a few ctrack profiling lines initially and see where the app is spending all it's time, then look deeper. If you put profiling everywhere it might be harder to see where to investigate/modify. If that makes sense, I can give it a go as far as making it look like what I think would be a good initial setup. If that does NOT make sense, that is also ok. Let me know what you think.

@bikegeek
Copy link
Contributor Author

bikegeek commented May 5, 2025 via email

@davidalbo
Copy link
Contributor

@bikegeek was there a command line option to turn on the profiling? I'd like to test out my changes.

@bikegeek
Copy link
Contributor Author

bikegeek commented May 5, 2025 via email

@davidalbo
Copy link
Contributor

Hopefully the last question. Is there a way to look at these files in a way that formats them nicely? Just treating them as ascii gives output that is hard to read.

detail_output.txt
summary_output.txt

@bikegeek
Copy link
Contributor Author

bikegeek commented May 5, 2025 via email

@davidalbo
Copy link
Contributor

I reduced the profiling to the two main function calls only. process_n_vld and process_vx. This shows that process_vx is where the bulk of the time is being spent, so that is where one might add more profiling to see where within that method it is getting bogged down. This is what I was after. If you're good with this, I'll commit and push my changes.
Screenshot 2025-05-05 at 1 17 23 PM

@bikegeek
Copy link
Contributor Author

bikegeek commented May 5, 2025 via email

davidalbo
davidalbo previously approved these changes May 5, 2025
Copy link
Contributor

@davidalbo davidalbo left a comment

Choose a reason for hiding this comment

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

I approve this pull request.

@@ -194,6 +198,11 @@ int met_main(int argc, char *argv[]) {
// Perform verification
process_vx();

// Save the CTRACK metrics
#ifdef WITH_PROFILER
ctrack::result_print();
Copy link
Collaborator

Choose a reason for hiding this comment

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

@bikegeek if ctrack::result_print() is already being called every time in basic/vx_util/main.cc don't we NOT need to call it in the application code? Won't this cause the results to be printed twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If ctrack::result_print() is NOT in the application code, the benchmarking information for the application code does not get saved.

Copy link
Collaborator

@JohnHalleyGotway JohnHalleyGotway left a comment

Choose a reason for hiding this comment

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

@bikegeek, apologies for the long delay in getting to this. I proposed a couple of minor edits in the docs.

I tested in seneca as the met_test user in /d1/projects/MET/MET_pull_requests/met-12.1.0/rc1/MET-feature_3065_benchmarking_ensemble_stat and compiled with --enable-profiler.

When I run make test, I do see all the tests being run, including CTRACK output, and that's good. But it fails with this error at the end:

make[1]: *** No rule to make target 'profiler', needed by 'all'.  Stop.
make[1]: Leaving directory '/d1/projects/MET/MET_pull_requests/met-12.1.0/rc1/MET-feature_3065_benchmarking_ensemble_stat/scripts'
make: *** [Makefile:880: test] Error 2

I'll see if I can figure out why that's happening.

Copy link
Collaborator

@JohnHalleyGotway JohnHalleyGotway left a comment

Choose a reason for hiding this comment

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

OK, I just pushed a fix to the make test error. It's because of custom logic in scripts/Makefile to determine which test scripts to run. But I patched it to ignore the --enable-profiler configuration setting.

I approve of this PR, but do recommend that you make those documentation tweaks.

I imagine as we start using this profiling option, we may want to modify the details. @georgemccabe mentioned one idea to push the CTRACK directives in a common library function, so that adding it to a function is a one-liner instead of a three-liner.

Thanks!

No more error message during make test. Update comiler section accordingly
bikegeek and others added 2 commits May 13, 2025 12:46
Co-authored-by: John Halley Gotway <johnhg@ucar.edu>
Co-authored-by: John Halley Gotway <johnhg@ucar.edu>
@bikegeek bikegeek requested a review from JohnHalleyGotway May 13, 2025 18:48
@bikegeek
Copy link
Contributor Author

@davidalbo / @JohnHalleyGotway

I updated the documentation and just need one of you to click 'approve'

Copy link
Collaborator

@JohnHalleyGotway JohnHalleyGotway left a comment

Choose a reason for hiding this comment

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

I approve of these changes.

I'm sorry I missed the ping on this yesterday!

@bikegeek bikegeek merged commit e0c0573 into develop May 14, 2025
29 checks passed
@github-project-automation github-project-automation bot moved this from 🔎 In review to 🏁 Done in METplus-6.1 Development May 14, 2025
@bikegeek bikegeek deleted the feature_3065_benchmarking_ensemble_stat branch May 14, 2025 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: 🏁 Done
Development

Successfully merging this pull request may close these issues.

Add support for the CTRACK benchmarking tool and instrument the Ensemble-Stat tool to report metrics
5 participants