[IPython-dev] IPython parallel and objects

thwiouz maidos93 at laposte.net
Wed Jan 28 07:40:25 EST 2015


Hi guys,

I'd like to parallelize the following loop:

m1 = np.arange(0, 10, 100)
m2 = np.arange(0, 10, 100)

for m_ in m1:
    for n_2 in m2:
        tmp = optimizer.compute_expectation([m_, n_])
        res.append(tmp)

with type(optimizer) some class that I've defined. How could I handle it? 

I tried to do the same as in
http://stackoverflow.com/questions/9363118/parallelise-nested-for-loop-in-ipython
so I created a lambda function f

f = lambda x, y: optimizer.compute_expectation([x, y])

but it's not working with a load balanced view, saying that optimizer is not
defined.

Could someone help?

Thanks,




--
View this message in context: http://python.6.x6.nabble.com/IPython-parallel-and-objects-tp5084497.html
Sent from the IPython - Development mailing list archive at Nabble.com.



More information about the IPython-dev mailing list