Skip to content
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

Add "performance_test" to the benchmarks #2847

Open
wants to merge 36 commits into
base: main
Choose a base branch
from

Conversation

yukaribbba
Copy link
Contributor

@yukaribbba yukaribbba commented Jun 30, 2024

To have a better understanding of the performance topics in FAQ, several tests are taken. This PR will give brief on them.

  • Fully documented

Copy link

codecov bot commented Jun 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.96%. Comparing base (85f11a3) to head (0129fdd).
Report is 15 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2847      +/-   ##
==========================================
+ Coverage   95.94%   95.96%   +0.02%     
==========================================
  Files         366      366              
  Lines       53611    53619       +8     
==========================================
+ Hits        51439    51458      +19     
+ Misses       2172     2161      -11     
Flag Coverage Δ
behaviourtests 4.04% <ø> (+<0.01%) ⬆️
unittests 96.06% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@coveralls
Copy link

coveralls commented Jun 30, 2024

Pull Request Test Coverage Report for Build 9729113408

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 96.046%

Totals Coverage Status
Change from base Build 9702977764: 0.0%
Covered Lines: 51641
Relevant Lines: 53767

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 30, 2024

Pull Request Test Coverage Report for Build 9729246492

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 96.046%

Totals Coverage Status
Change from base Build 9702977764: 0.0%
Covered Lines: 51641
Relevant Lines: 53767

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 30, 2024

Pull Request Test Coverage Report for Build 9730630372

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 96.046%

Totals Coverage Status
Change from base Build 9702977764: 0.0%
Covered Lines: 51641
Relevant Lines: 53767

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 30, 2024

Pull Request Test Coverage Report for Build 9733225497

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 96.046%

Totals Coverage Status
Change from base Build 9702977764: 0.0%
Covered Lines: 51641
Relevant Lines: 53767

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 30, 2024

Pull Request Test Coverage Report for Build 9733424593

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 96.046%

Totals Coverage Status
Change from base Build 9702977764: 0.0%
Covered Lines: 51641
Relevant Lines: 53767

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jul 1, 2024

Pull Request Test Coverage Report for Build 9747623796

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 96.046%

Totals Coverage Status
Change from base Build 9702977764: 0.0%
Covered Lines: 51641
Relevant Lines: 53767

💛 - Coveralls

Copy link
Member

@djhoese djhoese left a comment

Choose a reason for hiding this comment

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

Very interesting. Thanks for putting this together. I have some concerns though.

  1. I don't see the benefit of the performance table of contents section having a maxdepth of 2. It could just go along with the release notes or at least be brought down to a maxdepth of 1.
  2. The testing platform and environments being on the main performance page suggests that this platform will be used for all series of tests and it won't be (unless you're volunteering your time and your machine for the next N years). I think it'd be better to have that information maybe per-test document OR run these tests on a specific cloud-based platforms. We already have benchmarks running on the European Weather Cloud.
  3. I'm not sure the different resampling strategies need to be tested and documented in Satpy. This information seems like it would be better for pyresample.
  4. We will need the code that generated all of this to be added to the repository and easily runnable. Preferably it would generate these tables automatically.
  5. I feel like these types of results are highly dependent on the CPU and available memory of a system (assuming this is the only thing the machine is doing at the time). So I'm not sure how useful it is to show this to a user and have them expect similar numbers.
  6. I think a graph, maybe even an embedded javascript one, would be easier to digest. I wouldn't have recommended this normally, but since the main argument for this being added is making it easier to understand how worker and chunk size work together I think it is important.
  7. Lastly, I'm not sure how long lasting and useful this will be. These results could vary wildly with CPU and memory on the system (as I mentioned), but also with version changed of Satpy and satpy's dependencies. There was discussion somewhere else (github or slack) about having a script to show how a users specific machine performs with these different values. That may be better in the long term to make available to users and to make the results "personal" and actionable since it is their system they're seeing the results for.

