Update periodic search#34
Open
talensgj wants to merge 8 commits into
Open
Conversation
Owner
|
Thanks for this fix @talensgj. I am curious, did you see any performance benefits from setting the chunksize? |
Contributor
Author
|
It was hard to tell. In the original use with imap with chunksize=1 both multiprocessing and jax were running multi-core processing at the same time. With starmap and chunksize>1 this no longer happens. I would need to compare chunksize=1 and chunksize=500 on the new code to check, but I've been distracted by other things. I can at least confirm that with chunksize=500, about 30 mins were spend on solve_ with multiprocessing and 90 mins on snr_f with jax. |
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.
When running the periodic search I repeatedly got the warning: "os.fork() is incompatible with multithreaded code, and JAX is multithreaded, so this will likely lead to a deadlock."
It never seemed to cause any actual issues, but fork is set to be deprecated so I modified the periodic search to use 'spawn' instead. Since 'spawn' (and 'forkserver') don't allow the use of global fold_f I had to switch to
Pool.starmapand explicitly pass fold_f.While I was at it I also exposed
processesandchunksizeto allow the user more fine-grained control over the multiprocessing and addedif __name__ == '__main__':which I understand to be good practice for multiprocessed code.As a final note I wonder if it might be a good idea to move the snr_f evaluations outside of the
with Poolstatement ?