1

I am having a little bit of trouble with multiprocessing in python.

I can easily run a one level multiprocessing. However, I am stuck when comes to upgrading it to a two level multiprocessing. Let me explain, what I am doing now:

I have NBC number of conductors, I want to compute the defining electrical parameters (R,L and C), so I run python script in a one level multiprocessing where R, L and C for each conductor are computed as follow:

for i in range(0,NBC):
    compute_R_of_conductor() 
    compute_L_of_conductor()
    compute_C_of_conductor()

where, well you guessed it, compute_R_of_conductor(), compute_L_of_conductor() and compute_C_of_conductor() are predefined functions that are run perfectly simultaneously.

I would like to include the part for i in range(0,NBC) in the second level of multiprocessing so that I have the electrical parameters of multiple conductors computed at once to speed up even more my computations. How can I do that?

Thanks in advance :)

Wallflower
  • 550
  • 1
  • 4
  • 13
  • Does this answer your question? [How do I parallelize a simple Python loop?](https://stackoverflow.com/questions/9786102/how-do-i-parallelize-a-simple-python-loop) – JonSG Jan 11 '22 at 15:58
  • @JonSG No it does not. I can parallelize one loop, the problem is how to parallelize a nested loop `for i in range(0,NBC): for j in range(0,3)`: – Wallflower Jan 12 '22 at 08:58

0 Answers0