Split chunks based on costs obtained from fragment_stats#663
Closed
ChristopherHogan wants to merge 2 commits intoNanoComp:masterfrom
ChristopherHogan:chogan/split_by_cost
Closed
Split chunks based on costs obtained from fragment_stats#663ChristopherHogan wants to merge 2 commits intoNanoComp:masterfrom ChristopherHogan:chogan/split_by_cost
ChristopherHogan wants to merge 2 commits intoNanoComp:masterfrom
ChristopherHogan:chogan/split_by_cost
Conversation
Collaborator
Collaborator
|
Rebased. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #536. Adds
grid_volume::split_by_costwhich attempts to divide the cell into chunks that take a similar amount of work. The work estimate is produced byfragment_stats::cost, which was obtained from running linear regression on training data from random simulations. Scheme will fall back to the oldgrid_volume::split_by_effortmethod. Additionally, there is aSimulationconstructor parameter for Python,split_chunks_evenly, that will force the use ofsplit_by_effort. Here are some benchmark results from the following simulation (a tall skinny cell with an expensive flux plane at the top):The
meep::structureis now created in C++ (create_structure_and_set_materials) instead of Python. Using the geometry instructure::choose_chunkdivisionwould require making copies, or passing it around, both of which would require more significant changes.create_structure_and_set_materialsallows the Python geometry to be converted to C++ once, then deleted when it returns.Remaining issues
split_by_costdoesn't work with cylindrical coordinates yet so it falls back tosplit_by_effortsplit_by_costbreaks thestructure::dumpandstructure::loadfeatures. When you run the initial simulation and dump the structure file, the chunks are split optimally based on the geometry, but when you attempt to load the file, there is no geometry passed in so the chunks are split evenly, resulting in chunk size mismatches. My temporary solution to this is to passsplit_chunks_evenly=Trueto aSimulationwhen you know you want to dump and reuse a structure file. I guessstructure::loadneeds to recreate the chunks with the correct sizes.