Skip to content

Conversation

@eistrup
Copy link
Collaborator

@eistrup eistrup commented Aug 20, 2021

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:

  • with time=100 ns // dt=0.5 ns // max dt=0.25ns, the non-mp ran for 35 sec while the mp branch took only 22 sec.
  • with time=10000 ns // dt=0.5 ns // max dt=0.25ns, the non-mp ran for 1543 sec (26min) while the mp branch took only 1067 sec.

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

@eistrup eistrup changed the title Multiprocessing Multiprocessing (not ready!) Aug 22, 2021
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