Skip to content Skip to sidebar Skip to footer

Joblib With Objects

I'm a newcomer w.r.t. parallel processing, and I'd like to ask for a bit of help here please. I have an object that I need to replicate in memory, something like 50-100 times or ev

Solution 1:

delayed is to wrap a function (not an object, which would now return a replicated Virus). so do not call Replicate in delayed call

but also it seems you would not be able to wrap an instance method, so make replicate a regular function which would replicate its argument

defreplicate(virus):
    return virus.Replicate()

h = Virus()
results = Parallel(n_jobs=2)(delayed(replicate)(h) for i inrange(10))
print [x.idfor x in results]

works for me

Post a Comment for "Joblib With Objects"