Multiprocessing (not ready!) #25
Open
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.
Used the multiprocessing.pool.apply_async() method to post the actual simulation function "ode_twolayer()" asynchronously to the multiprocessing pool, for each simulation.
It was necessary since all the parameter logic is parsed as global attributes of the class Notebook ("self" in main.py), and it was impossible to fork the multiprocessing at a higher level (e.g. at "self.do_Calculate()" as initially tried.). The usual way would have been pool.apply() but it would require to have the arguments for each simulation all ready and specified at the same level.
With this implementation of multiprocessing we have achieve a significant performance/time gain.
For a batch simulation of 8 different powers, using 4 different processors:
Added a few prints to give more insight in the start, multiprocessing (different "start events" in parallel and asynchronous "end" events), end of all processes and elapsed time.
Requires testing (running a batch of simulations) for the modules Std_SingleLayer.py, Nanowire.py, HeatPlate.py