I understand this is a draft and I am not the only satpy maintainer, but I just wanted to give my thoughts on this before you spend too much time on it if it ends up not being merged.

@yukaribbba
Copy link
Contributor Author

I agree. Actually I'm also not sure how useful my results could be for other platforms (That's why I only post one of them). I do have the test scripts that can finally output a csv file just like the tables in this PR. I'm making some improvements for public use. Maybe we can just let the user run it and decide what's the best settings like you said. But where shall we put it?

@yukaribbba
Copy link
Contributor Author

I‘ve made some changes. Now we can review the html report of the test.
FireShot Capture 004 - Satpy Performance Test Report for abi_l1b -

@yukaribbba yukaribbba changed the title Add a new chapter "Performance Tests" to the documents Add "performance_tests" to the benchmarks Jul 7, 2024
@yukaribbba yukaribbba changed the title Add "performance_tests" to the benchmarks Add "performance_test" to the benchmarks Jul 7, 2024
@yukaribbba
Copy link
Contributor Author

pre-commit.ci autofix

@coveralls
Copy link

coveralls commented Jul 7, 2024

Pull Request Test Coverage Report for Build 9823636005

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 9 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.02%) to 96.067%

Files with Coverage Reduction New Missed Lines %
satpy/tests/reader_tests/gms/test_gms5_vissr_navigation.py 1 99.3%
satpy/tests/utils.py 8 94.02%
Totals Coverage Status
Change from base Build 9702977764: 0.02%
Covered Lines: 51660
Relevant Lines: 53775

💛 - Coveralls

@yukaribbba
Copy link
Contributor Author

pre-commit.ci autofix

@coveralls
Copy link

coveralls commented Jul 7, 2024

Pull Request Test Coverage Report for Build 9827365298

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 11 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.006%) to 96.052%

Files with Coverage Reduction New Missed Lines %
satpy/tests/reader_tests/gms/test_gms5_vissr_navigation.py 1 97.18%
satpy/tests/utils.py 10 93.16%
Totals Coverage Status
Change from base Build 9702977764: 0.006%
Covered Lines: 51652
Relevant Lines: 53775

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jul 7, 2024

Pull Request Test Coverage Report for Build 9827748182

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 11 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.006%) to 96.052%

Files with Coverage Reduction New Missed Lines %
satpy/tests/reader_tests/gms/test_gms5_vissr_navigation.py 1 97.18%
satpy/tests/utils.py 10 93.16%
Totals Coverage Status
Change from base Build 9702977764: 0.006%
Covered Lines: 51652
Relevant Lines: 53775

💛 - Coveralls

@yukaribbba yukaribbba marked this pull request as ready for review July 7, 2024 16:29
@yukaribbba yukaribbba requested a review from mraspaud as a code owner July 7, 2024 16:29
@yukaribbba yukaribbba requested a review from djhoese July 7, 2024 16:30
@coveralls
Copy link

coveralls commented Jul 7, 2024

Pull Request Test Coverage Report for Build 9828713154

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 11 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.006%) to 96.052%

Files with Coverage Reduction New Missed Lines %
satpy/tests/reader_tests/gms/test_gms5_vissr_navigation.py 1 97.18%
satpy/tests/utils.py 10 93.16%
Totals Coverage Status
Change from base Build 9702977764: 0.006%
Covered Lines: 51652
Relevant Lines: 53775

💛 - Coveralls

@yukaribbba
Copy link
Contributor Author

@djhoese CI failed again. Anyway my part is done temporarily. Here's an example of the test report.
FireShot Capture 005 - Satpy Performance Test Report for abi_l1b -

@coveralls
Copy link

Pull Request Test Coverage Report for Build 9853151991

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 96.069%

Totals Coverage Status
Change from base Build 9842330086: 0.0%
Covered Lines: 51687
Relevant Lines: 53802

