-
Notifications
You must be signed in to change notification settings - Fork 63
Feature: extend the partition algorithm to handle weights #1889
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?
Conversation
|
Thanks again for this addition! Since 95% of our users do not use weighted partitioning but the classical one and the weighted does add overhead i would argue we should at least skip the weight computation loop in standard mode. |
That's an interesting idea. Maybe we can get the best of both worlds with this kind of "fast-forward" behavior in the simple case. I will look into that. |
|
I wonder what should be the input of the weight function. Currently it takes a forest, a local tree id and an element id (within that tree). |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1889 +/- ##
==========================================
- Coverage 77.05% 76.88% -0.17%
==========================================
Files 112 112
Lines 18959 19016 +57
==========================================
+ Hits 14608 14620 +12
- Misses 4351 4396 +45 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I have refactored to use |
Co-authored-by: spenke91 <thomas.spenke@dlr.de>
|
Thanks a lot for your contribution @dutkalex ! I am out of office this week, but looking forward to reviewing it next week 👍 |
spenke91
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.
Thank you so much @dutkalex for your contribuition! I like the new feature a lot and as discussed, it seems to work flawlessly. As you can see, I only have minor remarks, which are mostly on how to pass the weight function to the forest.
Don't hesitate to contact me in Mattermost if you want to discuss something! :-)
Co-authored-by: spenke91 <thomas.spenke@dlr.de>
Co-authored-by: spenke91 <thomas.spenke@dlr.de>
Co-authored-by: spenke91 <thomas.spenke@dlr.de>
spenke91
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.
Thank you for the quick replies! I discussed with @holke today about this PR and here's what we think.
spenke91
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.
Thank you for your replies and once again for your contribution 👍
|
Hi @spenke91! |
Describe your changes here:
This PR makes it possible to define element weights for the partitioning algorithm. This is achieved via a callback pointer. In the null case, the old unweighted algorithm is used.
This introduces one breaking change in the public API, in thet8_forest_set_partitionfunction signature. All the client code in the repo has been updated, but this will require an update of external user code:t8_forest_set_partition(forest, set_from, set_for_coarsening)=>t8_forest_set_partition(forest, set_from, set_for_coarsening, nullptr)Design tradeoffs:
The new algorithm replaces the old one, even if no weight function is provided. Keeping the old algorithm around could possibly result in slightly better performance since it requires less work, but this would come at the cost of increased maintenance and the need for duplicated testing to cover both code paths. Given that the partition algorithm is not a performance bottleneck in practice, the single code path solution was preferred.The final design includes the unweighted case as a fast "early exit" case.All these boxes must be checked by the AUTHOR before requesting review:
Documentation:,Bugfix:,Feature:,Improvement:orOther:.All these boxes must be checked by the REVIEWERS before merging the pull request:
As a reviewer please read through all the code lines and make sure that the code is fully understood, bug free, well-documented and well-structured.
General
Tests
If the Pull request introduces code that is not covered by the github action (for example coupling with a new library):
Scripts and Wiki
script/find_all_source_files.scpto check the indentation of these files.License
doc/(or already has one).