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

Bisection search for split_into_three #976

Merged
merged 4 commits into from
Aug 7, 2019

Conversation

oskooi
Copy link
Collaborator

@oskooi oskooi commented Jul 29, 2019

Extends the bisection search approach of #966 to grid_volume::split_into_three which was missing.

@oskooi
Copy link
Collaborator Author

oskooi commented Jul 29, 2019

As a demonstration of the performance enhancement, the time for choose_chunkdivision with split_chunks_evenly=False for an OLED test case for 6 processes/chunks is 153.414 s using this PR and 746.713 s on master. This is a nearly 5X speedup.

int best_low_split_point;
direction best_low_split_direction;
double left_effort_fraction;
find_best_split(3, best_low_split_point, best_low_split_direction, left_effort_fraction);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think the find_best_split method is really correct right now for desired_chunks != 2. That's why @ChristopherHogan had a separate split_into_three function in the first place?

Copy link
Collaborator

@stevengj stevengj Aug 1, 2019

Choose a reason for hiding this comment

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

At first glance, I think we should change two places:

  1. cost_diff should return right_cost - left_cost * (desired_chunks-1);

  2. find_best_split should set split_measure to max(left_cost * (desired_chunks-1), right_cost)

Copy link
Collaborator

@stevengj stevengj Aug 1, 2019

Choose a reason for hiding this comment

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

For example, if desired_chunks == 3 then you would ideally like the left_cost to be 1/3 of the total and right_cost to be 2/3 of the total, so basically you want right_cost == (desired_chunks-1) * left_cost

Copy link
Collaborator

Choose a reason for hiding this comment

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

For the specific cases of desired_chunks == 1 or == 2, my proposal is equivalent to what it is doing now. But I think it would be better to change it to my formula, which seems more general.

@stevengj stevengj merged commit a27acb5 into NanoComp:master Aug 7, 2019
@oskooi oskooi deleted the split_into_three_bisection branch January 5, 2021 00:12
bencbartlett pushed a commit to bencbartlett/meep that referenced this pull request Sep 9, 2021
* Bisection search for split_into_three

* update split_measure

* whoops

* whoops again
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.

2 participants