💛 - Coveralls

Copy link
Member

@djhoese djhoese left a comment

Choose a reason for hiding this comment

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

I really didn't think you were going to put more work into this until we got more feedback from other maintainers. It looks like you've done a lot. It does look more useful this way, but it is still a lot. I guess I was hoping for a python script that could be called and provided command line options for all of these things. But please don't put more work toward this until others have weighed in with their opinions.

I see why the module was added to the docs and their are API docs since users are expected to run it themselves, but I don't like the extra dependencies that it requires in the docs building (especially matplotlib). Note that pandas shouldn't be an extra dependency since xarray should depend on it.

Lastly, our documentation is usually written with linux-based examples. You're running on Windows so it does give a different "look" to the documentation you've added.

Comment on lines +200 to +204
i = 0
for chunk_size in self.chunk_size_opts:
for num_worker in self.worker_opts:
self.single_loop((chunk_size, num_worker, resampler), generate=generate)
i = i + 1
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
i = 0
for chunk_size in self.chunk_size_opts:
for num_worker in self.worker_opts:
self.single_loop((chunk_size, num_worker, resampler), generate=generate)
i = i + 1
for chunk_size, num_worker in itertools.product(self.chunk_size_opts, self.worker_opts):

I wonder if the final report could be put after the for loop and instead find a way to only do the sleep (maybe split the completed message and the 1-min rest message into two prints) if we aren't on the last round.

dask.config.set(num_workers=num_worker)

try:
num_thread = os.environ["OMP_NUM_THREADS"]
Copy link
Member

Choose a reason for hiding this comment

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

FYI we almost never see a good improvement if this is over 1 or 2.


4. Do I have enough swap memory?
--------------------------------
Some conditions or resamplers may consume a hell of physical memory and then swap. When both are at their limits,
Copy link
Member

Choose a reason for hiding this comment

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

We generally try to avoid language like this.

Suggested change
Some conditions or resamplers may consume a hell of physical memory and then swap. When both are at their limits,
Some conditions or resamplers may consume a lot of physical memory and even use swap. When both are at their limits,

@yukaribbba
Copy link
Contributor Author

I did think about command line options but eventually I found it looks nasty to let users put all these options in command. Beside, there're some kwargs hard to input that way. But ok, I'll be waiting for others' thoughts.

@yukaribbba
Copy link
Contributor Author

For dependencies, we can drop py-cpuinfo but psutil is necessary. Otherwise how can we record cpu/memory usage?

@djhoese
Copy link
Member

djhoese commented Jul 9, 2024

For dependencies, we can drop py-cpuinfo but psutil is necessary. Otherwise how can we record cpu/memory usage?

Basically I was thinking that the script/module wouldn't be added to the docs (no API docs) and therefore we wouldn't need any of its dependencies because sphinx would never import it to be documented. Alternatively, we could tell sphinx to mock its dependencies in conf.py.

@yukaribbba
Copy link
Contributor Author

Well for me reading the docs are always better than reading the description inside the codes. Thats why I embed it. But the doc thing is just secondary. First we gonna hear what others say.

@mraspaud
Copy link
Member

mraspaud commented Jul 26, 2024

Sorry for being so late on this.
First I'd like to thank you @yukaribbba for working on this! As a user, I can imaging the script being really useful when you want to know what parameters to tweak for your particular data.

A couple of comments/questions (I haven't checked the code in detail yet, so forgive me if I overlooked something):

  • for read the docs, you don't actually need matplotlib I think, if you use autodoc_mock_imports.
  • Have you considered including dask graphs also?
  • For other satpy benchmarks, we are using airspeed velocity and showing the results here: https://mraspaud.github.io/satpy/ (hasn't been updated for a year though 😱 , I need to fix that). Would this be something we could use ? It uses a VM on the European weather cloud to do the benchmarking.

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

Successfully merging this pull request may close these issues.

4 participants