HagesLab / OneLayer

One-layer transient PL simulations, but in runnable application form
GNU General Public License v3.0
0 stars 0 forks source link

Multiprocessing (not ready!) #25

Open eistrup opened 3 years ago

eistrup commented 3 years ago

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