I have the sketch of my code as follows:
def func1(c):
return a,b
def func2(c,x):
if condition:
a,b = func1(c)
x.append(a,b)
func2(a,x)
func2(b,x)
return x
x = []
y = func2(c, x)
The problem, as you might have figured out from the code, is that I would like func2(b)
to be computed in parallel with func2(a)
whenever condition is true i.e. before b
is replace by a
new b
from func2(a)
. But according to my algorithm, this clearly can not happen due to the new b's.
I do think such a problem might be perfect for parallel computing approach. But, I did not use it before and my knowledge about that is quite limited. I did try the suggestion from How to do parallel programming in Python, though. But I got the same result like the sketch above.